summaryrefslogtreecommitdiffstats
path: root/EssentialsGroupManager
diff options
context:
space:
mode:
authorElgarL <ElgarL@palmergames.com>2012-04-21 16:58:22 +0100
committerElgarL <ElgarL@palmergames.com>2012-04-21 16:58:22 +0100
commit3ebec83d137f2c8ff24cc5a57d3eb8edd816892c (patch)
tree937deef841c5d61258e9dd65c11bac7ef3bbe11c /EssentialsGroupManager
parente0e43c8018010604e51d9875527e384821439ba7 (diff)
downloadEssentials-3ebec83d137f2c8ff24cc5a57d3eb8edd816892c.tar
Essentials-3ebec83d137f2c8ff24cc5a57d3eb8edd816892c.tar.gz
Essentials-3ebec83d137f2c8ff24cc5a57d3eb8edd816892c.tar.lz
Essentials-3ebec83d137f2c8ff24cc5a57d3eb8edd816892c.tar.xz
Essentials-3ebec83d137f2c8ff24cc5a57d3eb8edd816892c.zip
Fix forgetting sub groups on a manload.
Diffstat (limited to 'EssentialsGroupManager')
-rw-r--r--EssentialsGroupManager/src/Changelog.txt3
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java48
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java1
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java9
4 files changed, 52 insertions, 9 deletions
diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt
index e321c7741..c3ec8ccc1 100644
--- a/EssentialsGroupManager/src/Changelog.txt
+++ b/EssentialsGroupManager/src/Changelog.txt
@@ -181,4 +181,5 @@ v 2.0:
- Stop using our own deprecated methods as we tell others to do.
- Finally remove all deprecated methods.
- Re-initialize the WorldsHolder on a reload, as un-registering and re-registering a new holder means all plugins have to check for the new service on every quiery.
- - Prevent null perms getting past the GlobalGroups loader. \ No newline at end of file
+ - Prevent null perms getting past the GlobalGroups loader.
+ - Fix forgetting sub groups on a manload. \ No newline at end of file
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
index 3da9666c3..0571db4b6 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
@@ -103,13 +103,20 @@ public class GroupManager extends JavaPlugin {
}
}
- if (WorldEvents != null)
- WorldEvents = null;
+
// Remove all attachments before clearing
if (BukkitPermissions != null) {
BukkitPermissions.removeAllAttachments();
+ }
+
+ if (!restarting) {
+
+ if (WorldEvents != null)
+ WorldEvents = null;
+
BukkitPermissions = null;
+
}
// EXAMPLE: Custom code, here we just output some info so we can check that all is well
@@ -130,6 +137,9 @@ public class GroupManager extends JavaPlugin {
selectedWorlds = new HashMap<CommandSender, String>();
lastError = "";
+ /*
+ * Setup our logger if we are not restarting.
+ */
if (!restarting) {
GroupManager.logger.setUseParentHandlers(false);
ch = new GMLoggerHandler();
@@ -144,11 +154,17 @@ public class GroupManager extends JavaPlugin {
// Load the global groups
globalGroups = new GlobalGroups(this);
+ /*
+ * Configure the worlds holder.
+ */
if (!restarting)
worldsHolder = new WorldsHolder(this);
else
worldsHolder.resetWorldsHolder();
+ /*
+ * This should NEVER happen. No idea why it's still here.
+ */
PluginDescriptionFile pdfFile = this.getDescription();
if (worldsHolder == null) {
GroupManager.logger.severe("Can't enable " + pdfFile.getName() + " version " + pdfFile.getVersion() + ", bad loading!");
@@ -156,13 +172,30 @@ public class GroupManager extends JavaPlugin {
throw new IllegalStateException("An error ocurred while loading GroupManager");
}
- // Set a few defaults (reloads)
+ /*
+ * Prevent our registered events from triggering
+ * updates as we are not fully loaded.
+ */
setLoaded(false);
- // Initialize the world listener and bukkit permissions to handle events.
- WorldEvents = new GMWorldListener(this);
- BukkitPermissions = new BukkitPermissions(this);
+ /*
+ * Initialize the world listener and bukkit permissions
+ * to handle events if this is a fresh start
+ *
+ * else
+ *
+ * Reset bukkit perms.
+ */
+ if (!restarting) {
+ WorldEvents = new GMWorldListener(this);
+ BukkitPermissions = new BukkitPermissions(this);
+ } else {
+ BukkitPermissions.reset();
+ }
+ /*
+ * Start the scheduler for data saving.
+ */
enableScheduler();
/*
@@ -172,6 +205,9 @@ public class GroupManager extends JavaPlugin {
if (getServer().getScheduler().scheduleSyncDelayedTask(this, new BukkitPermsUpdateTask(), 1) == -1) {
GroupManager.logger.severe("Could not schedule superperms Update.");
+ /*
+ * Flag that we are now loaded and should start processing events.
+ */
setLoaded(true);
}
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java
index a9ab4befa..27a7d9a59 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java
@@ -62,6 +62,7 @@ public class WorldsHolder {
public void resetWorldsHolder() {
+ worldsData = new HashMap<String, OverloadedWorldHolder>();
mirrorsGroup = new HashMap<String, String>();
mirrorsUser = new HashMap<String, String>();
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java
index c366b65bf..e8322c391 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java
@@ -96,12 +96,17 @@ public class BukkitPermissions {
public BukkitPermissions(GroupManager plugin) {
this.plugin = plugin;
- this.collectPermissions();
+ this.reset();
this.registerEvents();
- this.updateAllPlayers();
+
GroupManager.logger.info("Superperms support enabled.");
}
+
+ public void reset() {
+ this.collectPermissions();
+ this.updateAllPlayers();
+ }
private void registerEvents() {