mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2024-11-24 00:15:16 +01:00
!Small command fixes
This commit is contained in:
parent
5b67d2cca8
commit
d8f1e8d9e9
@ -1,7 +1,10 @@
|
||||
package net.Indyuce.mmocore.command.rpg.admin;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.command.api.CommandMap;
|
||||
|
||||
public class AdminCommandMap extends CommandMap {
|
||||
@ -30,6 +33,9 @@ public class AdminCommandMap extends CommandMap {
|
||||
|
||||
@Override
|
||||
public CommandResult execute(CommandSender sender, String[] args) {
|
||||
|
||||
MMOCore.plugin.lootChests.getRegion("test-region").spawnChest(PlayerData.get((Player) sender));
|
||||
|
||||
return CommandResult.THROW_USAGE;
|
||||
}
|
||||
}
|
||||
|
@ -14,8 +14,13 @@ public class StatValueCommandMap extends CommandEnd {
|
||||
public StatValueCommandMap(CommandMap parent) {
|
||||
super(parent, "statvalue");
|
||||
|
||||
addParameter(new Parameter("<stat>", list -> { for(StatType stat : StatType.values()) list.add(stat.name()); }));
|
||||
addParameter(new Parameter("(formatted)", list -> { list.add("true"); }));
|
||||
addParameter(new Parameter("<stat>", list -> {
|
||||
for (StatType stat : StatType.values())
|
||||
list.add(stat.name());
|
||||
}));
|
||||
addParameter(new Parameter("(formatted)", list -> {
|
||||
list.add("true");
|
||||
}));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -29,15 +34,20 @@ public class StatValueCommandMap extends CommandEnd {
|
||||
}
|
||||
PlayerData data = PlayerData.get((Player) sender);
|
||||
|
||||
StatType stat = StatType.valueOf(args[2]);
|
||||
if (stat == null) {
|
||||
StatType stat;
|
||||
try {
|
||||
stat = StatType.valueOf(args[2].toUpperCase().replace("-", "_").replace(" ", "_"));
|
||||
} catch (IllegalArgumentException exception) {
|
||||
sender.sendMessage(ChatColor.RED + "Could not find stat: " + args[2] + ".");
|
||||
return CommandResult.FAILURE;
|
||||
}
|
||||
|
||||
if (args.length > 3 && args[3].equals("true"))
|
||||
sender.sendMessage(DebugCommandMap.commandPrefix + "Stat Value (" + ChatColor.BLUE + stat.name() + ChatColor.WHITE + "): " + ChatColor.GREEN + stat.format(data.getStats().getStat(stat)) + ChatColor.WHITE + " *");
|
||||
else sender.sendMessage(DebugCommandMap.commandPrefix + "Stat Value (" + ChatColor.BLUE + stat.name() + ChatColor.WHITE + "): " + ChatColor.GREEN + data.getStats().getStat(stat));
|
||||
sender.sendMessage(DebugCommandMap.commandPrefix + "Stat Value (" + ChatColor.BLUE + stat.name() + ChatColor.WHITE + "): "
|
||||
+ ChatColor.GREEN + stat.format(data.getStats().getStat(stat)) + ChatColor.WHITE + " *");
|
||||
else
|
||||
sender.sendMessage(DebugCommandMap.commandPrefix + "Stat Value (" + ChatColor.BLUE + stat.name() + ChatColor.WHITE + "): "
|
||||
+ ChatColor.GREEN + data.getStats().getStat(stat));
|
||||
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user