From 013287cb478e30f1fff501f755e2237cd89590f1 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Sun, 20 Oct 2019 20:53:15 +0200 Subject: [PATCH] Update to Java 10/11 --- .idea/ButtonChat.iml | 2 +- pom.xml | 6 +++--- src/main/java/buttondevteam/chat/ChatUtils.java | 5 ++--- .../chat/commands/ucmds/HistoryCommand.java | 1 - .../chat/components/fun/FunComponent.java | 4 ++-- .../chat/components/fun/PressCommand.java | 6 ++---- .../chat/components/fun/UnlolCommand.java | 12 +++++++----- .../components/towncolors/TownColorComponent.java | 1 - .../buttondevteam/chat/listener/PlayerListener.java | 4 ++-- 9 files changed, 19 insertions(+), 22 deletions(-) diff --git a/.idea/ButtonChat.iml b/.idea/ButtonChat.iml index f7d11c6..a5b528d 100644 --- a/.idea/ButtonChat.iml +++ b/.idea/ButtonChat.iml @@ -1,6 +1,6 @@ - + diff --git a/pom.xml b/pom.xml index 67c858b..3580f98 100644 --- a/pom.xml +++ b/pom.xml @@ -30,14 +30,14 @@ maven-compiler-plugin 3.8.1 - 1.8 - 1.8 + 10 + 10 org.apache.maven.plugins maven-shade-plugin - 2.4.2 + 3.2.1 package diff --git a/src/main/java/buttondevteam/chat/ChatUtils.java b/src/main/java/buttondevteam/chat/ChatUtils.java index d716acc..9a3b15e 100644 --- a/src/main/java/buttondevteam/chat/ChatUtils.java +++ b/src/main/java/buttondevteam/chat/ChatUtils.java @@ -1,8 +1,7 @@ package buttondevteam.chat; +import buttondevteam.lib.ChromaUtils; import buttondevteam.lib.TBMCChatEvent; -import buttondevteam.lib.ThorpeUtils; -import lombok.var; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -50,7 +49,7 @@ public final class ChatUtils { */ public static void sendChatMessage(TBMCChatEvent e, Function modifier) { var str = "[" + e.getChannel().DisplayName().get() + "] <" - + ThorpeUtils.getDisplayName(e.getSender()) + "> " + e.getMessage(); + + ChromaUtils.getDisplayName(e.getSender()) + "> " + e.getMessage(); str = modifier.apply(str); for (Player p : Bukkit.getOnlinePlayers()) if (e.shouldSendTo(p)) diff --git a/src/main/java/buttondevteam/chat/commands/ucmds/HistoryCommand.java b/src/main/java/buttondevteam/chat/commands/ucmds/HistoryCommand.java index fde4953..476ab03 100644 --- a/src/main/java/buttondevteam/chat/commands/ucmds/HistoryCommand.java +++ b/src/main/java/buttondevteam/chat/commands/ucmds/HistoryCommand.java @@ -5,7 +5,6 @@ import buttondevteam.lib.chat.ChatMessage; import buttondevteam.lib.chat.Command2; import buttondevteam.lib.chat.CommandClass; import lombok.RequiredArgsConstructor; -import lombok.experimental.var; import lombok.val; import org.bukkit.command.CommandSender; diff --git a/src/main/java/buttondevteam/chat/components/fun/FunComponent.java b/src/main/java/buttondevteam/chat/components/fun/FunComponent.java index 6acf3e5..82b1229 100644 --- a/src/main/java/buttondevteam/chat/components/fun/FunComponent.java +++ b/src/main/java/buttondevteam/chat/components/fun/FunComponent.java @@ -3,10 +3,10 @@ package buttondevteam.chat.components.fun; import buttondevteam.chat.ChatPlayer; import buttondevteam.chat.PluginMain; import buttondevteam.core.component.channel.Channel; +import buttondevteam.lib.ChromaUtils; import buttondevteam.lib.TBMCChatEventBase; import buttondevteam.lib.TBMCCommandPreprocessEvent; import buttondevteam.lib.TBMCSystemChatEvent; -import buttondevteam.lib.ThorpeUtils; import buttondevteam.lib.architecture.Component; import buttondevteam.lib.architecture.ConfigData; import buttondevteam.lib.chat.TBMCChatAPI; @@ -155,7 +155,7 @@ public class FunComponent extends Component implements Listener { val user = ChromaGamerBase.getFromSender(event.getSender()); target.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 10 * 20, 5, false, false)); val chan = user.channel().get(); - TBMCChatAPI.SendSystemMessage(chan, chan.getRTR(event.getSender()), ThorpeUtils.getDisplayName(event.getSender()) + " un" + s + TBMCChatAPI.SendSystemMessage(chan, chan.getRTR(event.getSender()), ChromaUtils.getDisplayName(event.getSender()) + " un" + s + "'d " + target.getDisplayName(), unlolTarget); } } diff --git a/src/main/java/buttondevteam/chat/components/fun/PressCommand.java b/src/main/java/buttondevteam/chat/components/fun/PressCommand.java index 123aab5..e675d20 100644 --- a/src/main/java/buttondevteam/chat/components/fun/PressCommand.java +++ b/src/main/java/buttondevteam/chat/components/fun/PressCommand.java @@ -1,15 +1,13 @@ package buttondevteam.chat.components.fun; import buttondevteam.core.component.channel.Channel; -import buttondevteam.core.component.restart.RestartComponent; import buttondevteam.core.component.restart.ScheduledRestartCommand; +import buttondevteam.lib.ChromaUtils; import buttondevteam.lib.ScheduledServerRestartEvent; -import buttondevteam.lib.ThorpeUtils; import buttondevteam.lib.chat.Command2; import buttondevteam.lib.chat.CommandClass; import buttondevteam.lib.chat.ICommand2MC; import buttondevteam.lib.chat.TBMCChatAPI; -import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -33,7 +31,7 @@ public class PressCommand extends ICommand2MC implements Listener { return; } pressers.add(sender); - TBMCChatAPI.SendSystemMessage(Channel.GlobalChat, Channel.RecipientTestResult.ALL, String.format("§b-- %s §bpressed at %.0fs", ThorpeUtils.getDisplayName(sender), command.getRestartCounter() / 20f), command.getComponent().getRestartBroadcast()); + TBMCChatAPI.SendSystemMessage(Channel.GlobalChat, Channel.RecipientTestResult.ALL, String.format("§b-- %s §bpressed at %.0fs", ChromaUtils.getDisplayName(sender), command.getRestartCounter() / 20f), command.getComponent().getRestartBroadcast()); command.setRestartCounter(startTicks); } diff --git a/src/main/java/buttondevteam/chat/components/fun/UnlolCommand.java b/src/main/java/buttondevteam/chat/components/fun/UnlolCommand.java index 8de6c9e..8a0ea93 100644 --- a/src/main/java/buttondevteam/chat/components/fun/UnlolCommand.java +++ b/src/main/java/buttondevteam/chat/components/fun/UnlolCommand.java @@ -1,13 +1,15 @@ package buttondevteam.chat.components.fun; import buttondevteam.core.component.channel.Channel; +import buttondevteam.lib.ChromaUtils; import buttondevteam.lib.TBMCChatEventBase; import buttondevteam.lib.TBMCSystemChatEvent; -import buttondevteam.lib.ThorpeUtils; -import buttondevteam.lib.chat.*; +import buttondevteam.lib.chat.Command2; +import buttondevteam.lib.chat.CommandClass; +import buttondevteam.lib.chat.ICommand2MC; +import buttondevteam.lib.chat.TBMCChatAPI; import lombok.Data; import lombok.RequiredArgsConstructor; -import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.potion.PotionEffect; @@ -39,9 +41,9 @@ public final class UnlolCommand extends ICommand2MC { if (lol.Lolowner instanceof Player) ((Player) lol.Lolowner) .addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 2 * 20, 5, false, false)); - String msg = ThorpeUtils.getDisplayName(sender) + String msg = ChromaUtils.getDisplayName(sender) + (lol.Lolornot ? " unlolled " : " unlaughed ") - + ThorpeUtils.getDisplayName(lol.Lolowner); + + ChromaUtils.getDisplayName(lol.Lolowner); TBMCChatAPI.SendSystemMessage(Channel.GlobalChat, Channel.RecipientTestResult.ALL, msg, target); Lastlol.remove(lol.Chatevent.getChannel()); return true; diff --git a/src/main/java/buttondevteam/chat/components/towncolors/TownColorComponent.java b/src/main/java/buttondevteam/chat/components/towncolors/TownColorComponent.java index 00c92ac..d685030 100644 --- a/src/main/java/buttondevteam/chat/components/towncolors/TownColorComponent.java +++ b/src/main/java/buttondevteam/chat/components/towncolors/TownColorComponent.java @@ -15,7 +15,6 @@ import com.earth2me.essentials.User; import com.palmergames.bukkit.towny.exceptions.NotRegisteredException; import com.palmergames.bukkit.towny.object.Nation; import lombok.Getter; -import lombok.experimental.var; import lombok.val; import org.bukkit.Bukkit; import org.bukkit.ChatColor; diff --git a/src/main/java/buttondevteam/chat/listener/PlayerListener.java b/src/main/java/buttondevteam/chat/listener/PlayerListener.java index 7fa3048..eb3aaf9 100644 --- a/src/main/java/buttondevteam/chat/listener/PlayerListener.java +++ b/src/main/java/buttondevteam/chat/listener/PlayerListener.java @@ -10,10 +10,10 @@ import buttondevteam.chat.components.towncolors.TownColorComponent; import buttondevteam.core.ComponentManager; import buttondevteam.core.component.channel.Channel; import buttondevteam.core.component.channel.ChatRoom; +import buttondevteam.lib.ChromaUtils; import buttondevteam.lib.TBMCChatEvent; import buttondevteam.lib.TBMCCoreAPI; import buttondevteam.lib.TBMCSystemChatEvent; -import buttondevteam.lib.ThorpeUtils; import buttondevteam.lib.chat.ChatMessage; import buttondevteam.lib.chat.TBMCChatAPI; import buttondevteam.lib.player.ChromaGamerBase; @@ -100,7 +100,7 @@ public class PlayerListener implements Listener { } else if (cmd.equalsIgnoreCase("minecraft:me")) { if (!(sender instanceof Player) || !PluginMain.essentials.getUser((Player) sender).isMuted()) { String msg = message.substring(index + 1); - TBMCChatAPI.SendSystemMessage(Channel.GlobalChat, Channel.RecipientTestResult.ALL, String.format("* %s %s", ThorpeUtils.getDisplayName(sender), msg), TBMCSystemChatEvent.BroadcastTarget.ALL); //TODO: Don't send to all + TBMCChatAPI.SendSystemMessage(Channel.GlobalChat, Channel.RecipientTestResult.ALL, String.format("* %s %s", ChromaUtils.getDisplayName(sender), msg), TBMCSystemChatEvent.BroadcastTarget.ALL); //TODO: Don't send to all return true; } else { sender.sendMessage("§cCan't use /minecraft:me while muted.");