Command updates

This commit is contained in:
GJ 2012-04-04 11:04:09 -04:00
parent 03e0c02640
commit d9b4647cf5

View File

@ -8,32 +8,31 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.Users; import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcPermissions; import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.config.LoadProperties; import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.runnables.SQLConversionTask; import com.gmail.nossr50.runnables.SQLConversionTask;
public class MmoupdateCommand implements CommandExecutor { public class MmoupdateCommand implements CommandExecutor {
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)) { if (CommandHelper.noConsoleUsage(sender)) {
sender.sendMessage("This command does not support console useage."); //TODO: Needs more locale.
return true; return true;
} }
Player player = (Player) sender; if (CommandHelper.noCommandPermissions(sender, "mcmmo.admin")) {
if (!mcPermissions.getInstance().admin(player)) {
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
return true; return true;
} }
player.sendMessage(ChatColor.GRAY + "Starting conversion..."); //TODO: Needs more locale.
sender.sendMessage(ChatColor.GRAY + "Starting conversion..."); //TODO: Needs more locale.
Users.clearUsers(); Users.clearUsers();
convertToMySQL(); convertToMySQL();
for (Player x : Bukkit.getServer().getOnlinePlayers()) { for (Player x : Bukkit.getServer().getOnlinePlayers()) {
Users.addUser(x); 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; return true;
} }