Treating the RP channel as global

This commit is contained in:
Norbi Peti 2018-11-01 01:24:01 +01:00
parent 241992571e
commit df6e76086b
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56
4 changed files with 16 additions and 18 deletions

4
.gitignore vendored
View file

@ -131,7 +131,7 @@ publish/
*.publishproj
# NuGet Packages Directory
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
## TO!DO: If you have NuGet Package Restore enabled, uncomment the next line
#packages/
# Windows Azure Build Output
@ -221,4 +221,4 @@ TheButtonAutoFlair/out/artifacts/Autoflair/Autoflair.jar
*.name
.idea/compiler.xml
*.xml
/.apt_generated/
/.apt_generated/

View file

@ -92,6 +92,8 @@
</executions>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
<useSystemClassLoader>false
</useSystemClassLoader> <!-- https://stackoverflow.com/a/53012553/2703239 -->
</configuration>
</plugin>
<!-- <plugin> <groupId>org.basepom.maven</groupId> <artifactId>duplicate-finder-maven-plugin</artifactId>

View file

@ -62,7 +62,7 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
public static Channel TownChat;
public static Channel NationChat;
private static Channel RPChannel; //TODO: Move to ButtonCore - or use the ch filter in the Discord plugin
private static Channel RPChannel;
/**
* <p>
@ -98,11 +98,7 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
TownChat = new Channel("§3TC§f", Color.DarkAqua, "tc", s -> checkTownNationChat(s, false)));
TBMCChatAPI.RegisterChatChannel(
NationChat = new Channel("§6NC§f", Color.Gold, "nc", s -> checkTownNationChat(s, true)));
TBMCChatAPI.RegisterChatChannel(RPChannel = new Channel("§7RP§f", Color.Gray, "rp", Channel.noScoreResult(s -> {
if (s instanceof ConsoleCommandSender)
return true;
return true; // TODO: Allow hiding it
}, "You need to show the RP chat in order to speak in it.")));
TBMCChatAPI.RegisterChatChannel(RPChannel = new Channel("§7RP§f", Color.Gray, "rp", null)); //Since it's null, it's recognised as global
Bukkit.getScheduler().runTask(this, () -> {
val dtp = (DynmapTownyPlugin) Bukkit.getPluginManager().getPlugin("Dynmap-Towny");

View file

@ -1,19 +1,19 @@
package buttondevteam.chat.commands;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import buttondevteam.lib.TBMCChatEventBase;
import buttondevteam.lib.chat.Channel;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.lib.chat.TBMCCommandBase;
import lombok.Data;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
@CommandClass(modOnly = false)
public final class UnlolCommand extends TBMCCommandBase {
@ -31,7 +31,7 @@ public final class UnlolCommand extends TBMCCommandBase {
@Override
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
LastlolData lol = Lastlol.values().stream().filter(lld -> lld.Chatevent.shouldSendTo(sender))
.max((lld1, lld2) -> Long.compare(lld1.Loltime, lld2.Loltime)).orElse(null);
.max(Comparator.comparingLong(lld -> lld.Loltime)).orElse(null);
if (lol == null)
return true;
if (lol.Lolowner instanceof Player)