mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-03 06:57:39 +01:00
Add IUser#isFreeze & IUser#setFreeze
This commit is contained in:
parent
6ec4c97ddd
commit
e0d6040662
@ -193,17 +193,26 @@ public class EssentialsPlayerListener implements Listener, FakeAccessor {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ess.getSettings().cancelAfkOnMove() && !ess.getSettings().getFreezeAfkPlayers()) {
|
||||
event.getHandlers().unregister(this);
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
|
||||
if (ess.getSettings().isDebug()) {
|
||||
ess.getLogger().log(Level.INFO, "Unregistering move listener");
|
||||
if (user.isFreeze()) {
|
||||
final Location from = event.getFrom();
|
||||
final Location to = event.getTo().clone();
|
||||
to.setX(from.getX());
|
||||
to.setY(from.getY());
|
||||
to.setZ(from.getZ());
|
||||
try {
|
||||
event.setTo(LocationUtil.getSafeDestination(to));
|
||||
} catch (final Exception ex) {
|
||||
event.setTo(to);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
if (!ess.getSettings().cancelAfkOnMove() && !ess.getSettings().getFreezeAfkPlayers()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (user.isAfk() && ess.getSettings().getFreezeAfkPlayers()) {
|
||||
final Location from = event.getFrom();
|
||||
final Location origTo = event.getTo();
|
||||
|
@ -336,4 +336,8 @@ public interface IUser {
|
||||
List<String> getPastUsernames();
|
||||
|
||||
void addPastUsername(String username);
|
||||
|
||||
boolean isFreeze();
|
||||
|
||||
void setFreeze(boolean freeze);
|
||||
}
|
||||
|
@ -90,6 +90,7 @@ public class User extends UserData implements Comparable<User>, IMessageRecipien
|
||||
private String lastHomeConfirmation;
|
||||
private long lastHomeConfirmationTimestamp;
|
||||
private Boolean toggleShout;
|
||||
private boolean freeze = false;
|
||||
private transient final List<String> signCopy = Lists.newArrayList("", "", "", "");
|
||||
private transient long lastVanishTime = System.currentTimeMillis();
|
||||
|
||||
@ -1191,6 +1192,16 @@ public class User extends UserData implements Comparable<User>, IMessageRecipien
|
||||
return signCopy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFreeze() {
|
||||
return freeze;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFreeze(boolean freeze) {
|
||||
this.freeze = freeze;
|
||||
}
|
||||
|
||||
public boolean isBaltopExempt() {
|
||||
if (getBase().isOnline()) {
|
||||
final boolean exempt = isAuthorized("essentials.balancetop.exclude");
|
||||
|
Loading…
Reference in New Issue
Block a user