From d5d96ca29764cebe2560cbc7d6d070f2eeffa92d Mon Sep 17 00:00:00 2001 From: ElgarL Date: Sun, 18 Mar 2012 14:38:29 +0000 Subject: [PATCH] Rework permission inheritances to reduce lag. --- src/ChangeLog.txt | 3 +- .../permissions/TownyPermissionSource.java | 24 ++--- src/plugin.yml | 90 +++++-------------- 3 files changed, 36 insertions(+), 81 deletions(-) diff --git a/src/ChangeLog.txt b/src/ChangeLog.txt index 53f47fa94..e54eb23a1 100644 --- a/src/ChangeLog.txt +++ b/src/ChangeLog.txt @@ -1220,4 +1220,5 @@ v0.79.1.2: v0.79.1.3: - Reduced the total block count from 4096 to 512 (temporarily). - Correctly update data files when a town/nation is renamed. - - Fix world setting checks when not using permissions. \ No newline at end of file + - Fix world setting checks when not using permissions. + - Rework permission inheritances to reduce lag. \ No newline at end of file diff --git a/src/com/palmergames/bukkit/towny/permissions/TownyPermissionSource.java b/src/com/palmergames/bukkit/towny/permissions/TownyPermissionSource.java index 878900e80..e1e31fccf 100644 --- a/src/com/palmergames/bukkit/towny/permissions/TownyPermissionSource.java +++ b/src/com/palmergames/bukkit/towny/permissions/TownyPermissionSource.java @@ -119,57 +119,57 @@ public void run() { */ perm = new Permission(PermissionNodes.TOWNY_WILD_BLOCK_BUILD.getNode(blockId), "User can build a specific block in the wild.", PermissionDefault.FALSE, null); perm.addParent(PermissionNodes.TOWNY_WILD_BUILD.getNode(), true); - perm.addParent(PermissionNodes.TOWNY_WILD_BLOCK_BUILD.getNode(), true); + //perm.addParent(PermissionNodes.TOWNY_WILD_BLOCK_BUILD.getNode(), true); perm = new Permission(PermissionNodes.TOWNY_WILD_BLOCK_DESTROY.getNode(blockId + ""), "User can destroy a specific block in the wild.", PermissionDefault.FALSE, null); perm.addParent(PermissionNodes.TOWNY_WILD_DESTROY.getNode(), true); - perm.addParent(PermissionNodes.TOWNY_WILD_BLOCK_DESTROY.getNode(), true); + //perm.addParent(PermissionNodes.TOWNY_WILD_BLOCK_DESTROY.getNode(), true); perm = new Permission(PermissionNodes.TOWNY_WILD_BLOCK_SWITCH.getNode(blockId + ""), "User can switch a specific block in the wild.", PermissionDefault.FALSE, null); perm.addParent(PermissionNodes.TOWNY_WILD_SWITCH.getNode(), true); - perm.addParent(PermissionNodes.TOWNY_WILD_BLOCK_SWITCH.getNode(), true); + //perm.addParent(PermissionNodes.TOWNY_WILD_BLOCK_SWITCH.getNode(), true); perm = new Permission(PermissionNodes.TOWNY_WILD_BLOCK_ITEM_USE.getNode(blockId + ""), "User can item_use a specific block in the wild.", PermissionDefault.FALSE, null); perm.addParent(PermissionNodes.TOWNY_WILD_ITEM_USE.getNode(), true); - perm.addParent(PermissionNodes.TOWNY_WILD_BLOCK_ITEM_USE.getNode(), true); + //perm.addParent(PermissionNodes.TOWNY_WILD_BLOCK_ITEM_USE.getNode(), true); /** * Register all towny.claimed.alltown.block.[id].* nodes */ perm = new Permission(PermissionNodes.TOWNY_CLAIMED_ALL_BLOCK_BUILD.getNode(blockId + ""), "User can build in all town zones.", PermissionDefault.FALSE, null); perm.addParent(PermissionNodes.TOWNY_CLAIMED_BUILD.getNode(), true); - perm.addParent(PermissionNodes.TOWNY_CLAIMED_ALL_BLOCK_BUILD.getNode(), true); + //perm.addParent(PermissionNodes.TOWNY_CLAIMED_ALL_BLOCK_BUILD.getNode(), true); perm = new Permission(PermissionNodes.TOWNY_CLAIMED_ALL_BLOCK_DESTROY.getNode(blockId + ""), "User can destroy in all town zones.", PermissionDefault.FALSE, null); perm.addParent(PermissionNodes.TOWNY_CLAIMED_DESTROY.getNode(), true); - perm.addParent(PermissionNodes.TOWNY_CLAIMED_ALL_BLOCK_DESTROY.getNode(), true); + //perm.addParent(PermissionNodes.TOWNY_CLAIMED_ALL_BLOCK_DESTROY.getNode(), true); perm = new Permission(PermissionNodes.TOWNY_CLAIMED_ALL_BLOCK_SWITCH.getNode(blockId + ""), "User can switch in all town zones.", PermissionDefault.FALSE, null); perm.addParent(PermissionNodes.TOWNY_CLAIMED_SWITCH.getNode(), true); - perm.addParent(PermissionNodes.TOWNY_CLAIMED_ALL_BLOCK_SWITCH.getNode(), true); + //perm.addParent(PermissionNodes.TOWNY_CLAIMED_ALL_BLOCK_SWITCH.getNode(), true); perm = new Permission(PermissionNodes.TOWNY_CLAIMED_ALL_BLOCK_ITEM_USE.getNode(blockId + ""), "User can item_use in all town zones.", PermissionDefault.FALSE, null); perm.addParent(PermissionNodes.TOWNY_CLAIMED_ITEM_USE.getNode(), true); - perm.addParent(PermissionNodes.TOWNY_CLAIMED_ALL_BLOCK_ITEM_USE.getNode(), true); + //perm.addParent(PermissionNodes.TOWNY_CLAIMED_ALL_BLOCK_ITEM_USE.getNode(), true); /** * Register all towny.claimed.owntown.block.[id].* nodes */ perm = new Permission(PermissionNodes.TOWNY_CLAIMED_OWNTOWN_BLOCK_BUILD.getNode(blockId + ""), "User can build in own town zones.", PermissionDefault.FALSE, null); perm.addParent(PermissionNodes.TOWNY_CLAIMED_BUILD.getNode(), true); - perm.addParent(PermissionNodes.TOWNY_CLAIMED_OWNTOWN_BLOCK_BUILD.getNode(), true); + //perm.addParent(PermissionNodes.TOWNY_CLAIMED_OWNTOWN_BLOCK_BUILD.getNode(), true); perm = new Permission(PermissionNodes.TOWNY_CLAIMED_OWNTOWN_BLOCK_DESTROY.getNode(blockId + ""), "User can destroy in own town zones.", PermissionDefault.FALSE, null); perm.addParent(PermissionNodes.TOWNY_CLAIMED_DESTROY.getNode(), true); - perm.addParent(PermissionNodes.TOWNY_CLAIMED_OWNTOWN_BLOCK_DESTROY.getNode(), true); + //perm.addParent(PermissionNodes.TOWNY_CLAIMED_OWNTOWN_BLOCK_DESTROY.getNode(), true); perm = new Permission(PermissionNodes.TOWNY_CLAIMED_OWNTOWN_BLOCK_SWITCH.getNode(blockId + ""), "User can switch in own town zones.", PermissionDefault.FALSE, null); perm.addParent(PermissionNodes.TOWNY_CLAIMED_SWITCH.getNode(), true); - perm.addParent(PermissionNodes.TOWNY_CLAIMED_OWNTOWN_BLOCK_SWITCH.getNode(), true); + //perm.addParent(PermissionNodes.TOWNY_CLAIMED_OWNTOWN_BLOCK_SWITCH.getNode(), true); perm = new Permission(PermissionNodes.TOWNY_CLAIMED_OWNTOWN_BLOCK_ITEM_USE.getNode(blockId + ""), "User can item_use in own town zones.", PermissionDefault.FALSE, null); perm.addParent(PermissionNodes.TOWNY_CLAIMED_ITEM_USE.getNode(), true); - perm.addParent(PermissionNodes.TOWNY_CLAIMED_OWNTOWN_BLOCK_ITEM_USE.getNode(), true); + //perm.addParent(PermissionNodes.TOWNY_CLAIMED_OWNTOWN_BLOCK_ITEM_USE.getNode(), true); } } diff --git a/src/plugin.yml b/src/plugin.yml index 12647094e..80083be27 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ name: Towny main: com.palmergames.bukkit.towny.Towny -version: 0.79.1.2 +version: 0.79.1.3 author: Shade, Modified by FuzzeWuzze. Forked by ElgarL website: http://code.google.com/a/eclipselabs.org/p/towny/ description: > @@ -166,38 +166,24 @@ permissions: towny.wild.build: description: User can build in wild. default: false + # This includes all subnodes for + # towny.wild.block.[id].build towny.wild.destroy: description: User can destroy in wild. default: false + # This includes all subnodes for + # towny.wild.block.[id].destroy towny.wild.switch: description: User can switch in wild. default: false + # This includes all subnodes for + # towny.wild.block.[id].switch towny.wild.item_use: description: User can use use items in wild. default: false - - towny.wild.block.*: - description: User is able to edit specified/all block types in the wild. - default: false - children: - towny.wild.Block.*.build: true - towny.wild.block.*.destroy: true - towny.wild.block.*.switch: true - towny.wild.block.*.item_use: true - - towny.wild.block.*.build: - description: User can build specified/all block types in the wild. - default: false - towny.wild.block.*.destroy: - description: User can break specified/all block types in the wild. - default: false - towny.wild.block.*.switch: - description: User can switch specified/all block types in the wild. - default: false - towny.wild.block.*.item_use: - description: User can use specified/all block types in the wild. - default: false - + # This includes all subnodes for + # towny.wild.block.[id].item_use + towny.claimed.*: description: User can build/destroy/switch/item_use in all towns. default: false @@ -210,56 +196,24 @@ permissions: towny.claimed.build: description: User can build in all towns. default: false + # This includes all subnodes for + # towny.claimed.owntown.block.[id].build + # towny.claimed.alltown.block.[id].build towny.claimed.destroy: description: User can destroy in all towns. default: false + # This includes all subnodes for + # towny.claimed.owntown.block.[id].destroy + # towny.claimed.alltown.block.[id].destroy towny.claimed.switch: description: User can switch in all towns. default: false + # This includes all subnodes for + # towny.claimed.owntown.block.[id].switch + # towny.claimed.alltown.block.[id].switch towny.claimed.item_use: description: User can use use items in all towns. default: false - - towny.claimed.alltown.block.*: - description: User is able to edit specified/all block types in all towns. - default: false - children: - towny.claimed.alltown.Block.*.build: true - towny.claimed.alltown.block.*.destroy: true - towny.claimed.alltown.block.*.switch: true - towny.claimed.alltown.block.*.item_use: true - - towny.claimed.alltown.block.*.build: - description: User can build specified/all block types in all towns. - default: false - towny.claimed.alltown.block.*.destroy: - description: User can break specified/all block types in all towns. - default: false - towny.claimed.alltown.block.*.switch: - description: User can switch specified/all block types in all towns. - default: false - towny.claimed.alltown.block.*.item_use: - description: User can use specified/all block types in all towns. - default: false - - towny.claimed.owntown.block.*: - description: User is able to edit specified/all block types in their own town. - default: false - children: - towny.claimed.owntown.Block.*.build: true - towny.claimed.owntown.block.*.destroy: true - towny.claimed.owntown.block.*.switch: true - towny.claimed.owntown.block.*.item_use: true - - towny.claimed.owntown.block.*.build: - description: User can build specified/all block types in their own town. - default: false - towny.claimed.owntown.block.*.destroy: - description: User can break specified/all block types in their own town. - default: false - towny.claimed.owntown.block.*.switch: - description: User can switch specified/all block types in their own town. - default: false - towny.claimed.owntown.block.*.item_use: - description: User can use specified/all block types in their own town. - default: false \ No newline at end of file + # This includes all subnodes for + # towny.claimed.owntown.block.[id].item_use + # towny.claimed.alltown.block.[id].item_use \ No newline at end of file