Allow lookup of player's stats from console

Quick change to test new Jenkins+GitPOST
This commit is contained in:
NuclearW 2012-02-08 23:17:01 -05:00
parent 20248212ae
commit 6382bec05a
2 changed files with 22 additions and 4 deletions

View File

@ -8,6 +8,7 @@ import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.datatypes.PlayerProfile;
@ -16,6 +17,12 @@ import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.skills.Skills;
public class StatsCommand implements CommandExecutor {
private final mcMMO plugin;
public StatsCommand(mcMMO instance) {
this.plugin = instance;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!LoadProperties.statsEnable) {
@ -23,12 +30,23 @@ public class StatsCommand implements CommandExecutor {
return true;
}
Player player = (Player) sender;
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
return true;
if(args.length != 1) {
sender.sendMessage("Usage: stats <username>");
return true;
} else {
Player temp = plugin.getServer().getPlayer(args[0]);
if(temp == null) {
sender.sendMessage("Could not find player: " + args[0]);
return true;
} else {
player = temp;
}
}
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
player.sendMessage(mcLocale.getString("mcPlayerListener.YourStats"));

View File

@ -304,7 +304,7 @@ public class mcMMO extends JavaPlugin
if(LoadProperties.mmoeditEnable) getCommand("mmoedit").setExecutor(new MmoeditCommand(this));
getCommand("mmoupdate").setExecutor(new MmoupdateCommand());
if(LoadProperties.myspawnEnable) getCommand("myspawn").setExecutor(new MyspawnCommand());
if(LoadProperties.statsEnable) getCommand("stats").setExecutor(new StatsCommand());
if(LoadProperties.statsEnable) getCommand("stats").setExecutor(new StatsCommand(this));
if(LoadProperties.whoisEnable) getCommand("whois").setExecutor(new WhoisCommand(this));
if(LoadProperties.xprateEnable) getCommand("xprate").setExecutor(new XprateCommand());