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
This commit is contained in:
Trent Hensler 2018-03-18 20:35:07 -07:00
parent bd077e8c32
commit f1032e7a2e
3 changed files with 13 additions and 3 deletions

View File

@ -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?

View File

@ -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)

View File

@ -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);
}