mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-27 19:47:42 +01:00
Merge remote branch 'remotes/ess/groupmanager' into essmaster
This commit is contained in:
commit
c681befdf2
@ -19,3 +19,4 @@ v 1.1:
|
|||||||
- manulistp now accepts an additional + to list ALL Superperms effective permissions (/manulistp <name> +).
|
- manulistp now accepts an additional + to list ALL Superperms effective permissions (/manulistp <name> +).
|
||||||
- manucheckp also outputs superperms results.
|
- manucheckp also outputs superperms results.
|
||||||
- Removed superperms update on plugins unloading. Unneeded and created undesired lag on shutdown.
|
- 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.
|
@ -7,6 +7,7 @@ package org.anjocaido.groupmanager;
|
|||||||
import org.anjocaido.groupmanager.permissions.AnjoPermissionsHandler;
|
import org.anjocaido.groupmanager.permissions.AnjoPermissionsHandler;
|
||||||
import org.anjocaido.groupmanager.permissions.BukkitPermissions;
|
import org.anjocaido.groupmanager.permissions.BukkitPermissions;
|
||||||
import org.anjocaido.groupmanager.utils.GroupManagerPermissions;
|
import org.anjocaido.groupmanager.utils.GroupManagerPermissions;
|
||||||
|
import org.anjocaido.groupmanager.Tasks.BukkitPermsUpdateTask;
|
||||||
import org.anjocaido.groupmanager.data.Variables;
|
import org.anjocaido.groupmanager.data.Variables;
|
||||||
import org.anjocaido.groupmanager.data.User;
|
import org.anjocaido.groupmanager.data.User;
|
||||||
import org.anjocaido.groupmanager.data.Group;
|
import org.anjocaido.groupmanager.data.Group;
|
||||||
@ -62,7 +63,7 @@ public class GroupManager extends JavaPlugin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
isLoaded = false;
|
setLoaded(false);
|
||||||
|
|
||||||
if (worldsHolder != null) {
|
if (worldsHolder != null) {
|
||||||
worldsHolder.saveChanges();
|
worldsHolder.saveChanges();
|
||||||
@ -96,10 +97,29 @@ public class GroupManager extends JavaPlugin {
|
|||||||
BukkitPermissions = new BukkitPermissions(this);
|
BukkitPermissions = new BukkitPermissions(this);
|
||||||
|
|
||||||
enableScheduler();
|
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.");
|
||||||
|
else
|
||||||
|
setLoaded(true);
|
||||||
|
|
||||||
|
//setLoaded(true);
|
||||||
System.out.println(pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!");
|
System.out.println(pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isLoaded() {
|
||||||
|
return isLoaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setLoaded(boolean isLoaded) {
|
||||||
|
GroupManager.isLoaded = isLoaded;
|
||||||
|
}
|
||||||
|
|
||||||
public InputStream getResourceAsStream(String fileName) {
|
public InputStream getResourceAsStream(String fileName) {
|
||||||
return this.getClassLoader().getResourceAsStream(fileName);
|
return this.getClassLoader().getResourceAsStream(fileName);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,27 @@
|
|||||||
|
package org.anjocaido.groupmanager.Tasks;
|
||||||
|
|
||||||
|
import org.anjocaido.groupmanager.GroupManager;
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* Created by ElgarL
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class BukkitPermsUpdateTask implements Runnable {
|
||||||
|
|
||||||
|
public BukkitPermsUpdateTask() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
// Signal loaded and update BukkitPermissions.
|
||||||
|
GroupManager.setLoaded(true);
|
||||||
|
GroupManager.BukkitPermissions.updateAllPlayers();
|
||||||
|
|
||||||
|
GroupManager.logger.info("Bukkit Permissions Updated!");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -107,7 +107,7 @@ public class BukkitPermissions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void updatePermissions(Player player, String world) {
|
public void updatePermissions(Player player, String world) {
|
||||||
if (player == null || !GroupManager.isLoaded) {
|
if (player == null || !GroupManager.isLoaded()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,6 +237,9 @@ public class BukkitPermissions {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||||
|
if (!GroupManager.isLoaded())
|
||||||
|
return;
|
||||||
|
|
||||||
attachments.remove(event.getPlayer());
|
attachments.remove(event.getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,6 +253,9 @@ public class BukkitPermissions {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPluginEnable(PluginEnableEvent event) {
|
public void onPluginEnable(PluginEnableEvent event) {
|
||||||
|
if (!GroupManager.isLoaded())
|
||||||
|
return;
|
||||||
|
|
||||||
collectPermissions();
|
collectPermissions();
|
||||||
updateAllPlayers();
|
updateAllPlayers();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user