Make sure to update CommandBook installed status in onEnable

This commit is contained in:
zml2008 2012-04-07 13:46:25 -07:00
parent fe1e09289f
commit ad5b1cdcba
2 changed files with 8 additions and 5 deletions

View File

@ -90,14 +90,14 @@ public class ConfigurationManager {
* List of people who can breathe underwater. * List of people who can breathe underwater.
*/ */
private Set<String> hasAmphibious = new HashSet<String>(); private Set<String> hasAmphibious = new HashSet<String>();
private boolean hasCommandBookGodMode = false; private boolean hasCommandBookGodMode = false;
public boolean useRegionsScheduler; public boolean useRegionsScheduler;
public boolean activityHaltToggle = false; public boolean activityHaltToggle = false;
public boolean autoGodMode; public boolean autoGodMode;
public boolean usePlayerMove; public boolean usePlayerMove;
/** /**
* Region Storage Configuration method, and config values * Region Storage Configuration method, and config values
*/ */
@ -131,12 +131,13 @@ public void load() {
plugin.getLogger().severe("Error reading configuration for global config: "); plugin.getLogger().severe("Error reading configuration for global config: ");
e.printStackTrace(); e.printStackTrace();
} }
config.removeProperty("suppress-tick-sync-warnings"); config.removeProperty("suppress-tick-sync-warnings");
useRegionsScheduler = config.getBoolean( useRegionsScheduler = config.getBoolean(
"regions.use-scheduler", true); "regions.use-scheduler", true);
autoGodMode = config.getBoolean( autoGodMode = config.getBoolean(
"auto-invincible", config.getBoolean("auto-invincible-permission", false)); "auto-invincible", config.getBoolean("auto-invincible-permission", false));
config.removeProperty("auto-invincible-permission");
usePlayerMove = config.getBoolean( usePlayerMove = config.getBoolean(
"use-player-move-event", true); "use-player-move-event", true);
@ -211,6 +212,7 @@ public void forgetPlayer(LocalPlayer player) {
*/ */
@Deprecated @Deprecated
public void enableGodMode(Player player) { public void enableGodMode(Player player) {
hasGodMode.add(player.getName()); hasGodMode.add(player.getName());
} }
@ -267,7 +269,7 @@ public void disableAmphibiousMode(Player player) {
public boolean hasAmphibiousMode(Player player) { public boolean hasAmphibiousMode(Player player) {
return hasAmphibious.contains(player.getName()); return hasAmphibious.contains(player.getName());
} }
public void updateCommandBookGodMode() { public void updateCommandBookGodMode() {
try { try {
if (plugin.getServer().getPluginManager().isPluginEnabled("CommandBook")) { if (plugin.getServer().getPluginManager().isPluginEnabled("CommandBook")) {
@ -278,7 +280,7 @@ public void updateCommandBookGodMode() {
} catch (ClassNotFoundException ignore) {} } catch (ClassNotFoundException ignore) {}
hasCommandBookGodMode = false; hasCommandBookGodMode = false;
} }
public boolean hasCommandBookGodMode() { public boolean hasCommandBookGodMode() {
return hasCommandBookGodMode; return hasCommandBookGodMode;
} }

View File

@ -160,6 +160,7 @@ public void run() {
(new WorldGuardWeatherListener(this)).registerEvents(); (new WorldGuardWeatherListener(this)).registerEvents();
(new WorldGuardVehicleListener(this)).registerEvents(); (new WorldGuardVehicleListener(this)).registerEvents();
(new WorldGuardServerListener(this)).registerEvents(); (new WorldGuardServerListener(this)).registerEvents();
configuration.updateCommandBookGodMode();
if (getServer().getPluginManager().isPluginEnabled("CommandBook")) { if (getServer().getPluginManager().isPluginEnabled("CommandBook")) {
getServer().getPluginManager().registerEvents(new WorldGuardCommandBookListener(this), this); getServer().getPluginManager().registerEvents(new WorldGuardCommandBookListener(this), this);