Skip to content
Open
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 @@ -7,7 +7,6 @@
import de.rettichlp.ucutils.common.models.Job;
import de.rettichlp.ucutils.common.models.ShutdownReason;
import de.rettichlp.ucutils.common.models.TeamResponse;
import de.rettichlp.ucutils.common.models.WantedEntry;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
Expand Down Expand Up @@ -52,9 +51,6 @@ public class Storage {
@Getter
private final Map<String, Faction> playerFactionCache = new HashMap<>();

@Getter
private final List<WantedEntry> wantedEntries = new ArrayList<>();

@Getter
@Setter
private int activeServices = 0;
Expand Down Expand Up @@ -131,8 +127,6 @@ public void print() {
LOGGER.info("medicPillCooldowns[{}]: {}", this.medicPillCooldowns.size(), this.medicPillCooldowns);
// playerFactionCache
LOGGER.info("playerFactionCache[{}]: {}", this.playerFactionCache.size(), this.playerFactionCache);
// wantedEntries
LOGGER.info("wantedEntries[{}]: {}", this.wantedEntries.size(), this.wantedEntries);
// activeServices
LOGGER.info("activeServices: {}", this.activeServices);
// carLocked
Expand Down
13 changes: 0 additions & 13 deletions src/main/java/de/rettichlp/ucutils/common/models/WantedEntry.java

This file was deleted.

10 changes: 10 additions & 0 deletions src/main/java/de/rettichlp/ucutils/listener/impl/CarListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import static de.rettichlp.ucutils.UCUtils.configuration;
import static de.rettichlp.ucutils.UCUtils.renderService;
import static de.rettichlp.ucutils.UCUtils.storage;
import static de.rettichlp.ucutils.UCUtils.utilService;
import static de.rettichlp.ucutils.common.services.CommandService.COMMAND_COOLDOWN_MILLIS;
import static java.lang.Integer.parseInt;
import static java.util.Optional.ofNullable;
import static java.util.regex.Pattern.compile;
Expand All @@ -25,6 +27,7 @@
@UCUtilsListener
public class CarListener implements IEntityRenderListener, IMessageReceiveListener {

private static final Pattern CAR_CHECK_PATTERN = compile("^Das Fahrzeug mit dem Kennzeichen [A-Z0-9-]+ gehört (?:\\[UC])?(?<playerName>[a-zA-Z0-9_]+)\\.$");
private static final Pattern CAR_UNLOCK_PATTERN = compile("^\\[Car] Du hast deinen .+ aufgeschlossen\\.$");
private static final Pattern CAR_LOCK_PATTERN = compile("^\\[Car] Du hast deinen .+ abgeschlossen\\.$");
private static final Pattern CAR_LOCKED_OWN_PATTERN = compile("^\\[Car] Dein Fahrzeug ist abgeschlossen\\.$");
Expand All @@ -45,6 +48,13 @@ public void onEntityRender(WorldRenderContext context) {

@Override
public boolean onMessageReceive(Text text, String message) {
Matcher carCheckMatcher = CAR_CHECK_PATTERN.matcher(message);
if (carCheckMatcher.find()) {
String playerName = carCheckMatcher.group("playerName");
utilService.delayedAction(() -> commandService.sendCommand("memberinfo " + playerName), COMMAND_COOLDOWN_MILLIS);
return true;
}

Matcher carUnlockMatcher = CAR_UNLOCK_PATTERN.matcher(message);
if (carUnlockMatcher.find()) {
storage.setCarLocked(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import static de.rettichlp.ucutils.UCUtils.commandService;
import static de.rettichlp.ucutils.UCUtils.player;
import static de.rettichlp.ucutils.common.services.MessageService.DATE_TIME_FORMAT;
import static java.lang.Integer.parseInt;
Expand All @@ -35,6 +36,7 @@ public class HouseListener implements IMessageReceiveListener {
private static final Pattern HOUSE_RENTER_HEADER_PATTERN = compile("^=== Mieter in Haus (?<number>\\d+) ===$");
private static final Pattern HOUSE_RENTER_ENTRY_ONLINE_PATTERN = compile("^» (?:\\[UC])?(?<playerName>[a-zA-Z0-9_]+) \\(Online\\)$");
private static final Pattern HOUSE_RENTER_ENTRY_OFFLINE_PATTERN = compile("^» (?:\\[UC])?(?<playerName>[a-zA-Z0-9_]+) \\(Offline seit (?<dateTime>\\d{2}\\.\\d{2}\\.\\d{4} \\d{2}:\\d{2}:\\d{2})\\)$");
private static final Pattern HOUSE_DRINK_PATTERN = compile("^\\[Küche] Du hast etwas getrunken\\.$");

private int lastHouseNumber = 0;

Expand Down Expand Up @@ -91,6 +93,12 @@ public boolean onMessageReceive(Text text, String message) {
return false;
}

Matcher houseDrinkMatcher = HOUSE_DRINK_PATTERN.matcher(message);
if (houseDrinkMatcher.find()) {
commandService.sendCommandWithHiddenOutput("health");
return commandService.showCommandOutputMessage("health");
}

return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public class PlayerListener implements IMessageReceiveListener, ITickListener {
private static final Pattern HEALTH_HEADER_PATTERN = compile("^=== Zustand von (?:\\[UC])?(?<playerName>[a-zA-Z0-9_]+) ===$");
private static final Pattern HEALTH_ENTRY_PATTERN = compile("^§.» (?<type>Gesundheit|Blut §.\\[§..+§.]|Hunger|Durst|Fett|Muskeln)§.: §.((§.)?#)+$");
private static final Pattern HEALTH_ENTRY_HOVER_PATTERN = compile("^§.(?<value>\\d+(\\.\\d+)?)§./§.20\\.0$");
private static final Pattern HOUSE_DRINK_PATTERN = compile("^\\[Küche] Du hast etwas getrunken\\.$");

// jail
private static final Pattern JAIL_PATTERN = compile("^\\[Gefängnis] Du bist nun für (?<minutes>\\d+) Minuten im Gefängnis\\.$");
Expand Down Expand Up @@ -100,12 +99,6 @@ public boolean onMessageReceive(Text text, String message) {
return commandService.showCommandOutputMessage("health");
}

Matcher houseDrinkMatcher = HOUSE_DRINK_PATTERN.matcher(message);
if (houseDrinkMatcher.find()) {
commandService.sendCommandWithHiddenOutput("health");
return commandService.showCommandOutputMessage("health");
}

Matcher jailMatcher = JAIL_PATTERN.matcher(message);
if (jailMatcher.find()) {
int minutes = parseInt(jailMatcher.group("minutes"));
Expand Down
Loading