From 815a9dcca22b108c158fcf41035edac2ff4b7178 Mon Sep 17 00:00:00 2001 From: ElgarL Date: Wed, 14 Dec 2011 16:24:47 +0000 Subject: Removed op permissions from admins in the default GloblaGroups.yml. --- EssentialsGroupManager/src/Changelog.txt | 3 ++- EssentialsGroupManager/src/globalgroups.yml | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'EssentialsGroupManager/src') diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index 47a0f6b79..1f5f0313d 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -85,4 +85,5 @@ v 1.7: - Offline player checks now support partial name matches. - Added custom events so plugins can now be notified of changes within GroupManager. - GM now registers with Bukkits ServicesManager. - - deleting the contents of GlobalGroups.yml will no longer thrown a NullPointerException. \ No newline at end of file + - deleting the contents of GlobalGroups.yml will no longer thrown a NullPointerException. + - Removed op permissions from admins in the default GloblaGroups.yml. \ No newline at end of file diff --git a/EssentialsGroupManager/src/globalgroups.yml b/EssentialsGroupManager/src/globalgroups.yml index 9662baf43..066f4faea 100644 --- a/EssentialsGroupManager/src/globalgroups.yml +++ b/EssentialsGroupManager/src/globalgroups.yml @@ -150,9 +150,9 @@ groups: - bukkit.command.kill - bukkit.command.list - bukkit.command.me - - bukkit.command.op - - bukkit.command.op.give - - bukkit.command.op.take + - -bukkit.command.op + - -bukkit.command.op.give + - -bukkit.command.op.take - bukkit.command.plugins - bukkit.command.reload - bukkit.command.save -- cgit v1.2.3 From ac77bbb0b4f405598b8fc8271d520818d0646da9 Mon Sep 17 00:00:00 2001 From: ElgarL Date: Sun, 18 Dec 2011 04:25:54 +0000 Subject: Changed ServicesManager registration to lowest from normal. --- EssentialsGroupManager/src/Changelog.txt | 3 ++- .../src/org/anjocaido/groupmanager/GroupManager.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'EssentialsGroupManager/src') diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index 1f5f0313d..76782e99a 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -86,4 +86,5 @@ v 1.7: - Added custom events so plugins can now be notified of changes within GroupManager. - GM now registers with Bukkits ServicesManager. - deleting the contents of GlobalGroups.yml will no longer thrown a NullPointerException. - - Removed op permissions from admins in the default GloblaGroups.yml. \ No newline at end of file + - Removed op permissions from admins in the default GloblaGroups.yml. + - Changed ServicesManager registration to lowest from normal. \ 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 2d46e74c8..c51efb8be 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java @@ -161,7 +161,7 @@ public class GroupManager extends JavaPlugin { System.out.println(pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!"); // Register as a service - this.getServer().getServicesManager().register(AnjoPermissionsHandler.class, this.permissionHandler, this, ServicePriority.Normal); + this.getServer().getServicesManager().register(AnjoPermissionsHandler.class, this.permissionHandler, this, ServicePriority.Lowest); } public static boolean isLoaded() { -- cgit v1.2.3 From de40f7f556513d4997779f0c5cc1d77fe050a02a Mon Sep 17 00:00:00 2001 From: ElgarL Date: Sun, 18 Dec 2011 14:26:00 +0000 Subject: Fixed 'manucheckp' returning a null for the searched node when it's a group/subgroup. --- EssentialsGroupManager/src/Changelog.txt | 4 +++- .../anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java | 3 +++ EssentialsGroupManager/src/plugin.yml | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) (limited to 'EssentialsGroupManager/src') diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index 76782e99a..69f921bb3 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -87,4 +87,6 @@ v 1.7: - GM now registers with Bukkits ServicesManager. - deleting the contents of GlobalGroups.yml will no longer thrown a NullPointerException. - Removed op permissions from admins in the default GloblaGroups.yml. - - Changed ServicesManager registration to lowest from normal. \ No newline at end of file +v 1.8: + - Changed ServicesManager registration to lowest from normal. + - Fixed 'manucheckp' returning a null for the searched node when it's a group/subgroup. \ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java index 6e18bf3f8..9b7253c41 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java @@ -711,12 +711,14 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { PermissionCheckResult resultUser = checkUserOnlyPermission(user, targetPermission); if (resultUser.resultType != PermissionCheckResult.Type.NOTFOUND) { + resultUser.accessLevel = targetPermission; return resultUser; } // IT ONLY CHECKS GROUPS PERMISSIONS IF RESULT FOR USER IS NOT FOUND PermissionCheckResult resultGroup = checkGroupPermissionWithInheritance(user.getGroup(), targetPermission); if (resultGroup.resultType != PermissionCheckResult.Type.NOTFOUND) { + result.accessLevel = targetPermission; return resultGroup; } @@ -724,6 +726,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { for (Group subGroup : user.subGroupListCopy()) { PermissionCheckResult resultSubGroup = checkGroupPermissionWithInheritance(subGroup, targetPermission); if (resultSubGroup.resultType != PermissionCheckResult.Type.NOTFOUND) { + resultSubGroup.accessLevel = targetPermission; return resultSubGroup; } } diff --git a/EssentialsGroupManager/src/plugin.yml b/EssentialsGroupManager/src/plugin.yml index 115e92ba2..da5164ce1 100644 --- a/EssentialsGroupManager/src/plugin.yml +++ b/EssentialsGroupManager/src/plugin.yml @@ -1,5 +1,5 @@ name: GroupManager -version: "1.7 (Phoenix)" +version: "1.8 (Phoenix)" main: org.anjocaido.groupmanager.GroupManager website: http://www.anjocaido.info/ description: Provides on-the-fly system for permissions system created by Nijikokun. But all in memory, and with flat-file saving schedule. -- cgit v1.2.3 From 244673e1fb8a8583c95df765e7b64f18c2c631c3 Mon Sep 17 00:00:00 2001 From: ElgarL Date: Sun, 18 Dec 2011 14:35:14 +0000 Subject: Fixed manucheckp on group (missed it in last commit) --- .../org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'EssentialsGroupManager/src') diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java index 9b7253c41..b23fc01d4 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java @@ -718,7 +718,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { // IT ONLY CHECKS GROUPS PERMISSIONS IF RESULT FOR USER IS NOT FOUND PermissionCheckResult resultGroup = checkGroupPermissionWithInheritance(user.getGroup(), targetPermission); if (resultGroup.resultType != PermissionCheckResult.Type.NOTFOUND) { - result.accessLevel = targetPermission; + resultGroup.accessLevel = targetPermission; return resultGroup; } -- cgit v1.2.3 From afe8ecd3dfd26d49c1133e330c942c90e7826e1f Mon Sep 17 00:00:00 2001 From: ElgarL Date: Sun, 18 Dec 2011 15:21:56 +0000 Subject: Fixed a typo --- EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'EssentialsGroupManager/src') diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java index c51efb8be..062d3df21 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java @@ -805,7 +805,7 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.YELLOW + "Permission Node: " + permissionResult.accessLevel); } else if (permissionResult.owner instanceof Group) { if (permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION)) { - sender.sendMessage(ChatColor.RED + "The user inherits the a negation permission from group: " + permissionResult.owner.getName()); + sender.sendMessage(ChatColor.RED + "The user inherits a negation permission from group: " + permissionResult.owner.getName()); } else { sender.sendMessage(ChatColor.YELLOW + "The user inherits the permission from group: " + permissionResult.owner.getName()); } -- cgit v1.2.3 From 7c8c40c7903852e3ee2d5740729f2e94b5982240 Mon Sep 17 00:00:00 2001 From: ElgarL Date: Mon, 19 Dec 2011 15:44:27 +0000 Subject: manpromote and mandemote now correctly sent the notification to the console if the command was issued there. --- EssentialsGroupManager/src/Changelog.txt | 3 ++- .../src/org/anjocaido/groupmanager/GroupManager.java | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'EssentialsGroupManager/src') diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index 69f921bb3..4b85fa94f 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -89,4 +89,5 @@ v 1.7: - Removed op permissions from admins in the default GloblaGroups.yml. v 1.8: - Changed ServicesManager registration to lowest from normal. - - Fixed 'manucheckp' returning a null for the searched node when it's a group/subgroup. \ No newline at end of file + - Fixed 'manucheckp' returning a null for the searched node when it's a group/subgroup. + - manpromote and mandemote now correctly send the notification to the console if the command was issued there. \ 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 062d3df21..9762a35a7 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java @@ -415,7 +415,7 @@ public class GroupManager extends JavaPlugin { // PARECE OK auxUser.setGroup(auxGroup); - if (!sender.hasPermission("groupmanager.notify.other")) + if (!sender.hasPermission("groupmanager.notify.other") || (isConsole)) sender.sendMessage(ChatColor.YELLOW + "You changed player '" + auxUser.getName() + "' group to '" + auxGroup.getName() + "'."); targetPlayer = this.getServer().getPlayer(auxUser.getName()); @@ -1610,7 +1610,7 @@ public class GroupManager extends JavaPlugin { } // PARECE OK auxUser.setGroup(auxGroup); - if (!sender.hasPermission("groupmanager.notify.other")) + if (!sender.hasPermission("groupmanager.notify.other") || (isConsole)) sender.sendMessage(ChatColor.YELLOW + "You changed " + auxUser.getName() + " group to " + auxGroup.getName() + "."); targetPlayer = this.getServer().getPlayer(auxUser.getName()); @@ -1666,7 +1666,7 @@ public class GroupManager extends JavaPlugin { } // PARECE OK auxUser.setGroup(auxGroup); - if (!sender.hasPermission("groupmanager.notify.other")) + if (!sender.hasPermission("groupmanager.notify.other") || (isConsole)) sender.sendMessage(ChatColor.YELLOW + "You changed " + auxUser.getName() + " group to " + auxGroup.getName() + "."); targetPlayer = this.getServer().getPlayer(auxUser.getName()); -- cgit v1.2.3 From a2202439bb1aeddaaad08c3b6607ce11b98356f3 Mon Sep 17 00:00:00 2001 From: ElgarL Date: Mon, 19 Dec 2011 19:22:04 +0000 Subject: Expanded GlobalGroups.yml and Groups.yml to include Towny permissions. --- EssentialsGroupManager/src/Changelog.txt | 3 +- EssentialsGroupManager/src/globalgroups.yml | 57 +++++++++++++++++++++++++++-- EssentialsGroupManager/src/groups.yml | 3 ++ 3 files changed, 58 insertions(+), 5 deletions(-) (limited to 'EssentialsGroupManager/src') diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index 4b85fa94f..6611c3e1b 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -90,4 +90,5 @@ v 1.7: v 1.8: - Changed ServicesManager registration to lowest from normal. - Fixed 'manucheckp' returning a null for the searched node when it's a group/subgroup. - - manpromote and mandemote now correctly send the notification to the console if the command was issued there. \ No newline at end of file + - manpromote and mandemote now correctly send the notification to the console if the command was issued there. + - Expanded GlobalGroups.yml and Groups.yml to include Towny permissions. \ No newline at end of file diff --git a/EssentialsGroupManager/src/globalgroups.yml b/EssentialsGroupManager/src/globalgroups.yml index 066f4faea..fe7b7df99 100644 --- a/EssentialsGroupManager/src/globalgroups.yml +++ b/EssentialsGroupManager/src/globalgroups.yml @@ -1,9 +1,5 @@ groups: - g:bukkit_default: - permissions: - - bukkit.broadcast.user - g:essentials_default: permissions: - essentials.help @@ -129,6 +125,10 @@ groups: - groupmanager.manucheckp - groupmanager.manulistp + g:bukkit_default: + permissions: + - bukkit.broadcast.user + g:bukkit_moderator: permissions: - bukkit.command.ban @@ -174,3 +174,52 @@ groups: - bukkit.command.whitelist.list - bukkit.command.whitelist.reload - bukkit.command.whitelist.remove + + g:towny_builder: + permissions: + - towny.town.* + - towny.nation.* + - towny.chat.tc + - towny.chat.nc + - towny.wild.block.6.* + - towny.wild.block.14.destroy + - towny.wild.block.15.destroy + - towny.wild.block.16.destroy + - towny.wild.block.17.* + - towny.wild.block.18.destroy + - towny.wild.block.21.destroy + - towny.wild.block.31.destroy + - towny.wild.block.37.destroy + - towny.wild.block.38.destroy + - towny.wild.block.39.destroy + - towny.wild.block.40.destroy + - towny.wild.block.50.destroy + - towny.wild.block.56.destroy + - towny.wild.block.73.destroy + - towny.wild.block.74.destroy + - towny.wild.block.78.destroy + - towny.wild.block.81.destroy + - towny.wild.block.82.destroy + - towny.wild.block.83.destroy + - towny.wild.block.86.destroy + - towny.wild.block.103.destroy + - towny.wild.block.106.destroy + - towny.wild.block.111.destroy + - towny.wild.block.115.destroy + + g:towny_moderator: + permissions: + - towny.chat.mod + - towny.wild.block.64.switch + - towny.wild.block.83.build + - towny.wild.block.86.build + - towny.wild.block.103.build + - towny.wild.block.111.build + - towny.wild.block.115.build + + g:towny_admin: + permissions: + - towny.admin + - -towny.wild.block.119.destroy + - -towny.wild.block.120.destroy + - towny.chat.admin \ No newline at end of file diff --git a/EssentialsGroupManager/src/groups.yml b/EssentialsGroupManager/src/groups.yml index 81fb4f030..e50054c9f 100644 --- a/EssentialsGroupManager/src/groups.yml +++ b/EssentialsGroupManager/src/groups.yml @@ -24,6 +24,7 @@ groups: inheritance: - default - g:essentials_builder + - g:towny_moderator info: prefix: '&2' build: true @@ -35,6 +36,7 @@ groups: - builder - g:essentials_moderator - g:bukkit_moderator + - g:towny_moderator info: prefix: '&5' build: true @@ -46,6 +48,7 @@ groups: - moderator - g:essentials_admin - g:bukkit_admin + - g:towny_admin info: prefix: '&c' build: true -- cgit v1.2.3 From debcf4714a3db9065219e3701137e8dea6439970 Mon Sep 17 00:00:00 2001 From: ElgarL Date: Tue, 20 Dec 2011 17:21:55 +0000 Subject: Delayed GroupManager events so Superperms will be fully updated before plugins receive the events. --- EssentialsGroupManager/src/Changelog.txt | 3 ++- .../src/org/anjocaido/groupmanager/GroupManager.java | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'EssentialsGroupManager/src') diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index 6611c3e1b..dc661f7c3 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -91,4 +91,5 @@ v 1.8: - Changed ServicesManager registration to lowest from normal. - Fixed 'manucheckp' returning a null for the searched node when it's a group/subgroup. - manpromote and mandemote now correctly send the notification to the console if the command was issued there. - - Expanded GlobalGroups.yml and Groups.yml to include Towny permissions. \ No newline at end of file + - Expanded GlobalGroups.yml and Groups.yml to include Towny permissions. + - Delayed GroupManager events so Superperms will be fully updated before plugins receive the events. \ 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 9762a35a7..5ced1fb47 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java @@ -1840,11 +1840,21 @@ public class GroupManager extends JavaPlugin { /** * Triggers all GroupManager events for other plugins to see. + * Schedules events for 1 tick later to allow GM to finish populating super perms. * * @param event */ - public static void callEvent(GroupManagerEvent event) { - Bukkit.getServer().getPluginManager().callEvent(event); + public static void callEvent(final GroupManagerEvent event) { + + if (Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("GroupManager"), new Runnable() { + + @Override + public void run() { + Bukkit.getServer().getPluginManager().callEvent(event); + } + }) == -1) + GroupManager.logger.warning("Could not schedule GM Event."); + } /** -- cgit v1.2.3 From 69847af08aa1ebc91c7808310bb7c7c1183b137f Mon Sep 17 00:00:00 2001 From: ElgarL Date: Thu, 22 Dec 2011 17:01:10 +0000 Subject: Decreased ranks of default users so idiots who don't remove them can't get 'hacked' when in offline mode. --- EssentialsGroupManager/src/users.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'EssentialsGroupManager/src') diff --git a/EssentialsGroupManager/src/users.yml b/EssentialsGroupManager/src/users.yml index 28fa79910..72a7b652f 100644 --- a/EssentialsGroupManager/src/users.yml +++ b/EssentialsGroupManager/src/users.yml @@ -3,7 +3,7 @@ users: snowleo: subgroups: [] permissions: [] - group: Admin + group: Builder KHobbits: subgroups: [] permissions: [] @@ -11,5 +11,5 @@ users: ElgarL: subgroups: [] permissions: [] - group: Owner + group: Moderator -- cgit v1.2.3 From 3aba996e97bd5bb90e65ed3166f3666d9122a729 Mon Sep 17 00:00:00 2001 From: ElgarL Date: Thu, 29 Dec 2011 14:52:42 +0000 Subject: Changed the way events are raised to prevent variable corruption. --- EssentialsGroupManager/src/Changelog.txt | 3 ++- .../org/anjocaido/groupmanager/GroupManager.java | 19 ------------------- .../groupmanager/events/GroupManagerEvent.java | 22 +++++++++++++++++++++- .../events/GroupManagerEventHandler.java | 8 +++----- 4 files changed, 26 insertions(+), 26 deletions(-) (limited to 'EssentialsGroupManager/src') diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index dc661f7c3..3929b9d22 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -92,4 +92,5 @@ v 1.8: - Fixed 'manucheckp' returning a null for the searched node when it's a group/subgroup. - manpromote and mandemote now correctly send the notification to the console if the command was issued there. - Expanded GlobalGroups.yml and Groups.yml to include Towny permissions. - - Delayed GroupManager events so Superperms will be fully updated before plugins receive the events. \ No newline at end of file + - Delayed GroupManager events so Superperms will be fully updated before plugins receive the events. + - Changed the way events are raised to prevent variable corruption. \ 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 5ced1fb47..c0e9ef2f8 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java @@ -1837,25 +1837,6 @@ public class GroupManager extends JavaPlugin { return match; } - - /** - * Triggers all GroupManager events for other plugins to see. - * Schedules events for 1 tick later to allow GM to finish populating super perms. - * - * @param event - */ - public static void callEvent(final GroupManagerEvent event) { - - if (Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("GroupManager"), new Runnable() { - - @Override - public void run() { - Bukkit.getServer().getPluginManager().callEvent(event); - } - }) == -1) - GroupManager.logger.warning("Could not schedule GM Event."); - - } /** * @return the config diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEvent.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEvent.java index 856abbc28..0834b3ada 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEvent.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEvent.java @@ -1,6 +1,8 @@ package org.anjocaido.groupmanager.events; +import org.anjocaido.groupmanager.GroupManager; +import org.bukkit.Bukkit; import org.bukkit.event.Event; /** @@ -13,10 +15,28 @@ public abstract class GroupManagerEvent extends Event { * */ private static final long serialVersionUID = 8790362185329926951L; - + protected GroupManagerEvent(String name) { super(name); } + /** + * Triggers all GroupManager events for other plugins to see. + * Schedules events for 1 tick later to allow GM to finish populating super perms. + * + * @param event + */ + public void schedule(final GroupManagerEvent event) { + + if (Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("GroupManager"), new Runnable() { + + @Override + public void run() { + Bukkit.getServer().getPluginManager().callEvent(event); + } + }, 1) == -1) + GroupManager.logger.warning("Could not schedule GM Event."); + } + } \ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEventHandler.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEventHandler.java index 83cac393d..3c077b6c6 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEventHandler.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEventHandler.java @@ -1,11 +1,9 @@ package org.anjocaido.groupmanager.events; -import org.anjocaido.groupmanager.GroupManager; import org.anjocaido.groupmanager.data.Group; import org.anjocaido.groupmanager.data.User; - /** * @author ElgarL * @@ -13,13 +11,13 @@ import org.anjocaido.groupmanager.data.User; public class GroupManagerEventHandler { protected static void callEvent(GMGroupEvent event) { - GroupManager.callEvent(event); + event.schedule(event); } protected static void callEvent(GMUserEvent event) { - GroupManager.callEvent(event); + event.schedule(event); } protected static void callEvent(GMSystemEvent event) { - GroupManager.callEvent(event); + event.schedule(event); } public static void callEvent(Group group, GMGroupEvent.Action action) { -- cgit v1.2.3 From 7726fd0081346b59e4c555476f6c62e1aa38b69f Mon Sep 17 00:00:00 2001 From: ElgarL Date: Tue, 3 Jan 2012 02:04:48 +0000 Subject: Reload GlobalGroups when you perform a world load. Changed GlobalGroups to save/load before local groups in the scheduled data saving/loading --- EssentialsGroupManager/src/Changelog.txt | 4 +++- .../src/org/anjocaido/groupmanager/GroupManager.java | 2 ++ .../groupmanager/dataholder/worlds/WorldsHolder.java | 19 ++++++++++--------- 3 files changed, 15 insertions(+), 10 deletions(-) (limited to 'EssentialsGroupManager/src') diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index 3929b9d22..9b43fddbb 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -93,4 +93,6 @@ v 1.8: - manpromote and mandemote now correctly send the notification to the console if the command was issued there. - Expanded GlobalGroups.yml and Groups.yml to include Towny permissions. - Delayed GroupManager events so Superperms will be fully updated before plugins receive the events. - - Changed the way events are raised to prevent variable corruption. \ No newline at end of file + - Changed the way events are raised to prevent variable corruption. + - Reload GlobalGroups when you perform a world load. + - Changed GlobalGroups to save/load before local groups in the scheduled data saving/loading \ 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 c0e9ef2f8..16e0222d8 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java @@ -1504,7 +1504,9 @@ public class GroupManager extends JavaPlugin { isLoaded = false; // Disable Bukkit Perms update + globalGroups.load(); worldsHolder.loadWorld(auxString); + sender.sendMessage("The request to world '" + auxString + "' was sent."); isLoaded = true; diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java index 25eaf8526..dbdd17f34 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java @@ -176,6 +176,16 @@ public class WorldsHolder { ArrayList alreadyDone = new ArrayList(); Tasks.removeOldFiles(plugin, plugin.getBackupFolder()); + // Write Global Groups + if (GroupManager.getGlobalGroups().haveGroupsChanged()) { + GroupManager.getGlobalGroups().writeGroups(overwrite); + } else { + if (GroupManager.getGlobalGroups().getTimeStampGroups() < GroupManager.getGlobalGroups().getGlobalGroupsFile().lastModified()) { + System.out.print("Newer GlobalGroups file found (Loading changes)!"); + GroupManager.getGlobalGroups().load(); + } + } + for (OverloadedWorldHolder w : worldsData.values()) { if (alreadyDone.contains(w)) { continue; @@ -228,15 +238,6 @@ public class WorldsHolder { } alreadyDone.add(w); } - // Write Global Groups - if (GroupManager.getGlobalGroups().haveGroupsChanged()) { - GroupManager.getGlobalGroups().writeGroups(overwrite); - } else { - if (GroupManager.getGlobalGroups().getTimeStampGroups() < GroupManager.getGlobalGroups().getGlobalGroupsFile().lastModified()) { - System.out.print("Newer GlobalGroups file found (Loading changes)!"); - GroupManager.getGlobalGroups().load(); - } - } } /** -- cgit v1.2.3 From 4c485f31476825993ba8edac00a71080d51d6a2d Mon Sep 17 00:00:00 2001 From: ElgarL Date: Thu, 5 Jan 2012 19:43:30 +0000 Subject: Fix 'manucheckp' to correctly report if a permission is available from GroupManager or Bukkit. --- EssentialsGroupManager/src/Changelog.txt | 3 +- .../org/anjocaido/groupmanager/GroupManager.java | 40 +++++++++++----------- 2 files changed, 22 insertions(+), 21 deletions(-) (limited to 'EssentialsGroupManager/src') diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index 9b43fddbb..8e4996b01 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -95,4 +95,5 @@ v 1.8: - Delayed GroupManager events so Superperms will be fully updated before plugins receive the events. - Changed the way events are raised to prevent variable corruption. - Reload GlobalGroups when you perform a world load. - - Changed GlobalGroups to save/load before local groups in the scheduled data saving/loading \ No newline at end of file + - Changed GlobalGroups to save/load before local groups in the scheduled data saving/loading + - Fix 'manucheckp' to correctly report if a permission is available from GroupManager or Bukkit. \ 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 16e0222d8..4ba2624bf 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java @@ -787,29 +787,29 @@ public class GroupManager extends JavaPlugin { } targetPlayer = this.getServer().getPlayer(auxUser.getName()); // VALIDANDO PERMISSAO - permissionResult = permissionHandler.checkFullUserPermission(auxUser, args[1]); + permissionResult = permissionHandler.checkFullGMPermission(auxUser, args[1], false); + if (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND)) { + //No permissions found in GM so fall through and check Bukkit. sender.sendMessage(ChatColor.RED + "The player doesn't have access to that permission"); - sender.sendMessage(ChatColor.YELLOW + "SuperPerms reports Node: " + targetPlayer.hasPermission(args[1])); - return false; - } - // PARECE OK - // auxString = - // permissionHandler.checkUserOnlyPermission(auxUser, args[1]); - if (permissionResult.owner instanceof User) { - if (permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION)) { - sender.sendMessage(ChatColor.RED + "The user has directly a negation node for that permission."); - } else { - sender.sendMessage(ChatColor.YELLOW + "The user has directly this permission."); - } - sender.sendMessage(ChatColor.YELLOW + "Permission Node: " + permissionResult.accessLevel); - } else if (permissionResult.owner instanceof Group) { - if (permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION)) { - sender.sendMessage(ChatColor.RED + "The user inherits a negation permission from group: " + permissionResult.owner.getName()); - } else { - sender.sendMessage(ChatColor.YELLOW + "The user inherits the permission from group: " + permissionResult.owner.getName()); + + } else { + // This permission was found in groupmanager. + if (permissionResult.owner instanceof User) { + if (permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION)) { + sender.sendMessage(ChatColor.RED + "The user has directly a negation node for that permission."); + } else { + sender.sendMessage(ChatColor.YELLOW + "The user has directly this permission."); + } + sender.sendMessage(ChatColor.YELLOW + "Permission Node: " + permissionResult.accessLevel); + } else if (permissionResult.owner instanceof Group) { + if (permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION)) { + sender.sendMessage(ChatColor.RED + "The user inherits a negation permission from group: " + permissionResult.owner.getName()); + } else { + sender.sendMessage(ChatColor.YELLOW + "The user inherits the permission from group: " + permissionResult.owner.getName()); + } + sender.sendMessage(ChatColor.YELLOW + "Permission Node: " + permissionResult.accessLevel); } - sender.sendMessage(ChatColor.YELLOW + "Permission Node: " + permissionResult.accessLevel); } // superperms -- cgit v1.2.3 From 58057a771d4e8e971d8531e1ad208eb6bbb0df54 Mon Sep 17 00:00:00 2001 From: ElgarL Date: Mon, 9 Jan 2012 02:00:58 +0000 Subject: Changed over to a reflection method for populating superperms as Bukkit lags when you handle permissions one at a time. --- EssentialsGroupManager/src/Changelog.txt | 3 +- EssentialsGroupManager/src/config.yml | 4 +- EssentialsGroupManager/src/globalgroups.yml | 1 + .../groupmanager/Tasks/BukkitPermsUpdateTask.java | 2 +- .../permissions/BukkitPermissions.java | 117 +++++++++++++++------ 5 files changed, 88 insertions(+), 39 deletions(-) (limited to 'EssentialsGroupManager/src') diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index 8e4996b01..6ac58e8ff 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -96,4 +96,5 @@ v 1.8: - Changed the way events are raised to prevent variable corruption. - Reload GlobalGroups when you perform a world load. - Changed GlobalGroups to save/load before local groups in the scheduled data saving/loading - - Fix 'manucheckp' to correctly report if a permission is available from GroupManager or Bukkit. \ No newline at end of file + - Fix 'manucheckp' to correctly report if a permission is available from GroupManager or Bukkit. + - Changed over to a reflection method for populating superperms as Bukkit lags when you handle permissions one at a time. \ No newline at end of file diff --git a/EssentialsGroupManager/src/config.yml b/EssentialsGroupManager/src/config.yml index 2fe5e509c..17ffc5b6e 100644 --- a/EssentialsGroupManager/src/config.yml +++ b/EssentialsGroupManager/src/config.yml @@ -4,9 +4,9 @@ settings: # The user will be able to promote players to the same group or even above. opOverrides: true - # If enabled any plugins bukkit permissions which default to true will be left enabled. + # If enabled any bukkit permissiosn which default to true will be left enabled. # If the player is op any permissions set to Op will follow suit. - bukkit_perms_override: false + bukkit_perms_override: true # Default setting for 'mantoglevalidate' # true will cause GroupManager to attempt name matching by default. diff --git a/EssentialsGroupManager/src/globalgroups.yml b/EssentialsGroupManager/src/globalgroups.yml index fe7b7df99..c9ecc2673 100644 --- a/EssentialsGroupManager/src/globalgroups.yml +++ b/EssentialsGroupManager/src/globalgroups.yml @@ -128,6 +128,7 @@ groups: g:bukkit_default: permissions: - bukkit.broadcast.user + - -bukkit.command.plugins g:bukkit_moderator: permissions: diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/Tasks/BukkitPermsUpdateTask.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/Tasks/BukkitPermsUpdateTask.java index f4b805c35..8788fc83b 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/Tasks/BukkitPermsUpdateTask.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/Tasks/BukkitPermsUpdateTask.java @@ -18,7 +18,7 @@ public class BukkitPermsUpdateTask implements Runnable { public void run() { // Signal loaded and update BukkitPermissions. GroupManager.setLoaded(true); - GroupManager.BukkitPermissions.collectPermissions(); + //GroupManager.BukkitPermissions.collectPermissions(); GroupManager.BukkitPermissions.updateAllPlayers(); GroupManager.logger.info("Bukkit Permissions Updated!"); diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java index 202e27e3a..7c157a2f7 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java @@ -16,6 +16,7 @@ package org.anjocaido.groupmanager.permissions; +import java.lang.reflect.Field; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedList; @@ -23,9 +24,9 @@ import java.util.List; import java.util.Map; import org.anjocaido.groupmanager.GroupManager; -import org.anjocaido.groupmanager.data.User; +//import org.anjocaido.groupmanager.data.User; import org.anjocaido.groupmanager.dataholder.OverloadedWorldHolder; -import org.anjocaido.groupmanager.utils.PermissionCheckResult; +//import org.anjocaido.groupmanager.utils.PermissionCheckResult; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -43,8 +44,7 @@ import org.bukkit.event.server.ServerListener; import org.bukkit.permissions.Permission; import org.bukkit.permissions.PermissionAttachment; import org.bukkit.permissions.PermissionAttachmentInfo; -import org.bukkit.permissions.PermissionDefault; -import org.bukkit.plugin.Plugin; +//import org.bukkit.permissions.PermissionDefault; import org.bukkit.plugin.PluginManager; @@ -52,7 +52,7 @@ import org.bukkit.plugin.PluginManager; * * BukkitPermissions overrides to force GM reponses to Superperms * - * @author ElgarL, based upon PermissionsEX implementation + * @author ElgarL, originally based upon PermissionsEX implementation */ public class BukkitPermissions { @@ -62,13 +62,25 @@ public class BukkitPermissions { protected boolean dumpAllPermissions = true; protected boolean dumpMatchedPermissions = true; public boolean player_join = false; + + private static Field permissions; + + // Setup reflection (Thanks to Codename_B for the reflection source) + static { + try { + permissions = PermissionAttachment.class.getDeclaredField("permissions"); + permissions.setAccessible(true); + } catch (SecurityException e) { + e.printStackTrace(); + } catch (NoSuchFieldException e) { + e.printStackTrace(); + } + } public BukkitPermissions(GroupManager plugin) { this.plugin = plugin; - - this.collectPermissions(); + //this.collectPermissions(); this.registerEvents(); - this.updateAllPlayers(); GroupManager.logger.info("Superperms support enabled."); @@ -93,6 +105,7 @@ public class BukkitPermissions { manager.registerEvent(Event.Type.PLUGIN_DISABLE, serverListener, Event.Priority.Normal, plugin); } + /* public void collectPermissions() { registeredPermissions.clear(); for (Plugin bukkitPlugin : Bukkit.getServer().getPluginManager().getPlugins()) { @@ -100,43 +113,56 @@ public class BukkitPermissions { registeredPermissions.push(permission); } } + */ public void updatePermissions(Player player) { this.updatePermissions(player, null); } + + /** + * Push all permissions which are registered with GM for this player, on this world to Bukkit + * and make it update for the child nodes. + * + * @param player + * @param world + */ public void updatePermissions(Player player, String world) { if (player == null || !GroupManager.isLoaded()) { return; } - if (!this.attachments.containsKey(player)) { - this.attachments.put(player, player.addAttachment(plugin)); + PermissionAttachment attachment; + // Find the players current attachment, or add a new one. + if (this.attachments.containsKey(player)) { + attachment = this.attachments.get(player); + } else { + attachment = player.addAttachment(plugin); + this.attachments.put(player, attachment);; } if (world == null) { world = player.getWorld().getName(); } - // All permissions registered with Bukkit for this player - PermissionAttachment attachment = this.attachments.get(player); - OverloadedWorldHolder worldData = plugin.getWorldsHolder().getWorldData(world); + Boolean value = false; + //User user = worldData.getUser(player.getName()); - User user = worldData.getUser(player.getName()); - + /* // clear permissions for (String permission : attachment.getPermissions().keySet()) attachment.unsetPermission(permission); - + */ + /* * find matching permissions * * and base bukkit perms if we are set to allow bukkit permissions to * override. */ - Boolean value = false; - + + /* for (Permission permission : registeredPermissions) { PermissionCheckResult result = worldData.getPermissionsHandler().checkFullGMPermission(user, permission.getName(), false); @@ -163,35 +189,47 @@ public class BukkitPermissions { if ((value == true) || (result.resultType == PermissionCheckResult.Type.NEGATION)) { attachment.setPermission(permission, value); } - /* - if ((value == true) || (result.resultType == PermissionCheckResult.Type.NOTFOUND)) { - // fetch and set all children of this permission node - Map children = permission.getChildren(); - if (children != null) { - for (String child : children.keySet()) { - if (children.get(child)) - attachment.setPermission(child, value); - } - } - }*/ - } + */ - // Add any missing permissions for this player (non bukkit plugins and child nodes) + // Add all permissions for this player (GM only) + // child nodes will be calculated by Bukkit. List playerPermArray = worldData.getPermissionsHandler().getAllPlayersPermissions(player.getName()); - + Map newPerms = new HashMap(); + for (String permission : playerPermArray) { value = true; if (permission.startsWith("-")) { permission = permission.substring(1); // cut off - value = false; } - + /* if (!attachment.getPermissions().containsKey(permission)) { attachment.setPermission(permission, value); } + */ + newPerms.put(permission, value); + } + //player.recalculatePermissions(); + + /** + * This is put in place until such a time as Bukkit pull 466 is implemented + * https://github.com/Bukkit/Bukkit/pull/466 + */ + try { // Codename_B source + @SuppressWarnings("unchecked") + Map orig = (Map) permissions.get(attachment); + // Clear the map (faster than removing the attachment and recalculating) + orig.clear(); + // Then whack our map into there + orig.putAll(newPerms); + // That's all folks! + attachment.getPermissible().recalculatePermissions(); + } catch (IllegalArgumentException e) { + e.printStackTrace(); + } catch (IllegalAccessException e) { + e.printStackTrace(); } - player.recalculatePermissions(); } /** @@ -245,6 +283,12 @@ public class BukkitPermissions { return null; } + /** + * List all effective permissions for this player. + * + * @param player + * @return + */ public List listPerms(Player player) { List perms = new ArrayList(); @@ -266,6 +310,9 @@ public class BukkitPermissions { return perms; } + /** + * force Bukkit to update every OnlinePlayers permissions. + */ public void updateAllPlayers() { for (Player player : Bukkit.getServer().getOnlinePlayers()) { updatePermissions(player); @@ -326,7 +373,7 @@ public class BukkitPermissions { if (!GroupManager.isLoaded()) return; - collectPermissions(); + //collectPermissions(); updateAllPlayers(); } -- cgit v1.2.3