From c434bb7f5034bf6b9e89ab894e7b8bed44d9d51a Mon Sep 17 00:00:00 2001 From: snowleo Date: Thu, 12 Jul 2012 11:08:56 +0200 Subject: Removed /essentials nya and /essentials moo --- .../src/net/ess3/commands/Commandessentials.java | 143 +++------------------ 1 file changed, 17 insertions(+), 126 deletions(-) diff --git a/Essentials/src/net/ess3/commands/Commandessentials.java b/Essentials/src/net/ess3/commands/Commandessentials.java index a3dad9d19..803de47cc 100644 --- a/Essentials/src/net/ess3/commands/Commandessentials.java +++ b/Essentials/src/net/ess3/commands/Commandessentials.java @@ -1,47 +1,32 @@ package net.ess3.commands; -import static net.ess3.I18n._; -import net.ess3.metrics.Metrics; import java.io.IOException; -import java.util.HashMap; import java.util.Map; - -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.block.Block; +import static net.ess3.I18n._; +import net.ess3.metrics.Metrics; import org.bukkit.command.CommandSender; import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.entity.Player; public class Commandessentials extends EssentialsCommand { - private transient int taskid; - private final transient Map noteBlocks = new HashMap(); - @Override public void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception { - if (args.length == 0) { + if (args.length == 0) + { run_disabled(sender, commandLabel, args); } else if (args[0].equalsIgnoreCase("debug")) { run_debug(sender, commandLabel, args); } - else if (args[0].equalsIgnoreCase("nya")) - { - run_nya(sender, commandLabel, args); - } - else if (args[0].equalsIgnoreCase("moo")) - { - run_moo(sender, commandLabel, args); - } else if (args[0].equalsIgnoreCase("opt-out")) { run_optout(sender, commandLabel, args); } - else { + else + { run_reload(sender, commandLabel, args); } } @@ -54,13 +39,15 @@ public class Commandessentials extends EssentialsCommand final StringBuilder disabledCommands = new StringBuilder(); for (Map.Entry entry : ess.getCommandHandler().disabledCommands().entrySet()) { - if (disabledCommands.length() > 0) { + if (disabledCommands.length() > 0) + { disabledCommands.append(", "); } disabledCommands.append(entry.getKey()).append(" => ").append(entry.getValue()); } - - if (disabledCommands.length() > 0) { + + if (disabledCommands.length() > 0) + { sender.sendMessage(_("blockList")); sender.sendMessage(disabledCommands.toString()); } @@ -78,114 +65,18 @@ public class Commandessentials extends EssentialsCommand sender.sendMessage(_("essentialsReload", ess.getDescription().getVersion())); } - private void run_nya(final CommandSender sender, final String commandLabel, final String[] args) throws Exception - { - final Map noteMap = new HashMap(); - noteMap.put("1F#", (byte)0x0); - noteMap.put("1G", (byte)0x1); - noteMap.put("1G#", (byte)0x2); - noteMap.put("1A", (byte)0x3); - noteMap.put("1A#", (byte)0x4); - noteMap.put("1B", (byte)0x5); - noteMap.put("1C", (byte)0x6); - noteMap.put("1C#", (byte)0x7); - noteMap.put("1D", (byte)0x8); - noteMap.put("1D#", (byte)0x9); - noteMap.put("1E", (byte)0xA); - noteMap.put("1F", (byte)0xB); - noteMap.put("2F#", (byte)(0x0 + 0xC)); - noteMap.put("2G", (byte)(0x1 + 0xC)); - noteMap.put("2G#", (byte)(0x2 + 0xC)); - noteMap.put("2A", (byte)(0x3 + 0xC)); - noteMap.put("2A#", (byte)(0x4 + 0xC)); - noteMap.put("2B", (byte)(0x5 + 0xC)); - noteMap.put("2C", (byte)(0x6 + 0xC)); - noteMap.put("2C#", (byte)(0x7 + 0xC)); - noteMap.put("2D", (byte)(0x8 + 0xC)); - noteMap.put("2D#", (byte)(0x9 + 0xC)); - noteMap.put("2E", (byte)(0xA + 0xC)); - noteMap.put("2F", (byte)(0xB + 0xC)); - if (!noteBlocks.isEmpty()) - { - return; - } - final String tuneStr = "1D#,1E,2F#,,2A#,1E,1D#,1E,2F#,2B,2D#,2E,2D#,2A#,2B,,2F#,,1D#,1E,2F#,2B,2C#,2A#,2B,2C#,2E,2D#,2E,2C#,,2F#,,2G#,,1D,1D#,,1C#,1D,1C#,1B,,1B,,1C#,,1D,,1D,1C#,1B,1C#,1D#,2F#,2G#,1D#,2F#,1C#,1D#,1B,1C#,1B,1D#,,2F#,,2G#,1D#,2F#,1C#,1D#,1B,1D,1D#,1D,1C#,1B,1C#,1D,,1B,1C#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F#,1G#,1B,,1F#,1G#,1B,1C#,1D#,1B,1E,1D#,1E,2F#,1B,,1B,,1F#,1G#,1B,1F#,1E,1D#,1C#,1B,,,,1F#,1B,,1F#,1G#,1B,,1F#,1G#,1B,1B,1C#,1D#,1B,1F#,1G#,1F#,1B,,1B,1A#,1B,1F#,1G#,1B,1E,1D#,1E,2F#,1B,,1B,,"; - final String[] tune = tuneStr.split(","); - for (Player player : server.getOnlinePlayers()) - { - final Location loc = player.getLocation(); - loc.add(0, 3, 0); - while (loc.getBlockY() < player.getLocation().getBlockY() + 10 && loc.getBlock().getTypeId() != 0) - { - loc.add(0, 1, 0); - } - if (loc.getBlock().getTypeId() == 0) - { - noteBlocks.put(player, loc.getBlock()); - loc.getBlock().setType(Material.NOTE_BLOCK); - } - } - taskid = ess.scheduleSyncRepeatingTask(new Runnable() - { - int i = 0; - - @Override - public void run() - { - final String note = tune[i]; - i++; - if (i >= tune.length) - { - Commandessentials.this.stopTune(); - } - if (note.isEmpty()) - { - return; - } - Map noteBlocks = Commandessentials.this.noteBlocks; - for (Player onlinePlayer : server.getOnlinePlayers()) - { - final Block block = noteBlocks.get(onlinePlayer); - if (block == null || block.getType() != Material.NOTE_BLOCK) - { - continue; - } - onlinePlayer.playNote(block.getLocation(), (byte)0, noteMap.get(note)); - } - } - }, 20, 2); - } - - private void stopTune() - { - server.getScheduler().cancelTask(taskid); - for (Block block : noteBlocks.values()) - { - if (block.getType() == Material.NOTE_BLOCK) - { - block.setType(Material.AIR); - } - } - noteBlocks.clear(); - } - - private void run_moo(final CommandSender sender, final String command, final String args[]) - { - if(sender instanceof ConsoleCommandSender) - sender.sendMessage(new String[]{" (__)", " (oo)", " /------\\/", " / | ||", " * /\\---/\\", " ~~ ~~", "....\"Have you mooed today?\"..." } ); - else - sender.sendMessage(new String[]{" (__)", " (oo)", " /------\\/", " / | | |", " * /\\---/\\", " ~~ ~~", "....\"Have you mooed today?\"..." } ); - } - private void run_optout(final CommandSender sender, final String command, final String args[]) { final Metrics metrics = ess.getMetrics(); try { sender.sendMessage("Essentials collects simple metrics to highlight which features to concentrate work on in the future."); - if (metrics.isOptOut()) { - metrics.enable(); - } else { + if (metrics.isOptOut()) + { + metrics.enable(); + } + else + { metrics.disable(); } sender.sendMessage("Anonymous Metrics are now: " + (metrics.isOptOut() ? "disabled" : "enabled")); -- cgit v1.2.3