mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-28 20:17:49 +01:00
Fixes for afk
This commit is contained in:
parent
631583aef0
commit
34987d6e07
@ -89,8 +89,14 @@ public class EssentialsPlayerListener extends PlayerListener
|
|||||||
}
|
}
|
||||||
final User user = ess.getUser(event.getPlayer());
|
final User user = ess.getUser(event.getPlayer());
|
||||||
|
|
||||||
if (user.isAfk() && ess.getSettings().getFreezeAfkPlayers()) {
|
if (user.isAfk() && ess.getSettings().getFreezeAfkPlayers())
|
||||||
event.setCancelled(true);
|
{
|
||||||
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -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 User teleportRequester;
|
||||||
private transient boolean teleportRequestHere;
|
private transient boolean teleportRequestHere;
|
||||||
private transient final Teleport teleport;
|
private transient final Teleport teleport;
|
||||||
private transient long lastOnlineActivity;
|
private transient long lastOnlineActivity = System.currentTimeMillis();;
|
||||||
private transient long lastActivity;
|
private transient long lastActivity;
|
||||||
private boolean hidden = false;
|
private boolean hidden = false;
|
||||||
private transient boolean godStateBeforeAfk;
|
private transient boolean godStateBeforeAfk;
|
||||||
@ -437,7 +437,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
final long autoafk = ess.getSettings().getAutoAfk();
|
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);
|
setAfk(true);
|
||||||
ess.broadcastMessage(getName(), Util.format("userIsAway", getDisplayName()));
|
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.
|
# Other players or monsters can't push him out of afk mode then.
|
||||||
# This will also enable temporary god mode for the afk player.
|
# This will also enable temporary god mode for the afk player.
|
||||||
# The player has to use the command /afk to leave the afk mode.
|
# 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