@@ -178,6 +178,7 @@ public static boolean canPlayerUseBlock(Player player, Block block, boolean just
178
178
return false ;
179
179
}
180
180
181
+ SavageFactions .plugin .log ("Trying to match a material with access permission" );
181
182
PermissableAction action = null ;
182
183
if (SavageFactions .plugin .mc113 ) {
183
184
switch (block .getType ()) {
@@ -304,6 +305,8 @@ public static boolean canPlayerUseBlock(Player player, Block block, boolean just
304
305
break ;
305
306
}
306
307
}
308
+
309
+ SavageFactions .plugin .log ("Material matched as " + action );
307
310
// We only care about some material types.
308
311
/// Who was the idiot?
309
312
if (otherFaction .hasPlayersOnline ()) {
@@ -323,7 +326,7 @@ public static boolean canPlayerUseBlock(Player player, Block block, boolean just
323
326
// Get faction pain build access relation to me
324
327
boolean pain = !justCheck && otherFaction .getAccess (me , PermissableAction .PAIN_BUILD ) == Access .ALLOW ;
325
328
return CheckPlayerAccess (player , me , loc , otherFaction , otherFaction .getAccess (me , action ), action , pain );
326
- } else if (otherFaction .getId ().equals (myFaction .getId ())) {;
329
+ } else if (otherFaction .getId ().equals (myFaction .getId ())) {
327
330
return CheckPlayerAccess (player , me , loc , myFaction , myFaction .getAccess (me , action ), action , (!justCheck && myFaction .getAccess (me , PermissableAction .PAIN_BUILD ) == Access .ALLOW ));
328
331
}
329
332
return CheckPlayerAccess (player , me , loc , myFaction , otherFaction .getAccess (me , action ), action , Conf .territoryPainBuild );
@@ -857,8 +860,11 @@ public void onClose(InventoryCloseEvent e) {
857
860
@ EventHandler (priority = EventPriority .NORMAL , ignoreCancelled = true )
858
861
public void onPlayerInteract (PlayerInteractEvent event ) {
859
862
// only need to check right-clicks and physical as of MC 1.4+; good performance boost
863
+ SavageFactions .plugin .log ("Checking if the action is physical" );
860
864
if (event .getAction () != Action .PHYSICAL ) return ;
865
+ SavageFactions .plugin .log ("Checking if the action aren't left clicks" );
861
866
if (!event .getAction ().equals (Action .LEFT_CLICK_BLOCK ) || !event .getAction ().equals (Action .LEFT_CLICK_AIR )) return ;
867
+ SavageFactions .plugin .log ("Attempting to allow food and potis" );
862
868
if (event .getPlayer ().getItemInHand () != null ) {
863
869
Material handItem = event .getPlayer ().getItemInHand ().getType ();
864
870
if (handItem .isEdible ()
@@ -872,15 +878,19 @@ public void onPlayerInteract(PlayerInteractEvent event) {
872
878
Block block = event .getClickedBlock ();
873
879
Player player = event .getPlayer ();
874
880
881
+ SavageFactions .plugin .log ("Checking for material bypass in config" );
875
882
// Check if the material is bypassing protection
876
883
if (Conf .territoryBypasssProtectedMaterials .contains (block .getType ())) return ;
877
884
878
885
if (block == null ) return ; // clicked in air, apparently
879
886
887
+ SavageFactions .plugin .log ("Checking if I can use the block" );
880
888
if (canPlayerUseBlock (player , block , false )) return ;
881
889
890
+ SavageFactions .plugin .log ("Checking if I can use the item" );
882
891
if (playerCanUseItemHere (player , block .getLocation (), event .getMaterial (), false )) return ;
883
892
893
+ SavageFactions .plugin .log ("Guess we will cancel the event then" );
884
894
event .setCancelled (true );
885
895
}
886
896
@@ -1015,11 +1025,15 @@ public int increment() {
1015
1025
/// <param name="access">The current's faction access permission for the action</param>
1016
1026
private static boolean CheckPlayerAccess (Player player , FPlayer me , FLocation loc , Faction myFaction , Access access , PermissableAction action , boolean pain ) {
1017
1027
boolean doPain = pain && Conf .handleExploitInteractionSpam ;
1028
+ SavageFactions .plugin .log ("Checking player access, with pain: " + doPain );
1018
1029
if (access != null && access != Access .UNDEFINED ) {
1019
1030
// TODO: Update this once new access values are added other than just allow / deny.
1020
1031
boolean landOwned = (myFaction .doesLocationHaveOwnersSet (loc ) && !myFaction .getOwnerList (loc ).isEmpty ());
1032
+ SavageFactions .plugin .log ("Land is owned: " + landOwned );
1033
+ SavageFactions .plugin .log ("Trying to check if the user is in the owner list or is leader of the faction" );
1021
1034
if ((landOwned && myFaction .getOwnerListString (loc ).contains (player .getName ())) || (me .getRole () == Role .LEADER && me .getFactionId ().equals (myFaction .getId ()))) return true ;
1022
1035
else if (landOwned && !myFaction .getOwnerListString (loc ).contains (player .getName ())) {
1036
+ SavageFactions .plugin .log ("Land is owned and player is not on the owner list" );
1023
1037
me .msg ("<b>You can't do that in this territory, it is owned by: " + myFaction .getOwnerListString (loc ));
1024
1038
if (doPain ) {
1025
1039
player .damage (Conf .actionDeniedPainAmount );
@@ -1031,6 +1045,7 @@ else if (landOwned && !myFaction.getOwnerListString(loc).contains(player.getName
1031
1045
return false ;
1032
1046
}
1033
1047
}
1048
+ SavageFactions .plugin .log ("Access is " + access + " denying" );
1034
1049
return false ;
1035
1050
}
1036
1051
}
0 commit comments