diff --git a/TheButtonAutoFlair.jar b/TheButtonAutoFlair.jar index 4d1b2d6..8476b53 100644 Binary files a/TheButtonAutoFlair.jar and b/TheButtonAutoFlair.jar differ diff --git a/TheButtonAutoFlair/plugin.yml b/TheButtonAutoFlair/plugin.yml index cf2a83c..4961c96 100644 --- a/TheButtonAutoFlair/plugin.yml +++ b/TheButtonAutoFlair/plugin.yml @@ -15,5 +15,11 @@ commands: description: Unlaugh the last laugh. unlaugh: description: Unlaugh the last laugh. + mwiki: + description: Search the wiki. + usage: "&vUsage: /mwiki [query]&r" author: NorbiPeti depend: [Essentials, Towny, Minigames, Votifier] +permissions: + tbmc.admin: + description: Gives access to /un- commands and /u admin commands diff --git a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/Commands.java b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/Commands.java index 7cfde70..4dd107b 100644 --- a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/Commands.java +++ b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/Commands.java @@ -213,6 +213,9 @@ public class Commands implements CommandExecutor { p.sendMessage("§b* " + p.getDisplayName() + " YEEHAWs."); } } + case "mwiki": { + DoMWiki(player, args); + } default: player.sendMessage("Unknown command: " + cmd.getName()); break; @@ -259,9 +262,8 @@ public class Commands implements CommandExecutor { private static String DoAdminUsage = "§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin|togglerpshow|toggledebug|savepos|loadpos§r"; - private static void DoAdmin(Player player, String[] args) { // 2015.08.09. - if (player == null || player.isOp() - || player.getName().equals("NorbiPeti")) { + private static void DoAdmin(Player player, String[] args) { + if (player == null || PluginMain.permission.has(player, "tbmc.admin")) { if (args.length == 1) { String message = DoAdminUsage; SendMessage(player, message); @@ -322,7 +324,7 @@ public class Commands implements CommandExecutor { return; } } else - player.sendMessage("§cYou need to be OP to use this command.§r"); + player.sendMessage("§cYou don't have permission to use this command.§r"); } private static void DoPlayerInfo(Player player, String[] args) { // 2015.08.09. @@ -620,4 +622,18 @@ public class Commands implements CommandExecutor { } catch (MobException e) { } } + + private static void DoMWiki(Player player, String[] args) { + String query = ""; + for (int i = 0; i < args.length; i++) + query += args[i]; + query = query.trim(); + if (args.length == 0) + SendMessage(player, + "§bMinecraft Wiki link: http://minecraft.gamepedia.com/"); + else + SendMessage(player, + "§bMinecraft Wiki link: http://minecraft.gamepedia.com/index.php?search=" + + query + "&title=Special%3ASearch&go=Go"); + } } diff --git a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PlayerListener.java b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PlayerListener.java index de4dd36..6fbf8a6 100644 --- a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PlayerListener.java +++ b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PlayerListener.java @@ -16,8 +16,11 @@ import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.help.HelpTopic; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.SkullMeta; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; import org.bukkit.scoreboard.Objective; import ru.tehkode.permissions.bukkit.PermissionsEx; @@ -710,7 +713,8 @@ public class PlayerListener implements Listener { // 2015.07.16. } catch (NotRegisteredException e) { return; } - } else if (cmd.equalsIgnoreCase("home") || cmd.equalsIgnoreCase("tpa") || cmd.equalsIgnoreCase("tp")) { + } else if (cmd.equalsIgnoreCase("home") || cmd.equalsIgnoreCase("tpa") + || cmd.equalsIgnoreCase("tp")) { MinigamePlayer mgp = Minigames.plugin.pdata.getMinigamePlayer(event .getPlayer()); if (mgp.isInMinigame() @@ -718,6 +722,34 @@ public class PlayerListener implements Listener { // 2015.07.16. .equals("creativeglobal")) { mgp.setAllowTeleport(true); } + } else if (cmd.toLowerCase().startsWith("un")) { + for (HelpTopic ht : PluginMain.Instance.getServer().getHelpMap() + .getHelpTopics()) { + // event.getPlayer().sendMessage("HT: " + ht.getName()); + if (ht.getName().equalsIgnoreCase("/" + cmd)) + return; + } + if (PluginMain.permission.has(event.getPlayer(), "tbmc.admin")) { + String s = cmd.substring(2); + Player target = null; + target = Bukkit.getPlayer(event.getMessage().substring( + index + 1)); + if (target == null) { + event.getPlayer().sendMessage( + "§cError: Player not found. (/un" + s + + " )"); + event.setCancelled(true); + } + if (target != null) { + target.addPotionEffect(new PotionEffect( + PotionEffectType.BLINDNESS, 10 * 20, 5, false, + false)); + for (Player pl : PluginMain.GetPlayers()) + pl.sendMessage(event.getPlayer().getDisplayName() + + " un" + s + "'d " + target.getDisplayName()); + event.setCancelled(true); + } + } } } diff --git a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PluginMain.java b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PluginMain.java index c5eebed..e799f0a 100644 --- a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PluginMain.java +++ b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PluginMain.java @@ -91,6 +91,9 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15. this.getCommand("ooc").getUsage().replace('&', '§')); this.getCommand("unlol").setExecutor(comm); this.getCommand("unlaugh").setExecutor(comm); + this.getCommand("mwiki").setExecutor(comm); + this.getCommand("mwiki").setUsage( + this.getCommand("mwiki").getUsage().replace('&', '§')); Instance = this; // 2015.08.08. Console = this.getServer().getConsoleSender(); // 2015.08.12. LoadFiles(false); // 2015.08.09. diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/Commands$2.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/Commands$2.class index 54f0041..bbbb981 100644 Binary files a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/Commands$2.class and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/Commands$2.class differ diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/Commands.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/Commands.class index ceaa88f..1df905d 100644 Binary files a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/Commands.class and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/Commands.class differ diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$1.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$1.class index b74dca2..8d8046f 100644 Binary files a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$1.class and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$1.class differ diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$2.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$2.class index 560e1d1..50b308b 100644 Binary files a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$2.class and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$2.class differ diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$3.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$3.class index cd7d4a0..6047ff5 100644 Binary files a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$3.class and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$3.class differ diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener.class index 6e19274..ce5ae63 100644 Binary files a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener.class and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener.class differ diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain$1.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain$1.class index ae55c88..85e6cef 100644 Binary files a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain$1.class and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain$1.class differ diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain$2.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain$2.class index dab0f28..7640c00 100644 Binary files a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain$2.class and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain$2.class differ diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain.class index cad34f7..ccf160d 100644 Binary files a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain.class and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain.class differ