From 0f738ac0189c1e3e29cb33de17cca8770af0fb84 Mon Sep 17 00:00:00 2001 From: Jascha Starke Date: Fri, 16 Mar 2012 14:14:21 +0100 Subject: [PATCH] v1.0.1: blind fixed known issues - error on swapping to creative with correct config - "/region info" not working on new worldguard-versions - unload error when worldguard not enabled --- .gitignore | 3 ++- plugin.yml | 2 +- .../minecraft/limitedcreative/Configuration.java | 8 +++++--- src/de/jaschastarke/minecraft/limitedcreative/Core.java | 3 ++- src/de/jaschastarke/minecraft/worldguard/CCommand.java | 8 ++++++-- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 1383453..8baedc0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /.project /.classpath /bin -/.settings \ No newline at end of file +/.settings +/target \ No newline at end of file diff --git a/plugin.yml b/plugin.yml index d20d5ba..5ceb9ea 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,6 +1,6 @@ name: LimitedCreative main: de.jaschastarke.minecraft.limitedcreative.Core -version: 1.0 +version: 1.0.1 softdepend: [WorldGuard, WorldEdit, MultiInv] dev-url: http://dev.bukkit.org/server-mods/limited-creative/ commands: diff --git a/src/de/jaschastarke/minecraft/limitedcreative/Configuration.java b/src/de/jaschastarke/minecraft/limitedcreative/Configuration.java index fed84c3..82fc054 100644 --- a/src/de/jaschastarke/minecraft/limitedcreative/Configuration.java +++ b/src/de/jaschastarke/minecraft/limitedcreative/Configuration.java @@ -272,9 +272,11 @@ public class Configuration { if (sect.getBoolean("enabled")) { Map armor = new HashMap(); for (Map.Entry entry : sect.getValues(false).entrySet()) { - MaterialData md = parseMaterial((String) entry.getValue()); - if (md != null) - armor.put(entry.getKey(), md); + if (!entry.getKey().equals("enabled")) { + MaterialData md = parseMaterial((String) entry.getValue()); + if (md != null) + armor.put(entry.getKey(), md); + } } return armor; } diff --git a/src/de/jaschastarke/minecraft/limitedcreative/Core.java b/src/de/jaschastarke/minecraft/limitedcreative/Core.java index b3851e8..9dcc317 100644 --- a/src/de/jaschastarke/minecraft/limitedcreative/Core.java +++ b/src/de/jaschastarke/minecraft/limitedcreative/Core.java @@ -44,8 +44,9 @@ public class Core extends JavaPlugin { @Override public void onDisable() { plugin.getServer().getScheduler().cancelTasks(this); - try { + if (worldguard != null) worldguard.unload(); + try { Locale.unload(); } catch (NoClassDefFoundError e) {} // prevent unload issue diff --git a/src/de/jaschastarke/minecraft/worldguard/CCommand.java b/src/de/jaschastarke/minecraft/worldguard/CCommand.java index 2fa2cec..80a13ac 100644 --- a/src/de/jaschastarke/minecraft/worldguard/CCommand.java +++ b/src/de/jaschastarke/minecraft/worldguard/CCommand.java @@ -19,6 +19,7 @@ package de.jaschastarke.minecraft.worldguard; import static de.jaschastarke.minecraft.utils.Locale.L; +import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.World; import org.bukkit.command.Command; @@ -136,8 +137,11 @@ public class CCommand implements CommandExecutor { hasPermission(sender, Perms.INFO); }*/ - String[] args = new String[]{"info", region.getWorld().getName(), region.getProtectedRegion().getId()}; - wg.onCommand(sender, wg.getCommand("region"), "region", args); + /* + * WorldEdits intercepting Servers privates commandMap via Reflections realy sucks! + * Just because they are to lazy to add all the lines commands to plugin.yml + */ + Bukkit.getServer().dispatchCommand(sender, "region info "+region.getWorld().getName()+ " "+region.getProtectedRegion().getId()); StringBuilder list = new StringBuilder(); for (FlagValue data : region.getFlags()) {