From 2cf789d7bf5dfafef26e5f2726f2c26567d777bf Mon Sep 17 00:00:00 2001 From: nossr50 Date: Thu, 22 Mar 2012 13:58:54 -0700 Subject: [PATCH] Added console functionality to mctop --- Changelog.txt | 1 + .../nossr50/commands/mc/MctopCommand.java | 33 +++++++------------ 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 6c64538e5..b371fce2f 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -17,6 +17,7 @@ Version 1.3.03-dev + Added LOTS of new permissions nodes. *CHECK PLUGIN.YML FOR UPDATES* + Added Italian locale file - thanks Luxius96! + Added ability to inspect Ocelots with Beast Lore + + Added console functionality to mctop = Fixed Green Terra not awarding Triple Drops = Fixed ClassCastException from Taming preventDamage checks = Fixed issue with Blast Mining not seeing TNT for detonation due to snow diff --git a/src/main/java/com/gmail/nossr50/commands/mc/MctopCommand.java b/src/main/java/com/gmail/nossr50/commands/mc/MctopCommand.java index a3ca3484d..c0667f165 100644 --- a/src/main/java/com/gmail/nossr50/commands/mc/MctopCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/mc/MctopCommand.java @@ -7,8 +7,6 @@ import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - import com.gmail.nossr50.Leaderboard; import com.gmail.nossr50.m; import com.gmail.nossr50.mcMMO; @@ -21,13 +19,6 @@ public class MctopCommand implements CommandExecutor { @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { - if (!(sender instanceof Player)) { - sender.sendMessage("This command does not support console useage."); - return true; - } - - Player player = (Player) sender; - if (LoadProperties.useMySQL == false) { /* * POWER LEVEL INFO RETRIEVAL @@ -35,7 +26,7 @@ public class MctopCommand implements CommandExecutor { if (args.length == 0) { int p = 1; String[] info = Leaderboard.retrieveInfo(SkillType.ALL.toString(), p); - player.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevelLeaderboard")); + sender.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevelLeaderboard")); int n = 1 * p; // Position for (String x : info) { if (x != null) { @@ -44,7 +35,7 @@ public class MctopCommand implements CommandExecutor { digit = "0" + String.valueOf(n); String[] splitx = x.split(":"); // Format: 1. Playername - skill value - player.sendMessage(digit + ". " + ChatColor.GREEN + splitx[1] + " - " + ChatColor.WHITE + splitx[0]); + sender.sendMessage(digit + ". " + ChatColor.GREEN + splitx[1] + " - " + ChatColor.WHITE + splitx[0]); n++; } } @@ -64,7 +55,7 @@ public class MctopCommand implements CommandExecutor { pt = 10; } String[] info = Leaderboard.retrieveInfo(SkillType.ALL.toString(), p); - player.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevelLeaderboard")); + sender.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevelLeaderboard")); int n = 1 * pt; // Position for (String x : info) { if (x != null) { @@ -73,7 +64,7 @@ public class MctopCommand implements CommandExecutor { digit = "0" + String.valueOf(n); String[] splitx = x.split(":"); // Format: 1. Playername - skill value - player.sendMessage(digit + ". " + ChatColor.GREEN + splitx[1] + " - " + ChatColor.WHITE + splitx[0]); + sender.sendMessage(digit + ". " + ChatColor.GREEN + splitx[1] + " - " + ChatColor.WHITE + splitx[0]); n++; } } @@ -100,7 +91,7 @@ public class MctopCommand implements CommandExecutor { String capitalized = firstLetter.toUpperCase() + remainder.toLowerCase(); String[] info = Leaderboard.retrieveInfo(args[0].toUpperCase(), p); - player.sendMessage(mcLocale.getString("mcPlayerListener.SkillLeaderboard", new Object[] { capitalized })); + sender.sendMessage(mcLocale.getString("mcPlayerListener.SkillLeaderboard", new Object[] { capitalized })); int n = 1 * pt; // Position for (String x : info) { if (x != null) { @@ -109,7 +100,7 @@ public class MctopCommand implements CommandExecutor { digit = "0" + String.valueOf(n); String[] splitx = x.split(":"); // Format: 1. Playername - skill value - player.sendMessage(digit + ". " + ChatColor.GREEN + splitx[1] + " - " + ChatColor.WHITE + splitx[0]); + sender.sendMessage(digit + ". " + ChatColor.GREEN + splitx[1] + " - " + ChatColor.WHITE + splitx[0]); n++; } } @@ -128,7 +119,7 @@ public class MctopCommand implements CommandExecutor { String remainder = args[0].substring(1); // Get remainder of word. String capitalized = firstLetter.toUpperCase() + remainder.toLowerCase(); - player.sendMessage(mcLocale.getString("mcPlayerListener.SkillLeaderboard", new Object[] { capitalized })); + sender.sendMessage(mcLocale.getString("mcPlayerListener.SkillLeaderboard", new Object[] { capitalized })); if (args.length >= 2 && m.isInt(args[1])) { int n = 1; // For the page number int n2 = Integer.valueOf(args[1]); @@ -144,7 +135,7 @@ public class MctopCommand implements CommandExecutor { if (i > userslist.size() || mcMMO.database.read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null) break; HashMap> username = mcMMO.database.read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'"); - player.sendMessage(String.valueOf(i) + ". " + ChatColor.GREEN + userslist.get(i).get(0) + " - " + ChatColor.WHITE + username.get(1).get(0)); + sender.sendMessage(String.valueOf(i) + ". " + ChatColor.GREEN + userslist.get(i).get(0) + " - " + ChatColor.WHITE + username.get(1).get(0)); } return true; } @@ -154,12 +145,12 @@ public class MctopCommand implements CommandExecutor { if (i > userslist.size() || mcMMO.database.read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null) break; HashMap> username = mcMMO.database.read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'"); - player.sendMessage(String.valueOf(i) + ". " + ChatColor.GREEN + userslist.get(i).get(0) + " - " + ChatColor.WHITE + username.get(1).get(0)); + sender.sendMessage(String.valueOf(i) + ". " + ChatColor.GREEN + userslist.get(i).get(0) + " - " + ChatColor.WHITE + username.get(1).get(0)); } return true; } if (args.length >= 0) { - player.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevelLeaderboard")); + sender.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevelLeaderboard")); if (args.length >= 1 && m.isInt(args[0])) { int n = 1; // For the page number int n2 = Integer.valueOf(args[0]); @@ -174,7 +165,7 @@ public class MctopCommand implements CommandExecutor { if (i > userslist.size() || mcMMO.database.read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null) break; HashMap> username = mcMMO.database.read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'"); - player.sendMessage(String.valueOf(i) + ". " + ChatColor.GREEN + userslist.get(i).get(0) + " - " + ChatColor.WHITE + username.get(1).get(0)); + sender.sendMessage(String.valueOf(i) + ". " + ChatColor.GREEN + userslist.get(i).get(0) + " - " + ChatColor.WHITE + username.get(1).get(0)); } return true; } @@ -183,7 +174,7 @@ public class MctopCommand implements CommandExecutor { if (i > userslist.size() || mcMMO.database.read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null) break; HashMap> username = mcMMO.database.read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'"); - player.sendMessage(String.valueOf(i) + ". " + ChatColor.GREEN + userslist.get(i).get(0) + " - " + ChatColor.WHITE + username.get(1).get(0)); + sender.sendMessage(String.valueOf(i) + ". " + ChatColor.GREEN + userslist.get(i).get(0) + " - " + ChatColor.WHITE + username.get(1).get(0)); // System.out.println(username.get(1).get(0)); // System.out.println("Mining : " + userslist.get(i).get(0) + ", User id : " + userslist.get(i).get(1)); }