Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions src/main/java/de/rettichlp/ucutils/common/Storage.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,6 @@ public class Storage {
@Setter
private int activeServices = 0;

@Getter
@Setter
private boolean afk = false;

@Getter
@Setter
private boolean carLocked = true;
Expand Down Expand Up @@ -166,8 +162,6 @@ public void print() {
LOGGER.info("wantedEntries[{}]: {}", this.wantedEntries.size(), this.wantedEntries);
// activeServices
LOGGER.info("activeServices: {}", this.activeServices);
// afk
LOGGER.info("afk: {}", this.afk);
// carLocked
LOGGER.info("carLocked: {}", this.carLocked);
// currentJob
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import static de.rettichlp.ucutils.UCUtils.LOGGER;
import static de.rettichlp.ucutils.UCUtils.messageService;
import static de.rettichlp.ucutils.UCUtils.nameTagService;
import static de.rettichlp.ucutils.UCUtils.networkHandler;
import static de.rettichlp.ucutils.UCUtils.player;
import static de.rettichlp.ucutils.UCUtils.storage;
Expand All @@ -28,7 +29,7 @@ public void sendCommand(String command) {
}

public boolean sendCommandWithAfkCheck(String command) {
boolean isAfk = storage.isAfk();
boolean isAfk = nameTagService.isAfk(player.getStringifiedName());
LOGGER.info("UCUtils executing command with AFK check (is AFK: {}): {}", isAfk, command);

if (!isAfk) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import static de.rettichlp.ucutils.UCUtils.LOGGER;
import static de.rettichlp.ucutils.UCUtils.commandService;
import static de.rettichlp.ucutils.UCUtils.configuration;
import static de.rettichlp.ucutils.UCUtils.nameTagService;
import static de.rettichlp.ucutils.UCUtils.player;
import static de.rettichlp.ucutils.UCUtils.storage;
import static de.rettichlp.ucutils.UCUtils.utilService;
Expand All @@ -37,10 +38,6 @@ public class PlayerListener implements IAbsorptionGetListener, IMessageReceiveLi
private static final String SHUTDOWN_TIMEOUT = "5";
private static final int PRAY_DELAY_IN_SECONDS = 30;

// afk
private static final Pattern AFK_START_PATTERN = compile("^Du bist nun im AFK-Modus\\.$");
private static final Pattern AFK_END_PATTERN = compile("^Du bist nun nicht mehr im AFK-Modus\\.$");

// dead
private static final Pattern DEAD_PATTERN = compile("^Du bist nun für (?<minutes>\\d+) Minuten auf dem Friedhof$");
private static final Pattern DEAD_DESPAWN_PATTERN = compile("^Verdammt\\.{3} mein Kopf dröhnt so\\.{3}$");
Expand All @@ -60,18 +57,6 @@ public void onAbsorptionGet() {

@Override
public boolean onMessageReceive(Text text, String message) {
Matcher afkStartMatcher = AFK_START_PATTERN.matcher(message);
if (afkStartMatcher.find()) {
storage.setAfk(true);
return true;
}

Matcher afkEndMatcher = AFK_END_PATTERN.matcher(message);
if (afkEndMatcher.find()) {
storage.setAfk(false);
return true;
}

Matcher deadAReviveMatcher = DEAD_AREVIVE_PATTERN.matcher(message);
if (deadAReviveMatcher.find()) {
storage.getActiveShutdowns().removeIf(shutdownReason -> shutdownReason == CEMETERY);
Expand Down Expand Up @@ -125,7 +110,7 @@ public boolean onMessageReceive(Text text, String message) {

@Override
public void onTick() {
if (player.age % 1200 == 0 && !storage.isAfk()) {
if (player.age % 1200 == 0 && !nameTagService.isAfk(player.getStringifiedName())) {
configuration.addMinutesSinceLastPayDay(1);
}
}
Expand Down