Browse Source

Added simple coin/exp manager from console

master
pintux98 6 years ago
parent
commit
d32bcd551b
  1. 1
      MultiArena-TheBridge/bin/.gitignore
  2. 69
      MultiArena-TheBridge/src/cx/sfy/TheBridge/cmds/SetupCMD.java

1
MultiArena-TheBridge/bin/.gitignore

@ -1 +0,0 @@
/cx/

69
MultiArena-TheBridge/src/cx/sfy/TheBridge/cmds/SetupCMD.java

@ -16,6 +16,7 @@ import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import cx.sfy.TheBridge.Main;
import cx.sfy.TheBridge.database.PlayerStat;
import cx.sfy.TheBridge.fanciful.FancyMessage;
import cx.sfy.TheBridge.game.GameDuo;
import cx.sfy.TheBridge.game.GameDuo.State;
@ -999,8 +1000,76 @@ public class SetupCMD implements CommandExecutor {
p.sendMessage("§aDefault lifes has been setted. To §e" + lifes + "§a.");
break;
}
} else {
if (args.length < 1) {
sendStatsHelp(sender);
return true;
}
switch (args[0].toLowerCase()) {
case "player":
if (args.length < 4) {
sendStatsHelp(sender);
return true;
}
Player pl = Bukkit.getPlayer(args[1]);
if (pl == null) {
sender.sendMessage("Player with that name not found");
return true;
}
PlayerStat ps = PlayerStat.getPlayerStat(pl);
if (ps == null) {
sender.sendMessage("Data for that player not found!");
return true;
}
switch (args[2].toLowerCase()) {
case "give":
if (args[3].equalsIgnoreCase("exp")) {
ps.addXP(Integer.valueOf(args[4]));
sender.sendMessage("Exp updated");
return true;
}
if (args[3].equalsIgnoreCase("coins")) {
ps.addCoins(Integer.valueOf(args[4]));
sender.sendMessage("Coins updated");
return true;
}
break;
case "take":
if (args[3].equalsIgnoreCase("exp")) {
ps.removeXP(Integer.valueOf(args[4]));
sender.sendMessage("Exp updated");
return true;
}
if (args[3].equalsIgnoreCase("coins")) {
ps.removeCoins(Integer.valueOf(args[4]));
sender.sendMessage("Coins updated");
return true;
}
break;
case "set":
if (args[3].equalsIgnoreCase("exp")) {
ps.setXp(Integer.valueOf(args[4]));
sender.sendMessage("Exp updated");
return true;
}
if (args[3].equalsIgnoreCase("coins")) {
ps.setCoins(Integer.valueOf(args[4]));
sender.sendMessage("Coins updated");
return true;
}
break;
}
break;
}
}
return false;
}
private void sendStatsHelp(CommandSender p) {
p.sendMessage("------------TheBridge---------------");
p.sendMessage("bridges player <player> <give/take/set> <exp/coins> <ammount>");
p.sendMessage("------------------------------------");
}
public void sendHelp(Player p) {

Loading…
Cancel
Save