From f1032e7a2e2fcf29c5f9b4bdf408be6a98529a33 Mon Sep 17 00:00:00 2001 From: Trent Hensler Date: Sun, 18 Mar 2018 20:35:07 -0700 Subject: [PATCH] Make sure players take fall damage. Not sure why we need to set this on join when it defaults to true. Debugged and didn't find anything modifying it otherwise. /shrug --- .../factions/listeners/FactionsBlockListener.java | 8 +++++++- .../factions/listeners/FactionsPlayerListener.java | 1 + .../factions/zcore/persist/MemoryFPlayer.java | 7 +++++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java index d939371e..2c54954b 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java @@ -6,6 +6,7 @@ import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.zcore.fperms.Access; import com.massivecraft.factions.zcore.fperms.PermissableAction; +import com.massivecraft.factions.zcore.util.TL; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; @@ -255,7 +256,12 @@ public class FactionsBlockListener implements Listener { Access access = otherFaction.getAccess(me, PermissableAction.fromString(action)); if (access != null && access != Access.UNDEFINED) { // TODO: Update this once new access values are added other than just allow / deny. - return access == Access.ALLOW; + if (access == Access.DENY) { + me.msg(TL.GENERIC_NOPERMISSION, action); + return false; + } + + return true; // has to be allow } // cancel building/destroying in other territory? diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java index 69a15792..0c0a757d 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java @@ -102,6 +102,7 @@ public class FactionsPlayerListener implements Listener { // If they have the permission, don't let them autoleave. Bad inverted setter :\ me.setAutoLeave(!player.hasPermission(Permission.AUTO_LEAVE_BYPASS.node)); + me.setTakeFallDamage(true); } @EventHandler(priority = EventPriority.NORMAL) diff --git a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java index 7be3dfc5..8e2c8abf 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java @@ -924,16 +924,19 @@ public abstract class MemoryFPlayer implements FPlayer { // If leaving fly mode, don't let them take fall damage for x seconds. if (!fly) { int cooldown = P.p.getConfig().getInt("fly-falldamage-cooldown", 3); + System.out.println("Setting falldamage cooldown."); // If the value is 0 or lower, make them take fall damage. // Otherwise, start a timer and have this cancel after a few seconds. // Short task so we're just doing it in method. Not clean but eh. if (cooldown > 0) { - this.shouldTakeFallDamage = false; + setTakeFallDamage(false); + System.out.println("Fall damage: false"); Bukkit.getScheduler().runTaskLater(P.p, new Runnable() { @Override public void run() { - shouldTakeFallDamage = true; + setTakeFallDamage(true); + System.out.println("Fall damage: true"); } }, 20L * cooldown); }