Command updates

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

View File

@ -8,37 +8,36 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
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.locale.mcLocale;
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.
return true;
}
Player player = (Player) sender;
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (CommandHelper.noConsoleUsage(sender)) {
return true;
}
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.
Users.clearUsers();
convertToMySQL();
for (Player x : Bukkit.getServer().getOnlinePlayers()) {
Users.addUser(x);
}
player.sendMessage(ChatColor.GREEN + "Conversion finished!"); //TODO: Needs more locale.
if (CommandHelper.noCommandPermissions(sender, "mcmmo.admin")) {
return true;
}
return true;
}
/**
sender.sendMessage(ChatColor.GRAY + "Starting conversion..."); //TODO: Needs more locale.
Users.clearUsers();
convertToMySQL();
for (Player x : Bukkit.getServer().getOnlinePlayers()) {
Users.addUser(x);
}
sender.sendMessage(ChatColor.GREEN + "Conversion finished!"); //TODO: Needs more locale.
return true;
}
/**
* Convert FlatFile data to MySQL data.
*/
private void convertToMySQL() {
@ -48,4 +47,4 @@ public class MmoupdateCommand implements CommandExecutor {
Bukkit.getScheduler().scheduleAsyncDelayedTask(Bukkit.getPluginManager().getPlugin("mcMMO"), new SQLConversionTask(), 1);
}
}
}