Merge branch 'refs/heads/groupmanager'

This commit is contained in:
snowleo 2012-04-26 10:42:48 +02:00
commit 3a60191a9d
9 changed files with 69 additions and 14 deletions

View File

@ -3,6 +3,5 @@
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="lib/bukkit-0.0.1-SNAPSHOT.jar"/> <classpathentry kind="lib" path="lib/bukkit-0.0.1-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="lib/craftbukkit-0.0.1-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="lib/Permissions3.jar"/> <classpathentry kind="lib" path="lib/Permissions3.jar"/>
</classpath> </classpath>

View File

@ -3,7 +3,6 @@
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="../lib/bukkit.jar"/> <classpathentry kind="lib" path="../lib/bukkit.jar"/>
<classpathentry kind="lib" path="../lib/craftbukkit.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/EssentialsGroupManager"/> <classpathentry combineaccessrules="false" kind="src" path="/EssentialsGroupManager"/>
<classpathentry kind="lib" path="../lib/Permissions3.jar"/> <classpathentry kind="lib" path="../lib/Permissions3.jar"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>

View File

@ -10,6 +10,16 @@
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>
<buildCommand>
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
<dictionary>
<key>LaunchConfigHandle</key>
<value>&lt;project&gt;/.externalToolBuilders/GroupBridge.launch</value>
</dictionary>
</arguments>
</buildCommand>
</buildSpec> </buildSpec>
<natures> <natures>
<nature>org.eclipse.jdt.core.javanature</nature> <nature>org.eclipse.jdt.core.javanature</nature>

View File

@ -2,6 +2,6 @@
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="../lib/craftbukkit.jar"/> <classpathentry kind="lib" path="../lib/bukkit.jar"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>

View File

@ -181,3 +181,6 @@ v 2.0:
- Stop using our own deprecated methods as we tell others to do. - Stop using our own deprecated methods as we tell others to do.
- Finally remove all deprecated methods. - 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. - 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.
- Fix forgetting sub groups on a manload.
- Allow 'manucheckp' to notify when superperms reports false but it is really negated.

View File

@ -159,12 +159,14 @@ public class GlobalGroups {
if (element instanceof List) { if (element instanceof List) {
try { try {
for (String node : (List<String>) element) { for (String node : (List<String>) element) {
if ((node != null) && !node.isEmpty())
newGroup.addPermission(node); newGroup.addPermission(node);
} }
} catch (ClassCastException ex) { } catch (ClassCastException ex) {
throw new IllegalArgumentException("Invalid permission node for global group: " + groupName, ex); throw new IllegalArgumentException("Invalid permission node for global group: " + groupName, ex);
} }
} else if (element instanceof String) { } else if (element instanceof String) {
if ((element != null) && !((String)element).isEmpty())
newGroup.addPermission((String) element); newGroup.addPermission((String) element);
} else } else
throw new IllegalArgumentException("Unknown type of permission node for global group: " + groupName); throw new IllegalArgumentException("Unknown type of permission node for global group: " + groupName);

View File

@ -103,13 +103,20 @@ public class GroupManager extends JavaPlugin {
} }
} }
if (WorldEvents != null)
WorldEvents = null;
// Remove all attachments before clearing // Remove all attachments before clearing
if (BukkitPermissions != null) { if (BukkitPermissions != null) {
BukkitPermissions.removeAllAttachments(); BukkitPermissions.removeAllAttachments();
}
if (!restarting) {
if (WorldEvents != null)
WorldEvents = null;
BukkitPermissions = null; BukkitPermissions = null;
} }
// EXAMPLE: Custom code, here we just output some info so we can check that all is well // 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>(); selectedWorlds = new HashMap<CommandSender, String>();
lastError = ""; lastError = "";
/*
* Setup our logger if we are not restarting.
*/
if (!restarting) { if (!restarting) {
GroupManager.logger.setUseParentHandlers(false); GroupManager.logger.setUseParentHandlers(false);
ch = new GMLoggerHandler(); ch = new GMLoggerHandler();
@ -144,11 +154,17 @@ public class GroupManager extends JavaPlugin {
// Load the global groups // Load the global groups
globalGroups = new GlobalGroups(this); globalGroups = new GlobalGroups(this);
/*
* Configure the worlds holder.
*/
if (!restarting) if (!restarting)
worldsHolder = new WorldsHolder(this); worldsHolder = new WorldsHolder(this);
else else
worldsHolder.resetWorldsHolder(); worldsHolder.resetWorldsHolder();
/*
* This should NEVER happen. No idea why it's still here.
*/
PluginDescriptionFile pdfFile = this.getDescription(); PluginDescriptionFile pdfFile = this.getDescription();
if (worldsHolder == null) { if (worldsHolder == null) {
GroupManager.logger.severe("Can't enable " + pdfFile.getName() + " version " + pdfFile.getVersion() + ", bad loading!"); 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"); 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); setLoaded(false);
// Initialize the world listener and bukkit permissions to handle events. /*
* 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); WorldEvents = new GMWorldListener(this);
BukkitPermissions = new BukkitPermissions(this); BukkitPermissions = new BukkitPermissions(this);
} else {
BukkitPermissions.reset();
}
/*
* Start the scheduler for data saving.
*/
enableScheduler(); enableScheduler();
/* /*
@ -172,6 +205,9 @@ public class GroupManager extends JavaPlugin {
if (getServer().getScheduler().scheduleSyncDelayedTask(this, new BukkitPermsUpdateTask(), 1) == -1) { if (getServer().getScheduler().scheduleSyncDelayedTask(this, new BukkitPermsUpdateTask(), 1) == -1) {
GroupManager.logger.severe("Could not schedule superperms Update."); GroupManager.logger.severe("Could not schedule superperms Update.");
/*
* Flag that we are now loaded and should start processing events.
*/
setLoaded(true); setLoaded(true);
} }
@ -885,7 +921,7 @@ public class GroupManager extends JavaPlugin {
// superperms // superperms
if (targetPlayer != null) { if (targetPlayer != null) {
sender.sendMessage(ChatColor.YELLOW + "SuperPerms reports Node: " + targetPlayer.hasPermission(args[1])); sender.sendMessage(ChatColor.YELLOW + "SuperPerms reports Node: " + targetPlayer.hasPermission(args[1]) + ((!targetPlayer.hasPermission(args[1]) && targetPlayer.isPermissionSet(args[1])) ? " (Negated)": ""));
} }
return true; return true;

View File

@ -62,6 +62,7 @@ public class WorldsHolder {
public void resetWorldsHolder() { public void resetWorldsHolder() {
worldsData = new HashMap<String, OverloadedWorldHolder>();
mirrorsGroup = new HashMap<String, String>(); mirrorsGroup = new HashMap<String, String>();
mirrorsUser = new HashMap<String, String>(); mirrorsUser = new HashMap<String, String>();

View File

@ -96,13 +96,18 @@ public class BukkitPermissions {
public BukkitPermissions(GroupManager plugin) { public BukkitPermissions(GroupManager plugin) {
this.plugin = plugin; this.plugin = plugin;
this.collectPermissions(); this.reset();
this.registerEvents(); this.registerEvents();
this.updateAllPlayers();
GroupManager.logger.info("Superperms support enabled."); GroupManager.logger.info("Superperms support enabled.");
} }
public void reset() {
this.collectPermissions();
this.updateAllPlayers();
}
private void registerEvents() { private void registerEvents() {
PluginManager manager = plugin.getServer().getPluginManager(); PluginManager manager = plugin.getServer().getPluginManager();