From 3aacd0769194f1c92eb94d1530e4c812c4a3cb31 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Wed, 7 Dec 2016 21:15:09 +0100 Subject: [PATCH] Finally implemented #41 and an event YEEHAW Oh, and smaller /mwiki changes --- .../chat/commands/MWikiCommand.java | 5 +++-- .../chat/commands/YeehawCommand.java | 16 ++++++++++------ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/main/java/buttondevteam/chat/commands/MWikiCommand.java b/src/main/java/buttondevteam/chat/commands/MWikiCommand.java index 03a0343..11d3974 100644 --- a/src/main/java/buttondevteam/chat/commands/MWikiCommand.java +++ b/src/main/java/buttondevteam/chat/commands/MWikiCommand.java @@ -25,8 +25,9 @@ public class MWikiCommand extends TBMCCommandBase { query += args[i] + " "; query = query.trim(); try { - if (args.length == 0) - sender.sendMessage("§bMinecraft Wiki link: http://minecraft.gamepedia.com/"); + if (query.length() == 0) + sender.sendMessage(new String[] { "§bMinecraft Wiki link: http://minecraft.gamepedia.com/", + "You can also search on it using /mwiki " }); else sender.sendMessage("§bMinecraft Wiki link: http://minecraft.gamepedia.com/index.php?search=" + URLEncoder.encode(query, "UTF-8") + "&title=Special%3ASearch&go=Go"); diff --git a/src/main/java/buttondevteam/chat/commands/YeehawCommand.java b/src/main/java/buttondevteam/chat/commands/YeehawCommand.java index 2abecee..8deb66f 100644 --- a/src/main/java/buttondevteam/chat/commands/YeehawCommand.java +++ b/src/main/java/buttondevteam/chat/commands/YeehawCommand.java @@ -1,27 +1,31 @@ package buttondevteam.chat.commands; +import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import buttondevteam.chat.PluginMain; +import buttondevteam.lib.TBMCYEEHAWEvent; import buttondevteam.lib.chat.TBMCCommandBase; public class YeehawCommand extends TBMCCommandBase { @Override public String[] GetHelpText(String alias) { - return new String[] { "§6---- YEEHAW command ----", - "This command makes you YEEHAW." }; + return new String[] { "§6---- YEEHAW command ----", "This command makes you YEEHAW." }; } @Override public boolean OnCommand(CommandSender sender, String alias, String[] args) { + final String message = "§b* " + + (sender instanceof Player ? ((Player) sender).getDisplayName() : sender.getName()) + " §bYEEHAWs."; for (Player p : PluginMain.GetPlayers()) { p.playSound(p.getLocation(), "tbmc.yeehaw", 1f, 1f); - p.sendMessage("§b* " - + (sender instanceof Player ? ((Player) sender) - .getDisplayName() : sender.getName()) + " §bYEEHAWs."); - } //Even a cmdblock could yeehaw in theory + p.sendMessage(message); + } // Even a cmdblock could yeehaw in theory + // Or anyone from Discord + Bukkit.getConsoleSender().sendMessage(message); + Bukkit.getPluginManager().callEvent(new TBMCYEEHAWEvent(sender)); return true; }