mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-11-08 03:50:06 +01:00
Merge remote-tracking branch 'remotes/origin/groupmanager' into 2.9
This commit is contained in:
commit
115c4fa1d0
@ -206,3 +206,5 @@ v 2.0:
|
|||||||
- Prevent GM commands from being used on CommandBlocks.
|
- Prevent GM commands from being used on CommandBlocks.
|
||||||
- Clear our attachment map upon a manload so we correctly reconfigure a players new permissions.
|
- Clear our attachment map upon a manload so we correctly reconfigure a players new permissions.
|
||||||
- Synchronize the raising of GroupManager events to Bukkit.getServer() (should prevent deadlocks).
|
- Synchronize the raising of GroupManager events to Bukkit.getServer() (should prevent deadlocks).
|
||||||
|
- Synchronize pushing to Bukkit perms to prevent any ConcurrentModificationException.
|
||||||
|
- Do not grant any permissions (nor update Bukkit) if the server is in offline mode and the player has the permission node 'groupmanager.noofflineperms'.
|
@ -112,7 +112,7 @@ public class GMConfiguration {
|
|||||||
|
|
||||||
Object level = ((Map<String, String>) getElement("settings", GMconfig).get("logging")).get("level");
|
Object level = ((Map<String, String>) getElement("settings", GMconfig).get("logging")).get("level");
|
||||||
if (level instanceof String)
|
if (level instanceof String)
|
||||||
level = (String) level;
|
loggerLevel = (String) level;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Store our mirrors map for parsing later.
|
* Store our mirrors map for parsing later.
|
||||||
|
@ -152,7 +152,7 @@ public class GroupManager extends JavaPlugin {
|
|||||||
ch = new GMLoggerHandler();
|
ch = new GMLoggerHandler();
|
||||||
GroupManager.logger.addHandler(ch);
|
GroupManager.logger.addHandler(ch);
|
||||||
}
|
}
|
||||||
logger.setLevel(Level.ALL);
|
GroupManager.logger.setLevel(Level.ALL);
|
||||||
|
|
||||||
// Create the backup folder, if it doesn't exist.
|
// Create the backup folder, if it doesn't exist.
|
||||||
prepareFileFields();
|
prepareFileFields();
|
||||||
|
@ -16,6 +16,7 @@ import org.anjocaido.groupmanager.data.Group;
|
|||||||
import org.anjocaido.groupmanager.dataholder.WorldDataHolder;
|
import org.anjocaido.groupmanager.dataholder.WorldDataHolder;
|
||||||
import org.anjocaido.groupmanager.data.User;
|
import org.anjocaido.groupmanager.data.User;
|
||||||
import org.anjocaido.groupmanager.utils.PermissionCheckResult;
|
import org.anjocaido.groupmanager.utils.PermissionCheckResult;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -785,6 +786,15 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Do not push any perms to bukkit if...
|
||||||
|
* We are in offline mode
|
||||||
|
* and the player has the 'groupmanager.noofflineperms' permission.
|
||||||
|
*/
|
||||||
|
if (!Bukkit.getServer().getOnlineMode()
|
||||||
|
&& (checkFullGMPermission(user, "groupmanager.noofflineperms", true).resultType == PermissionCheckResult.Type.FOUND))
|
||||||
|
return result;
|
||||||
|
|
||||||
if (checkBukkit) {
|
if (checkBukkit) {
|
||||||
// Check Bukkit perms to support plugins which add perms via code
|
// Check Bukkit perms to support plugins which add perms via code
|
||||||
// (Heroes).
|
// (Heroes).
|
||||||
|
@ -31,7 +31,6 @@ import java.util.WeakHashMap;
|
|||||||
|
|
||||||
import org.anjocaido.groupmanager.GroupManager;
|
import org.anjocaido.groupmanager.GroupManager;
|
||||||
import org.anjocaido.groupmanager.data.User;
|
import org.anjocaido.groupmanager.data.User;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -137,8 +136,7 @@ public class BukkitPermissions {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Push all permissions which are registered with GM for this player, on
|
* Push all permissions which are registered with GM for this player, on
|
||||||
* this world to Bukkit
|
* this world to Bukkit and make it update for the child nodes.
|
||||||
* and make it update for the child nodes.
|
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player
|
||||||
* @param world
|
* @param world
|
||||||
@ -175,7 +173,8 @@ public class BukkitPermissions {
|
|||||||
List<String> playerPermArray = new ArrayList<String>(plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getAllPlayersPermissions(name, false));
|
List<String> playerPermArray = new ArrayList<String>(plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getAllPlayersPermissions(name, false));
|
||||||
LinkedHashMap<String, Boolean> newPerms = new LinkedHashMap<String, Boolean>();
|
LinkedHashMap<String, Boolean> newPerms = new LinkedHashMap<String, Boolean>();
|
||||||
|
|
||||||
// Sort the perm list by parent/child, so it will push to superperms correctly.
|
// Sort the perm list by parent/child, so it will push to superperms
|
||||||
|
// correctly.
|
||||||
playerPermArray = sort(playerPermArray);
|
playerPermArray = sort(playerPermArray);
|
||||||
|
|
||||||
Boolean value = false;
|
Boolean value = false;
|
||||||
@ -184,21 +183,36 @@ public class BukkitPermissions {
|
|||||||
newPerms.put((value ? permission : permission.substring(1)), value);
|
newPerms.put((value ? permission : permission.substring(1)), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Do not push any perms to bukkit if...
|
||||||
|
* We are in offline mode
|
||||||
|
* and the player has the 'groupmanager.noofflineperms' permission.
|
||||||
|
*/
|
||||||
|
if (!Bukkit.getServer().getOnlineMode()
|
||||||
|
&& (newPerms.containsKey("groupmanager.noofflineperms") && (newPerms.get("groupmanager.noofflineperms") == true))) {
|
||||||
|
removeAttachment(name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is put in place until such a time as Bukkit pull 466 is
|
* This is put in place until such a time as Bukkit pull 466 is
|
||||||
* implemented
|
* implemented https://github.com/Bukkit/Bukkit/pull/466
|
||||||
* https://github.com/Bukkit/Bukkit/pull/466
|
|
||||||
*/
|
*/
|
||||||
try { // Codename_B source
|
try { // Codename_B source
|
||||||
@SuppressWarnings("unchecked")
|
synchronized (attachment.getPermissible()) {
|
||||||
Map<String, Boolean> orig = (Map<String, Boolean>) permissions.get(attachment);
|
|
||||||
// Clear the map (faster than removing the attachment and recalculating)
|
@SuppressWarnings("unchecked")
|
||||||
orig.clear();
|
Map<String, Boolean> orig = (Map<String, Boolean>) permissions.get(attachment);
|
||||||
// Then whack our map into there
|
// Clear the map (faster than removing the attachment and
|
||||||
orig.putAll(newPerms);
|
// recalculating)
|
||||||
// That's all folks!
|
orig.clear();
|
||||||
attachment.getPermissible().recalculatePermissions();
|
// Then whack our map into there
|
||||||
//player.recalculatePermissions();
|
orig.putAll(newPerms);
|
||||||
|
// That's all folks!
|
||||||
|
attachment.getPermissible().recalculatePermissions();
|
||||||
|
|
||||||
|
}
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
|
@ -3,13 +3,16 @@ users:
|
|||||||
snowleo:
|
snowleo:
|
||||||
group: Builder
|
group: Builder
|
||||||
subgroups: []
|
subgroups: []
|
||||||
permissions: []
|
permissions:
|
||||||
|
- groupmanager.noofflineperms
|
||||||
KHobbits:
|
KHobbits:
|
||||||
group: Moderator
|
group: Moderator
|
||||||
subgroups: []
|
subgroups: []
|
||||||
permissions: []
|
permissions:
|
||||||
|
- groupmanager.noofflineperms
|
||||||
ElgarL:
|
ElgarL:
|
||||||
group: Moderator
|
group: Moderator
|
||||||
subgroups: []
|
subgroups: []
|
||||||
permissions: []
|
permissions:
|
||||||
|
- groupmanager.noofflineperms
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user