From 6165469e76174fa9573e850459acda9f99731630 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sun, 12 Jun 2016 15:26:58 +1000 Subject: [PATCH] Fix scripting --- .../main/java/com/intellectualcrafters/plot/PS.java | 8 ++++---- .../intellectualcrafters/plot/object/PlotPlayer.java | 10 +++++++--- .../java/com/plotsquared/general/commands/Command.java | 3 +++ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Core/src/main/java/com/intellectualcrafters/plot/PS.java b/Core/src/main/java/com/intellectualcrafters/plot/PS.java index 945fc1e81..92248870f 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/PS.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/PS.java @@ -182,10 +182,6 @@ public class PS { PS.debug("Incompatible version of WorldEdit, please upgrade: http://builds.enginehub.org/job/worldedit?branch=master"); } } - // Commands - if (Settings.Enabled_Components.COMMANDS) { - this.IMP.registerCommands(); - } if (Settings.Enabled_Components.EVENTS) { this.IMP.registerPlayerEvents(); this.IMP.registerInventoryEvents(); @@ -232,6 +228,10 @@ public class PS { AbstractTitle.TITLE_CLASS = this.IMP.initTitleManager(); // Chat ChatManager.manager = this.IMP.initChatManager(); + // Commands + if (Settings.Enabled_Components.COMMANDS) { + this.IMP.registerCommands(); + } // Economy if (Settings.Enabled_Components.ECONOMY) { TaskManager.runTask(new Runnable() { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/object/PlotPlayer.java b/Core/src/main/java/com/intellectualcrafters/plot/object/PlotPlayer.java index 127faebc5..d7d6d2d49 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/object/PlotPlayer.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/object/PlotPlayer.java @@ -60,10 +60,14 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { * @param value */ public void setMeta(String key, Object value) { - if (this.meta == null) { - this.meta = new ConcurrentHashMap<>(); + if (value == null) { + deleteMeta(key); + } else { + if (this.meta == null) { + this.meta = new ConcurrentHashMap<>(); + } + this.meta.put(key, value); } - this.meta.put(key, value); } /** diff --git a/Core/src/main/java/com/plotsquared/general/commands/Command.java b/Core/src/main/java/com/plotsquared/general/commands/Command.java index e6226bf64..9e68dffcb 100644 --- a/Core/src/main/java/com/plotsquared/general/commands/Command.java +++ b/Core/src/main/java/com/plotsquared/general/commands/Command.java @@ -59,6 +59,9 @@ public abstract class Command { this.required = required; this.category = cat; this.aliases = Arrays.asList(id); + if (this.parent != null) { + this.parent.register(this); + } } public Command(Command parent, boolean isStatic) {