From 58d8d1276f099c3fd0463af0656b270b1cc175bf Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Thu, 25 Oct 2018 23:51:39 +0200 Subject: [PATCH] Yeehaw fix & applying changes --- .../java/buttondevteam/chat/commands/YeehawCommand.java | 9 ++++----- .../chat/commands/appendtext/AppendTextCommandBase.java | 3 +-- .../java/buttondevteam/chat/listener/PlayerListener.java | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/main/java/buttondevteam/chat/commands/YeehawCommand.java b/src/main/java/buttondevteam/chat/commands/YeehawCommand.java index 6a4b563..ba42373 100644 --- a/src/main/java/buttondevteam/chat/commands/YeehawCommand.java +++ b/src/main/java/buttondevteam/chat/commands/YeehawCommand.java @@ -1,12 +1,11 @@ package buttondevteam.chat.commands; -import org.bukkit.Bukkit; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - import buttondevteam.lib.chat.CommandClass; import buttondevteam.lib.chat.TBMCCommandBase; import buttondevteam.lib.player.TBMCYEEHAWEvent; +import org.bukkit.Bukkit; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; @CommandClass(modOnly = false) public class YeehawCommand extends TBMCCommandBase { @@ -22,9 +21,9 @@ public class YeehawCommand extends TBMCCommandBase { + (sender instanceof Player ? ((Player) sender).getDisplayName() : sender.getName()) + " §bYEEHAWs."; for (Player p : Bukkit.getOnlinePlayers()) { p.playSound(p.getLocation(), "tbmc.yeehaw", 1f, 1f); + p.sendMessage(message); //Not broadcasting, so the Discord plugin can handle the event in a special way } // Even a cmdblock could yeehaw in theory // Or anyone from Discord - Bukkit.broadcastMessage(message); Bukkit.getPluginManager().callEvent(new TBMCYEEHAWEvent(sender)); return true; } diff --git a/src/main/java/buttondevteam/chat/commands/appendtext/AppendTextCommandBase.java b/src/main/java/buttondevteam/chat/commands/appendtext/AppendTextCommandBase.java index 74350d6..5e36f88 100644 --- a/src/main/java/buttondevteam/chat/commands/appendtext/AppendTextCommandBase.java +++ b/src/main/java/buttondevteam/chat/commands/appendtext/AppendTextCommandBase.java @@ -5,7 +5,6 @@ import buttondevteam.lib.chat.CommandClass; import buttondevteam.lib.chat.TBMCChatAPI; import buttondevteam.lib.chat.TBMCCommandBase; import buttondevteam.lib.player.ChromaGamerBase; -import buttondevteam.lib.player.TBMCPlayer; import org.bukkit.command.CommandSender; @CommandClass(modOnly = false, excludeFromPath = true) @@ -21,7 +20,7 @@ public abstract class AppendTextCommandBase extends TBMCCommandBase { for (String arg : args) msg.append(arg).append(" "); msg.append(GetAppendedText()); TBMCChatAPI.SendChatMessage(ChatMessage.builder(sender, - ChromaGamerBase.getFromSender(sender, TBMCPlayer.class), msg.toString()) + ChromaGamerBase.getFromSender(sender), msg.toString()) .fromCommand(true).build()); return true; } diff --git a/src/main/java/buttondevteam/chat/listener/PlayerListener.java b/src/main/java/buttondevteam/chat/listener/PlayerListener.java index aebd816..4997347 100644 --- a/src/main/java/buttondevteam/chat/listener/PlayerListener.java +++ b/src/main/java/buttondevteam/chat/listener/PlayerListener.java @@ -75,7 +75,7 @@ public class PlayerListener implements Listener { if (message.length() < 2) return false; int index = message.indexOf(" "); - val mp = ChromaGamerBase.getFromSender(sender, TBMCPlayer.class); + val mp = ChromaGamerBase.getFromSender(sender); String cmd; final BiPredicate checkchid = (chan, cmd1) -> cmd1.equalsIgnoreCase(chan.ID) || (chan.IDs != null && Arrays.stream(chan.IDs).anyMatch(cmd1::equalsIgnoreCase)); if (index == -1) { // Only the command is run