mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-27 11:37:38 +01:00
Fixes for afk
This commit is contained in:
parent
631583aef0
commit
34987d6e07
@ -89,11 +89,17 @@ public class EssentialsPlayerListener extends PlayerListener
|
||||
}
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
|
||||
if (user.isAfk() && ess.getSettings().getFreezeAfkPlayers()) {
|
||||
event.setCancelled(true);
|
||||
if (user.isAfk() && ess.getSettings().getFreezeAfkPlayers())
|
||||
{
|
||||
final Location from = event.getFrom();
|
||||
final Location to = event.getTo().clone();
|
||||
to.setX(from.getX());
|
||||
to.setY(from.getY());
|
||||
to.setZ(from.getZ());
|
||||
event.setTo(to);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
user.updateActivity();
|
||||
|
||||
if (!ess.getSettings().getNetherPortalsEnabled())
|
||||
@ -478,6 +484,9 @@ public class EssentialsPlayerListener extends PlayerListener
|
||||
}
|
||||
}
|
||||
}
|
||||
user.updateActivity();
|
||||
if (!cmd.equalsIgnoreCase("afk"))
|
||||
{
|
||||
user.updateActivity();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
private transient User teleportRequester;
|
||||
private transient boolean teleportRequestHere;
|
||||
private transient final Teleport teleport;
|
||||
private transient long lastOnlineActivity;
|
||||
private transient long lastOnlineActivity = System.currentTimeMillis();;
|
||||
private transient long lastActivity;
|
||||
private boolean hidden = false;
|
||||
private transient boolean godStateBeforeAfk;
|
||||
@ -437,7 +437,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
}
|
||||
}
|
||||
final long autoafk = ess.getSettings().getAutoAfk();
|
||||
if (autoafk > 0 && lastActivity + autoafk * 1000 < System.currentTimeMillis())
|
||||
if (!isAfk() && autoafk > 0 && lastActivity + autoafk * 1000 < System.currentTimeMillis())
|
||||
{
|
||||
setAfk(true);
|
||||
ess.broadcastMessage(getName(), Util.format("userIsAway", getDisplayName()));
|
||||
|
@ -250,7 +250,7 @@ auto-afk-kick: -1
|
||||
# Other players or monsters can't push him out of afk mode then.
|
||||
# This will also enable temporary god mode for the afk player.
|
||||
# The player has to use the command /afk to leave the afk mode.
|
||||
freeze-afk-player: false
|
||||
freeze-afk-players: false
|
||||
|
||||
############################################################
|
||||
# +------------------------------------------------------+ #
|
||||
|
Loading…
Reference in New Issue
Block a user