mirror of
https://github.com/MassiveCraft/Factions.git
synced 2024-12-11 19:36:46 +01:00
Add ability to bypass auto leave for FPlayers. Implements #659.
Permission is factions.bypassautoleave
This commit is contained in:
parent
14946cd1b2
commit
efb5d335f6
@ -37,6 +37,10 @@ public interface FPlayer extends EconomyParticipator {
|
|||||||
|
|
||||||
public void setFaction(Faction faction);
|
public void setFaction(Faction faction);
|
||||||
|
|
||||||
|
public boolean willAutoLeave();
|
||||||
|
|
||||||
|
public void setAutoLeave(boolean autoLeave);
|
||||||
|
|
||||||
public void setMonitorJoins(boolean monitor);
|
public void setMonitorJoins(boolean monitor);
|
||||||
|
|
||||||
public boolean isMonitoringJoins();
|
public boolean isMonitoringJoins();
|
||||||
|
@ -85,6 +85,9 @@ 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));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL)
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
|
@ -12,6 +12,7 @@ public enum Permission {
|
|||||||
AHOME("ahome"),
|
AHOME("ahome"),
|
||||||
ANNOUNCE("announce"),
|
ANNOUNCE("announce"),
|
||||||
AUTOCLAIM("autoclaim"),
|
AUTOCLAIM("autoclaim"),
|
||||||
|
AUTO_LEAVE_BYPASS("autoleavebypass"),
|
||||||
BYPASS("bypass"),
|
BYPASS("bypass"),
|
||||||
CHAT("chat"),
|
CHAT("chat"),
|
||||||
CHATSPY("chatspy"),
|
CHATSPY("chatspy"),
|
||||||
|
@ -6,6 +6,7 @@ import org.bukkit.scheduler.BukkitRunnable;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.ListIterator;
|
import java.util.ListIterator;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
public class AutoLeaveProcessTask extends BukkitRunnable {
|
public class AutoLeaveProcessTask extends BukkitRunnable {
|
||||||
|
|
||||||
@ -46,6 +47,13 @@ public class AutoLeaveProcessTask extends BukkitRunnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
FPlayer fplayer = iterator.next();
|
FPlayer fplayer = iterator.next();
|
||||||
|
|
||||||
|
// Check if they should be exempt from this.
|
||||||
|
if (!fplayer.willAutoLeave()) {
|
||||||
|
P.p.log(Level.INFO, fplayer.getName() + " was going to be auto-removed but was set not to.");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (fplayer.isOffline() && now - fplayer.getLastLoginTime() > toleranceMillis) {
|
if (fplayer.isOffline() && now - fplayer.getLastLoginTime() > toleranceMillis) {
|
||||||
if (Conf.logFactionLeave || Conf.logFactionKick) {
|
if (Conf.logFactionLeave || Conf.logFactionKick) {
|
||||||
P.p.log("Player " + fplayer.getName() + " was auto-removed due to inactivity.");
|
P.p.log("Player " + fplayer.getName() + " was auto-removed due to inactivity.");
|
||||||
|
@ -57,6 +57,7 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
protected int warmupTask;
|
protected int warmupTask;
|
||||||
protected boolean isAdminBypassing = false;
|
protected boolean isAdminBypassing = false;
|
||||||
protected int kills, deaths;
|
protected int kills, deaths;
|
||||||
|
protected boolean willAutoLeave;
|
||||||
|
|
||||||
protected transient FLocation lastStoodAt = new FLocation(); // Where did this player stand the last time we checked?
|
protected transient FLocation lastStoodAt = new FLocation(); // Where did this player stand the last time we checked?
|
||||||
protected transient boolean mapAutoUpdating;
|
protected transient boolean mapAutoUpdating;
|
||||||
@ -124,6 +125,15 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
this.powerBoost = powerBoost;
|
this.powerBoost = powerBoost;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean willAutoLeave() {
|
||||||
|
return this.willAutoLeave;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAutoLeave(boolean willLeave) {
|
||||||
|
this.willAutoLeave = willLeave;
|
||||||
|
P.p.debug(name + " set autoLeave to " + willLeave);
|
||||||
|
}
|
||||||
|
|
||||||
public Faction getAutoClaimFor() {
|
public Faction getAutoClaimFor() {
|
||||||
return autoClaimFor;
|
return autoClaimFor;
|
||||||
}
|
}
|
||||||
@ -790,7 +800,7 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Was an over claim
|
// Was an over claim
|
||||||
if(currentFaction.isNormal() && currentFaction.hasLandInflation()) {
|
if (currentFaction.isNormal() && currentFaction.hasLandInflation()) {
|
||||||
// Give them money for over claiming.
|
// Give them money for over claiming.
|
||||||
Econ.modifyMoney(payee, Conf.econOverclaimRewardMultiplier, TL.CLAIM_TOOVERCLAIM.toString(), TL.CLAIM_FOROVERCLAIM.toString());
|
Econ.modifyMoney(payee, Conf.econOverclaimRewardMultiplier, TL.CLAIM_TOOVERCLAIM.toString(), TL.CLAIM_FOROVERCLAIM.toString());
|
||||||
}
|
}
|
||||||
|
@ -263,3 +263,5 @@ permissions:
|
|||||||
description: Don't lose power for being offline.
|
description: Don't lose power for being offline.
|
||||||
factions.ahome:
|
factions.ahome:
|
||||||
description: Ability to send players to their faction home.
|
description: Ability to send players to their faction home.
|
||||||
|
factions.autoleavebypass:
|
||||||
|
description: Bypass autoleave.
|
Loading…
Reference in New Issue
Block a user