Skip to content
This repository was archived by the owner on Jul 7, 2023. It is now read-only.

Commit 8834371

Browse files
author
SvenjaReißaus
committed
Minor debug logs
1 parent 97f63e9 commit 8834371

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed
477 Bytes
Binary file not shown.

src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java

+16-1
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ public static boolean canPlayerUseBlock(Player player, Block block, boolean just
178178
return false;
179179
}
180180

181+
SavageFactions.plugin.log("Trying to match a material with access permission");
181182
PermissableAction action = null;
182183
if (SavageFactions.plugin.mc113) {
183184
switch (block.getType()) {
@@ -304,6 +305,8 @@ public static boolean canPlayerUseBlock(Player player, Block block, boolean just
304305
break;
305306
}
306307
}
308+
309+
SavageFactions.plugin.log("Material matched as " + action);
307310
// We only care about some material types.
308311
/// Who was the idiot?
309312
if (otherFaction.hasPlayersOnline()) {
@@ -323,7 +326,7 @@ public static boolean canPlayerUseBlock(Player player, Block block, boolean just
323326
// Get faction pain build access relation to me
324327
boolean pain = !justCheck && otherFaction.getAccess(me, PermissableAction.PAIN_BUILD) == Access.ALLOW;
325328
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())) {
327330
return CheckPlayerAccess(player, me, loc, myFaction, myFaction.getAccess(me, action), action, (!justCheck && myFaction.getAccess(me, PermissableAction.PAIN_BUILD) == Access.ALLOW));
328331
}
329332
return CheckPlayerAccess(player, me, loc, myFaction, otherFaction.getAccess(me, action), action, Conf.territoryPainBuild);
@@ -857,8 +860,11 @@ public void onClose(InventoryCloseEvent e) {
857860
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
858861
public void onPlayerInteract(PlayerInteractEvent event) {
859862
// 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");
860864
if (event.getAction() != Action.PHYSICAL) return;
865+
SavageFactions.plugin.log("Checking if the action aren't left clicks");
861866
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");
862868
if (event.getPlayer().getItemInHand() != null) {
863869
Material handItem = event.getPlayer().getItemInHand().getType();
864870
if (handItem.isEdible()
@@ -872,15 +878,19 @@ public void onPlayerInteract(PlayerInteractEvent event) {
872878
Block block = event.getClickedBlock();
873879
Player player = event.getPlayer();
874880

881+
SavageFactions.plugin.log("Checking for material bypass in config");
875882
// Check if the material is bypassing protection
876883
if (Conf.territoryBypasssProtectedMaterials.contains(block.getType())) return;
877884

878885
if (block == null) return; // clicked in air, apparently
879886

887+
SavageFactions.plugin.log("Checking if I can use the block");
880888
if (canPlayerUseBlock(player, block, false)) return;
881889

890+
SavageFactions.plugin.log("Checking if I can use the item");
882891
if (playerCanUseItemHere(player, block.getLocation(), event.getMaterial(), false)) return;
883892

893+
SavageFactions.plugin.log("Guess we will cancel the event then");
884894
event.setCancelled(true);
885895
}
886896

@@ -1015,11 +1025,15 @@ public int increment() {
10151025
/// <param name="access">The current's faction access permission for the action</param>
10161026
private static boolean CheckPlayerAccess(Player player, FPlayer me, FLocation loc, Faction myFaction, Access access, PermissableAction action, boolean pain) {
10171027
boolean doPain = pain && Conf.handleExploitInteractionSpam;
1028+
SavageFactions.plugin.log("Checking player access, with pain: " + doPain);
10181029
if (access != null && access != Access.UNDEFINED) {
10191030
// TODO: Update this once new access values are added other than just allow / deny.
10201031
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");
10211034
if ((landOwned && myFaction.getOwnerListString(loc).contains(player.getName())) || (me.getRole() == Role.LEADER && me.getFactionId().equals(myFaction.getId()))) return true;
10221035
else if (landOwned && !myFaction.getOwnerListString(loc).contains(player.getName())) {
1036+
SavageFactions.plugin.log("Land is owned and player is not on the owner list");
10231037
me.msg("<b>You can't do that in this territory, it is owned by: " + myFaction.getOwnerListString(loc));
10241038
if (doPain) {
10251039
player.damage(Conf.actionDeniedPainAmount);
@@ -1031,6 +1045,7 @@ else if (landOwned && !myFaction.getOwnerListString(loc).contains(player.getName
10311045
return false;
10321046
}
10331047
}
1048+
SavageFactions.plugin.log("Access is " + access + " denying");
10341049
return false;
10351050
}
10361051
}

0 commit comments

Comments
 (0)