Skip to content

Commit

Permalink
Last-minute permission fix to use chest-access instead of canBuild
Browse files Browse the repository at this point in the history
  • Loading branch information
VonTum committed Mar 5, 2017
1 parent 037a26d commit 357a0ff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions plugin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: ItemFinder
main: me.lennartVH01.itemfinder.ItemFinder
version: 1.0-alpha
description: Simple container searching plugin
author: lennartVH01
softdepend: [Worldguard, Towny]
Expand Down
7 changes: 6 additions & 1 deletion src/me/lennartVH01/itemfinder/PermissionChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
import com.palmergames.bukkit.towny.object.TownyUniverse;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import com.sk89q.worldguard.protection.ApplicableRegionSet;
import com.sk89q.worldguard.protection.flags.DefaultFlag;
import com.sk89q.worldguard.protection.flags.StateFlag.State;

public class PermissionChecker {

Expand Down Expand Up @@ -43,7 +46,9 @@ public PermissionChecker(ItemFinder plugin){

checkerList.add(new PluginChecker() {
@Override public boolean canAccess(Player p, Location loc) {
return worldGuard.canBuild(p, loc);
ApplicableRegionSet regions = worldGuard.getRegionManager(loc.getWorld()).getApplicableRegions(loc);
State state = regions.queryState(worldGuard.wrapPlayer(p), DefaultFlag.CHEST_ACCESS);
return state != State.DENY;
}
});
}
Expand Down

0 comments on commit 357a0ff

Please sign in to comment.