forked from Upstream/mmocore
Merge branch 'master' of http://Indyuce@dev.lumine.io/bitbucket/scm/mmo/mmocore.git
This commit is contained in:
commit
c7bc510b7d
@ -15,6 +15,7 @@ import net.Indyuce.mmocore.command.rpg.NoteCommandMap;
|
|||||||
import net.Indyuce.mmocore.command.rpg.ReloadCommandMap;
|
import net.Indyuce.mmocore.command.rpg.ReloadCommandMap;
|
||||||
import net.Indyuce.mmocore.command.rpg.admin.AdminCommandMap;
|
import net.Indyuce.mmocore.command.rpg.admin.AdminCommandMap;
|
||||||
import net.Indyuce.mmocore.command.rpg.booster.BoosterCommandMap;
|
import net.Indyuce.mmocore.command.rpg.booster.BoosterCommandMap;
|
||||||
|
import net.Indyuce.mmocore.command.rpg.debug.DebugCommandMap;
|
||||||
import net.Indyuce.mmocore.command.rpg.waypoint.WaypointsCommandMap;
|
import net.Indyuce.mmocore.command.rpg.waypoint.WaypointsCommandMap;
|
||||||
|
|
||||||
public class MMOCoreCommand extends CommandRoot implements CommandExecutor, TabCompleter {
|
public class MMOCoreCommand extends CommandRoot implements CommandExecutor, TabCompleter {
|
||||||
@ -25,6 +26,7 @@ public class MMOCoreCommand extends CommandRoot implements CommandExecutor, TabC
|
|||||||
addFloor(new CoinsCommandMap(this));
|
addFloor(new CoinsCommandMap(this));
|
||||||
addFloor(new NoteCommandMap(this));
|
addFloor(new NoteCommandMap(this));
|
||||||
addFloor(new AdminCommandMap(this));
|
addFloor(new AdminCommandMap(this));
|
||||||
|
addFloor(new DebugCommandMap(this));
|
||||||
addFloor(new BoosterCommandMap(this));
|
addFloor(new BoosterCommandMap(this));
|
||||||
addFloor(new WaypointsCommandMap(this));
|
addFloor(new WaypointsCommandMap(this));
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
package net.Indyuce.mmocore.command.rpg.debug;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
|
public class Debug {
|
||||||
|
public static final String cmdPrefix = ChatColor.YELLOW + "[" + ChatColor.RED + "DEBUG" + ChatColor.GOLD + "] " + ChatColor.RESET;
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package net.Indyuce.mmocore.command.rpg.debug;
|
||||||
|
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import net.Indyuce.mmocore.command.api.CommandMap;
|
||||||
|
|
||||||
|
public class DebugCommandMap extends CommandMap {
|
||||||
|
public DebugCommandMap(CommandMap parent) {
|
||||||
|
super(parent, "debug");
|
||||||
|
|
||||||
|
addFloor(new StatValueCommandMap(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CommandResult execute(CommandSender sender, String[] args) {
|
||||||
|
return CommandResult.THROW_USAGE;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
package net.Indyuce.mmocore.command.rpg.debug;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||||
|
import net.Indyuce.mmocore.api.player.stats.StatType;
|
||||||
|
import net.Indyuce.mmocore.command.api.CommandEnd;
|
||||||
|
import net.Indyuce.mmocore.command.api.CommandMap;
|
||||||
|
import net.Indyuce.mmocore.command.api.Parameter;
|
||||||
|
|
||||||
|
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"); }));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CommandResult execute(CommandSender sender, String[] args) {
|
||||||
|
if (args.length < 3 )
|
||||||
|
return CommandResult.THROW_USAGE;
|
||||||
|
|
||||||
|
if(!(sender instanceof Player)) {
|
||||||
|
sender.sendMessage(ChatColor.RED + "This command can only be used by a player.");
|
||||||
|
return CommandResult.FAILURE;
|
||||||
|
}
|
||||||
|
PlayerData data = PlayerData.get((Player) sender);
|
||||||
|
|
||||||
|
StatType stat = StatType.valueOf(args[2]);
|
||||||
|
if (stat == null) {
|
||||||
|
sender.sendMessage(ChatColor.RED + "Could not find stat: " + args[2] + ".");
|
||||||
|
return CommandResult.FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(args.length > 3 && args[3].equals("true"))
|
||||||
|
sender.sendMessage(Debug.cmdPrefix + "Stat Value (" + ChatColor.BLUE + stat.name() + ChatColor.WHITE + "): " + ChatColor.GREEN + stat.format(data.getStats().getStat(stat)) + ChatColor.WHITE + " *");
|
||||||
|
else sender.sendMessage(Debug.cmdPrefix + "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