From 97fd3eaf642e96735db14348ecb7c07e29335968 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Wed, 4 Apr 2012 08:05:41 -0700 Subject: [PATCH] Fixed mmoupdate not being useable from console --- Changelog.txt | 1 + .../commands/general/MmoupdateCommand.java | 22 +++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 81e4250fc..eaa2fb5ca 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -12,6 +12,7 @@ Version 1.3.06-dev + Added API functions for obtaining offline profiles & profiles via player names + Changed Archery's Daze to deal 4 DMG on proc (2 Hearts) + Changed /addlevel command to work for offline users + = Fixed mmoupdate not being useable from console ! Changed PlayerProfile constructor to always take a boolean ! Changed getPlayerProfile function to work for online & offline users diff --git a/src/main/java/com/gmail/nossr50/commands/general/MmoupdateCommand.java b/src/main/java/com/gmail/nossr50/commands/general/MmoupdateCommand.java index 4d91aefb9..5361adbdb 100644 --- a/src/main/java/com/gmail/nossr50/commands/general/MmoupdateCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/general/MmoupdateCommand.java @@ -16,24 +16,24 @@ import com.gmail.nossr50.runnables.SQLConversionTask; public class MmoupdateCommand 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."); //TODO: Needs more locale. + Player player = null; + + if(sender instanceof Player) { + player = (Player)sender; + } + + if (sender instanceof Player && !mcPermissions.getInstance().admin(player)) { + sender.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission")); return true; } - - Player player = (Player) sender; - - if (!mcPermissions.getInstance().admin(player)) { - player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission")); - return true; - } - player.sendMessage(ChatColor.GRAY + "Starting conversion..."); //TODO: Needs more locale. + + sender.sendMessage(ChatColor.GRAY + "Starting conversion..."); //TODO: Needs more locale. Users.clearUsers(); convertToMySQL(); for (Player x : Bukkit.getServer().getOnlinePlayers()) { Users.addUser(x); } - player.sendMessage(ChatColor.GREEN + "Conversion finished!"); //TODO: Needs more locale. + sender.sendMessage(ChatColor.GREEN + "Conversion finished!"); //TODO: Needs more locale. return true; }