Navigation Menu

Skip to content

Commit

Permalink
Rework permission inheritances to reduce lag.
Browse files Browse the repository at this point in the history
  • Loading branch information
ElgarL committed Mar 18, 2012
1 parent 93c6819 commit d5d96ca
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 81 deletions.
3 changes: 2 additions & 1 deletion src/ChangeLog.txt
Expand Up @@ -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.
- Fix world setting checks when not using permissions.
- Rework permission inheritances to reduce lag.
Expand Up @@ -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);
}

}
Expand Down
90 changes: 22 additions & 68 deletions 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: >
Expand Down Expand Up @@ -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
Expand All @@ -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
# This includes all subnodes for
# towny.claimed.owntown.block.[id].item_use
# towny.claimed.alltown.block.[id].item_use

0 comments on commit d5d96ca

Please sign in to comment.