mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-07-25 15:03:48 +00:00
Separate option to cancel afk on chat from interact (#3863)
This commit is contained in:
parent
b84aaa1dab
commit
a8daa2160f
6 changed files with 21 additions and 1 deletions
|
@ -162,7 +162,7 @@ public class EssentialsPlayerListener implements Listener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
user.updateActivityOnInteract(true);
|
user.updateActivityOnChat(true);
|
||||||
user.setDisplayNick();
|
user.setDisplayNick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -199,6 +199,8 @@ public interface ISettings extends IConf {
|
||||||
|
|
||||||
boolean cancelAfkOnInteract();
|
boolean cancelAfkOnInteract();
|
||||||
|
|
||||||
|
boolean cancelAfkOnChat();
|
||||||
|
|
||||||
boolean sleepIgnoresAfkPlayers();
|
boolean sleepIgnoresAfkPlayers();
|
||||||
|
|
||||||
boolean isAfkListName();
|
boolean isAfkListName();
|
||||||
|
|
|
@ -984,6 +984,11 @@ public class Settings implements net.ess3.api.ISettings {
|
||||||
return config.getBoolean("cancel-afk-on-interact", true);
|
return config.getBoolean("cancel-afk-on-interact", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean cancelAfkOnChat() {
|
||||||
|
return config.getBoolean("cancel-afk-on-chat", true);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean sleepIgnoresAfkPlayers() {
|
public boolean sleepIgnoresAfkPlayers() {
|
||||||
return sleepIgnoresAfkPlayers;
|
return sleepIgnoresAfkPlayers;
|
||||||
|
|
|
@ -668,6 +668,15 @@ public class User extends UserData implements Comparable<User>, IMessageRecipien
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateActivityOnChat(final boolean broadcast) {
|
||||||
|
if (ess.getSettings().cancelAfkOnChat()) {
|
||||||
|
//Chat happens async, make sure we have a sync context
|
||||||
|
ess.scheduleSyncDelayedTask(() -> {
|
||||||
|
updateActivity(broadcast, AfkStatusChangeEvent.Cause.CHAT);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void checkActivity() {
|
public void checkActivity() {
|
||||||
// Graceful time before the first afk check call.
|
// Graceful time before the first afk check call.
|
||||||
if (System.currentTimeMillis() - lastActivity <= 10000) {
|
if (System.currentTimeMillis() - lastActivity <= 10000) {
|
||||||
|
|
|
@ -42,6 +42,7 @@ public class AfkStatusChangeEvent extends StatusChangeEvent {
|
||||||
INTERACT,
|
INTERACT,
|
||||||
COMMAND,
|
COMMAND,
|
||||||
JOIN,
|
JOIN,
|
||||||
|
CHAT,
|
||||||
QUIT,
|
QUIT,
|
||||||
UNKNOWN
|
UNKNOWN
|
||||||
}
|
}
|
||||||
|
|
|
@ -450,6 +450,9 @@ cancel-afk-on-interact: true
|
||||||
# Disable this to reduce server lag.
|
# Disable this to reduce server lag.
|
||||||
cancel-afk-on-move: true
|
cancel-afk-on-move: true
|
||||||
|
|
||||||
|
# Should we automatically remove afk status when a player sends a chat message?
|
||||||
|
cancel-afk-on-chat: true
|
||||||
|
|
||||||
# Should AFK players be ignored when other players are trying to sleep?
|
# Should AFK players be ignored when other players are trying to sleep?
|
||||||
# When this setting is false, players won't be able to skip the night if some players are AFK.
|
# When this setting is false, players won't be able to skip the night if some players are AFK.
|
||||||
# Users with the permission node essentials.sleepingignored will always be ignored.
|
# Users with the permission node essentials.sleepingignored will always be ignored.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue