Added a debug command to diagnose the issues in #2411

This commit is contained in:
MattBDev 2019-08-12 13:40:22 -04:00
parent 8ab10de4ad
commit ad7bcd19d4
2 changed files with 12 additions and 0 deletions

View File

@ -7,11 +7,20 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
import com.github.intellectualsites.plotsquared.plot.util.StringMan; import com.github.intellectualsites.plotsquared.plot.util.StringMan;
import java.util.Map;
@CommandDeclaration(command = "debug", category = CommandCategory.DEBUG, @CommandDeclaration(command = "debug", category = CommandCategory.DEBUG,
description = "Show debug information", usage = "/plot debug [msg]", permission = "plots.admin") description = "Show debug information", usage = "/plot debug [msg]", permission = "plots.admin")
public class Debug extends SubCommand { public class Debug extends SubCommand {
@Override public boolean onCommand(PlotPlayer player, String[] args) { @Override public boolean onCommand(PlotPlayer player, String[] args) {
if ((args.length > 0) && "player".equalsIgnoreCase(args[1])) {
for (Map.Entry<String, Object> meta : player.getMeta().entrySet()) {
MainUtil.sendMessage(player,
"Key: " + meta.getKey() + " Value: " + meta.getValue().toString() + " , ");
}
;
}
if ((args.length > 0) && args[0].equalsIgnoreCase("msg")) { if ((args.length > 0) && args[0].equalsIgnoreCase("msg")) {
StringBuilder msg = new StringBuilder(); StringBuilder msg = new StringBuilder();
for (Captions caption : Captions.values()) { for (Captions caption : Captions.values()) {

View File

@ -118,6 +118,9 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
return meta; return meta;
} }
public ConcurrentHashMap<String, Object> getMeta() {
return meta;
}
/** /**
* Delete the metadata for a key. * Delete the metadata for a key.
* - metadata is session only * - metadata is session only