fix for left-clicking wooden doors not being prevented; as a minor side-effect, left-clicking on other blocks in the territoryProtectedMaterials list pops up the "you can't use that" message

Releasing 1.1.5 for this quick fix
This commit is contained in:
Brettflan 2011-04-04 08:34:32 -05:00
parent 1f77dbedde
commit 204f67c43b
3 changed files with 12 additions and 6 deletions

View File

@ -1,5 +1,5 @@
name: Factions name: Factions
version: 1.1.4 version: 1.1.5
main: com.bukkit.mcteam.factions.Factions main: com.bukkit.mcteam.factions.Factions
commands: commands:
f: f:

BIN
releases/factions 1.1.5.zip Normal file

Binary file not shown.

View File

@ -138,17 +138,23 @@ public class FactionsPlayerListener extends PlayerListener{
if (event.isCancelled()) { if (event.isCancelled()) {
return; return;
} }
if (event.getAction() != Action.RIGHT_CLICK_BLOCK) {
return; // only interested on right-clicks on blocks, whether player is using an item or interacting with a block
}
Block block = event.getClickedBlock(); Block block = event.getClickedBlock();
Player player = event.getPlayer(); Player player = event.getPlayer();
if ( ! canPlayerUseRightclickBlock(player, block)) { if (block == null) {
return; // clicked in air, apparently
}
if ( ! canPlayerUseBlock(player, block)) {
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
if (event.getAction() != Action.RIGHT_CLICK_BLOCK) {
return; // only interested on right-clicks for below
}
// this check below might no longer be needed... bucket detection is now necessarily handled separately in onPlayerBucketXXX() events, and // this check below might no longer be needed... bucket detection is now necessarily handled separately in onPlayerBucketXXX() events, and
// Flint&Steel is somehow detected before this in onBlockPlace(), and that's currently it for the default territoryDenyUseageMaterials // Flint&Steel is somehow detected before this in onBlockPlace(), and that's currently it for the default territoryDenyUseageMaterials
if ( ! this.playerCanUseItemHere(player, block, event.getMaterial())) { if ( ! this.playerCanUseItemHere(player, block, event.getMaterial())) {
@ -194,7 +200,7 @@ public class FactionsPlayerListener extends PlayerListener{
return true; return true;
} }
public boolean canPlayerUseRightclickBlock(Player player, Block block) { public boolean canPlayerUseBlock(Player player, Block block) {
if (Factions.hasPermAdminBypass(player)) { if (Factions.hasPermAdminBypass(player)) {
return true; return true;