summaryrefslogtreecommitdiffstats
path: root/EssentialsGroupManager
diff options
context:
space:
mode:
Diffstat (limited to 'EssentialsGroupManager')
-rw-r--r--EssentialsGroupManager/src/Changelog.txt3
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java24
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java8
3 files changed, 30 insertions, 5 deletions
diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt
index 7e2e65c4d..cded4ceb8 100644
--- a/EssentialsGroupManager/src/Changelog.txt
+++ b/EssentialsGroupManager/src/Changelog.txt
@@ -18,4 +18,5 @@ v 1.1:
- Fixed wasteful updating of perms on a manload.
- manulistp now accepts an additional + to list ALL Superperms effective permissions (/manulistp <name> +).
- manucheckp also outputs superperms results.
- - Removed superperms update on plugins unloading. Unneeded and created undesired lag on shutdown. \ No newline at end of file
+ - Removed superperms update on plugins unloading. Unneeded and created undesired lag on shutdown.
+ - Added a BukkitPermsUpdateTask to only update superperms once on a load/reload. \ 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 2b0a493d4..cc7f1de50 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
@@ -7,6 +7,7 @@ package org.anjocaido.groupmanager;
import org.anjocaido.groupmanager.permissions.AnjoPermissionsHandler;
import org.anjocaido.groupmanager.permissions.BukkitPermissions;
import org.anjocaido.groupmanager.utils.GroupManagerPermissions;
+import org.anjocaido.groupmanager.Tasks.BukkitPermsUpdateTask;
import org.anjocaido.groupmanager.data.Variables;
import org.anjocaido.groupmanager.data.User;
import org.anjocaido.groupmanager.data.Group;
@@ -62,7 +63,7 @@ public class GroupManager extends JavaPlugin {
@Override
public void onDisable() {
- isLoaded = false;
+ setLoaded(false);
if (worldsHolder != null) {
worldsHolder.saveChanges();
@@ -96,11 +97,28 @@ public class GroupManager extends JavaPlugin {
BukkitPermissions = new BukkitPermissions(this);
enableScheduler();
- isLoaded = true;
+
+ /*
+ * Schedule a Bukiit Permissions update for 1 tick later.
+ * All plugins will be loaded by then
+ */
+
+ if (getServer().getScheduler().scheduleSyncDelayedTask(this, new BukkitPermsUpdateTask(),1) == -1)
+ GroupManager.logger.severe("Could not schedule superperms Update.");
+
+ //setLoaded(true);
System.out.println(pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!");
}
- public InputStream getResourceAsStream(String fileName) {
+ public static boolean isLoaded() {
+ return isLoaded;
+ }
+
+ public static void setLoaded(boolean isLoaded) {
+ GroupManager.isLoaded = isLoaded;
+ }
+
+ public InputStream getResourceAsStream(String fileName) {
return this.getClassLoader().getResourceAsStream(fileName);
}
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java
index 02a1f4d5c..d3fbdbe55 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java
@@ -107,7 +107,7 @@ public class BukkitPermissions {
}
public void updatePermissions(Player player, String world) {
- if (player == null || !GroupManager.isLoaded) {
+ if (player == null || !GroupManager.isLoaded()) {
return;
}
@@ -237,6 +237,9 @@ public class BukkitPermissions {
@Override
public void onPlayerQuit(PlayerQuitEvent event) {
+ if (!GroupManager.isLoaded())
+ return;
+
attachments.remove(event.getPlayer());
}
@@ -250,6 +253,9 @@ public class BukkitPermissions {
@Override
public void onPluginEnable(PluginEnableEvent event) {
+ if (!GroupManager.isLoaded())
+ return;
+
collectPermissions();
updateAllPlayers();
}