This commit is contained in:
Juniormunk 2020-05-21 01:58:05 -04:00
parent 1ee62c2267
commit 8ad2fdf848
2 changed files with 35 additions and 31 deletions

View File

@ -741,7 +741,8 @@ public class FactionsPlayerListener implements Listener {
me.attemptClaim(me.getAutoClaimFor(), newLocation, true); me.attemptClaim(me.getAutoClaimFor(), newLocation, true);
} }
FactionsPlugin.instance.logFactionEvent(me.getAutoClaimFor(), FLogType.CHUNK_CLAIMS, me.getName(), CC.GreenB + "CLAIMED", String.valueOf(1), (new FLocation(player.getLocation())).formatXAndZ(",")); FactionsPlugin.instance.logFactionEvent(me.getAutoClaimFor(), FLogType.CHUNK_CLAIMS, me.getName(), CC.GreenB + "CLAIMED", String.valueOf(1), (new FLocation(player.getLocation())).formatXAndZ(","));
if (Conf.disableFlightOnFactionClaimChange) CmdFly.disableFlight(me); if (Conf.disableFlightOnFactionClaimChange && FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight")) CmdFly.disableFlight(me);
} else if (me.isAutoSafeClaimEnabled()) { } else if (me.isAutoSafeClaimEnabled()) {
if (!Permission.MANAGE_SAFE_ZONE.has(player)) { if (!Permission.MANAGE_SAFE_ZONE.has(player)) {
me.setIsAutoSafeClaimEnabled(false); me.setIsAutoSafeClaimEnabled(false);

View File

@ -972,36 +972,39 @@ public abstract class MemoryFPlayer implements FPlayer {
} }
public void setFFlying(boolean fly, boolean damage) { public void setFFlying(boolean fly, boolean damage) {
Player player = getPlayer(); if(FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight"))
if (player == null) return; {
Player player = getPlayer();
player.setAllowFlight(fly); if (player == null) return;
player.setFlying(fly);
player.setAllowFlight(fly);
if (!damage) { player.setFlying(fly);
msg(TL.COMMAND_FLY_CHANGE, fly ? "enabled" : "disabled");
if (!fly) { if (!damage) {
sendMessage(TL.COMMAND_FLY_COOLDOWN.toString().replace("{amount}", FactionsPlugin.getInstance().getConfig().getInt("fly-falldamage-cooldown", 3) + "")); msg(TL.COMMAND_FLY_CHANGE, fly ? "enabled" : "disabled");
} if (!fly) {
} else { sendMessage(TL.COMMAND_FLY_COOLDOWN.toString().replace("{amount}", FactionsPlugin.getInstance().getConfig().getInt("fly-falldamage-cooldown", 3) + ""));
msg(TL.COMMAND_FLY_DAMAGE); }
} } else {
msg(TL.COMMAND_FLY_DAMAGE);
// If leaving fly mode, don't let them take fall damage for x seconds. }
if (!fly) {
int cooldown = FactionsPlugin.getInstance().getConfig().getInt("fly-falldamage-cooldown", 3); // If leaving fly mode, don't let them take fall damage for x seconds.
CmdFly.flyMap.remove(player.getName()); if (!fly) {
int cooldown = FactionsPlugin.getInstance().getConfig().getInt("fly-falldamage-cooldown", 3);
// If the value is 0 or lower, make them take fall damage. CmdFly.flyMap.remove(player.getName());
// 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 the value is 0 or lower, make them take fall damage.
if (cooldown > 0) { // Otherwise, start a timer and have this cancel after a few seconds.
setTakeFallDamage(false); // Short task so we're just doing it in method. Not clean but eh.
Bukkit.getScheduler().runTaskLater(FactionsPlugin.getInstance(), () -> setTakeFallDamage(true), 20L * cooldown); if (cooldown > 0) {
} setTakeFallDamage(false);
} Bukkit.getScheduler().runTaskLater(FactionsPlugin.getInstance(), () -> setTakeFallDamage(true), 20L * cooldown);
}
isFlying = fly; }
isFlying = fly;
}
} }
public boolean isInFactionsChest() { public boolean isInFactionsChest() {