@@ -178,10 +178,9 @@ public static boolean canPlayerUseBlock(Player player, Block block, boolean just
178
178
if (SavageFactions .plugin .getConfig ().getBoolean ("hcf.raidable" , false ) && otherFaction .getLandRounded () > otherFaction .getPowerRounded ())
179
179
return true ;
180
180
181
+ if (otherFaction .getId ().equals (myFaction .getId ()) && me .getRole () == Role .LEADER ) return true ;
181
182
PermissableAction action = GetPermissionFromUsableBlock (block );
182
183
if (action == null ) return false ;
183
-
184
-
185
184
// We only care about some material types.
186
185
/// Who was the idiot?
187
186
if (otherFaction .hasPlayersOnline ()) {
@@ -734,34 +733,28 @@ public void onClose(InventoryCloseEvent e) {
734
733
public void onPlayerInteract (PlayerInteractEvent event ) {
735
734
// only need to check right-clicks and physical as of MC 1.4+; good performance boost
736
735
if (event .getAction ().equals (Action .LEFT_CLICK_BLOCK ) || event .getAction ().equals (Action .LEFT_CLICK_AIR )) return ;
737
- if (event .getPlayer ().getItemInHand () != null ) {
738
- Material handItem = event .getPlayer ().getItemInHand ().getType ();
739
- if (handItem .isEdible ()
740
- || handItem .equals (Material .POTION )
741
- || handItem .equals (Material .LINGERING_POTION )
742
- || handItem .equals (Material .SPLASH_POTION )) {
743
- return ;
744
- }
745
- }
746
-
747
736
Block block = event .getClickedBlock ();
748
737
Player player = event .getPlayer ();
749
-
750
738
// Check if the material is bypassing protection
751
739
if (Conf .territoryBypasssProtectedMaterials .contains (block .getType ())) return ;
752
-
753
740
if (block == null ) return ; // clicked in air, apparently
754
- SavageFactions .plugin .log ("Checking for material permission" );
755
741
if (GetPermissionFromUsableBlock (event .getClickedBlock ().getType ()) != null ) {
756
- SavageFactions .plugin .log ("Checking for use block permission" );
757
742
if (!canPlayerUseBlock (player , block , false )) {
758
743
event .setCancelled (true );
759
744
event .setUseInteractedBlock (Event .Result .DENY );
760
745
return ;
761
746
}
762
747
}
748
+ if (event .getPlayer ().getItemInHand () != null ) {
749
+ Material handItem = event .getPlayer ().getItemInHand ().getType ();
750
+ if (handItem .isEdible ()
751
+ || handItem .equals (Material .POTION )
752
+ || handItem .equals (Material .LINGERING_POTION )
753
+ || handItem .equals (Material .SPLASH_POTION )) {
754
+ return ;
755
+ }
756
+ }
763
757
if (event .getMaterial ().isSolid ()) return ;
764
- SavageFactions .plugin .log ("Checking if you can use that item" );
765
758
if (!playerCanUseItemHere (player , block .getLocation (), event .getMaterial (), false )) {
766
759
event .setCancelled (true );
767
760
event .setUseInteractedBlock (Event .Result .DENY );
@@ -995,7 +988,6 @@ private static PermissableAction GetPermissionFromUsableBlock(Material material)
995
988
case HOPPER :
996
989
case BEACON :
997
990
case JUKEBOX :
998
-
999
991
case ANVIL :
1000
992
case CHIPPED_ANVIL :
1001
993
case DAMAGED_ANVIL :
@@ -1004,6 +996,7 @@ private static PermissableAction GetPermissionFromUsableBlock(Material material)
1004
996
// Check for doors that might have diff material name in old version.
1005
997
if (material .name ().contains ("DOOR" ))
1006
998
return PermissableAction .DOOR ;
999
+ if (material .name ().toUpperCase ().contains ("BUTTON" ) || material .name ().toUpperCase ().contains ("PRESSURE" )) return PermissableAction .BUTTON ;
1007
1000
return null ;
1008
1001
}
1009
1002
} else {
@@ -1039,7 +1032,7 @@ private static PermissableAction GetPermissionFromUsableBlock(Material material)
1039
1032
// Check for doors that might have diff material name in old version.
1040
1033
if (material .name ().contains ("DOOR" ))
1041
1034
return PermissableAction .DOOR ;
1042
- if (material .toString ().toUpperCase ().contains ("BUTTON" ))
1035
+ if (material .toString ().toUpperCase ().contains ("BUTTON" ) || material . toString (). toUpperCase (). contains ( "PRESSURE" ) )
1043
1036
return PermissableAction .BUTTON ;
1044
1037
return null ;
1045
1038
}
0 commit comments