Skip to content

Commit 5a78df5

Browse files
v-bojovicJRoy
andauthored
Add option to allow fishing when afk (#6465)
Fixes #6443 Fixes #6323 - Prevent AFK timer reset when fishing rod bobber is idle - Fix incorrect teleportOfflineUnknown message showing sender instead of target --------- Co-authored-by: Josh Roy <10731363+JRoy@users.noreply.github.com>
1 parent 716a61e commit 5a78df5

File tree

5 files changed

+18
-4
lines changed

5 files changed

+18
-4
lines changed

Essentials/src/main/java/com/earth2me/essentials/EssentialsPlayerListener.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,6 +1174,10 @@ public void onInventoryCloseEvent(final InventoryCloseEvent event) {
11741174

11751175
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
11761176
public void onPlayerFishEvent(final PlayerFishEvent event) {
1177+
if (!ess.getSettings().cancelAfkOnFish()) {
1178+
return;
1179+
}
1180+
11771181
final User user = ess.getUser(event.getPlayer());
11781182
user.updateActivityOnInteract(true);
11791183
}

Essentials/src/main/java/com/earth2me/essentials/ISettings.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,8 @@ public interface ISettings extends IConf {
221221

222222
boolean cancelAfkOnChat();
223223

224+
boolean cancelAfkOnFish();
225+
224226
boolean sleepIgnoresAfkPlayers();
225227

226228
boolean sleepIgnoresVanishedPlayers();

Essentials/src/main/java/com/earth2me/essentials/Settings.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,6 +1320,11 @@ public boolean cancelAfkOnChat() {
13201320
return config.getBoolean("cancel-afk-on-chat", true);
13211321
}
13221322

1323+
@Override
1324+
public boolean cancelAfkOnFish() {
1325+
return config.getBoolean("cancel-afk-on-fish", true);
1326+
}
1327+
13231328
@Override
13241329
public boolean sleepIgnoresAfkPlayers() {
13251330
return sleepIgnoresAfkPlayers;

Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpoffline.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public void run(final Server server, final User user, final String label, final
2121
final Location logout = target.getLogoutLocation();
2222

2323
if (logout == null) {
24-
user.sendTl("teleportOfflineUnknown", user.getDisplayName());
24+
user.sendTl("teleportOfflineUnknown", target.getDisplayName());
2525
throw new NoChargeException();
2626
}
2727

Essentials/src/main/resources/config.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ auto-afk: 300
491491
auto-afk-timeout: -1
492492

493493
# A list of commands to be executed instead of kicking the player once the
494-
# threshold defined above in 'afk-auto-timeout' is reached. If this list is empty
494+
# threshold defined above in 'afk-auto-timeout' is reached. If this list is empty
495495
# and 'afk-auto-timeout' is not set to -1, Essentials will default to
496496
# kicking the player once they reach the timeout threshold.
497497
#
@@ -527,6 +527,9 @@ cancel-afk-on-move: true
527527
# Should Essentials automatically remove AFK status when a player sends a chat message?
528528
cancel-afk-on-chat: true
529529

530+
# Should Essentials automatically remove AFK status when a player uses a fishing rod?
531+
cancel-afk-on-fish: true
532+
530533
# Should AFK players be ignored when other players are trying to sleep?
531534
# When this setting is false, players won't be able to skip the night if some players are AFK.
532535
# Players with the permission 'essentials.sleepingignored' will always be ignored.
@@ -897,8 +900,8 @@ baltop-requirements:
897900
minimum-balance: 0
898901
minimum-playtime: 0
899902

900-
# Limit the number of cached balance top entries.
901-
# Recommended for servers with a large number of players, as it reduces memory usage.
903+
# Limit the number of cached balance top entries.
904+
# Recommended for servers with a large number of players, as it reduces memory usage.
902905
# Set to -1 to disable the limit.
903906
baltop-entry-limit: -1
904907

0 commit comments

Comments
 (0)