Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ public class MedicListener implements IMessageReceiveListener {

private static final Pattern MEDIC_BANDAGE_PATTERN = compile("^(?:\\[UC])?(?<playerName>[a-zA-Z0-9_]+) hat dich bandagiert\\.$");
private static final Pattern MEDIC_PILL_PATTERN = compile("^\\[Medic] Doktor (?:\\[UC])?(?<playerName>[a-zA-Z0-9_]+) hat dir Schmerzpillen verabreicht\\.$");
private static final Pattern MEDIC_REVIVE_START = compile("^Du beginnst mit der Wiederbelebung\\.$");
private static final Pattern MEDIC_REVIVE_START_PATTERN = compile("^Du beginnst mit der Wiederbelebung von (?:\\[UC])?(?<playerName>[a-zA-Z0-9_]+)\\.\\.\\.$");
private static final Pattern MEDIC_RESPAWN_PATTERN = compile("^\\[Friedhof] Du lebst nun wieder\\.$");
private static final Pattern HOUSEBAN_HEADER_PATTERN = compile("^=== Hausverbote \\(\\d+\\) ===$");
private static final Pattern HOUSEBAN_ENTRY_PATTERN = compile("^» (?:\\[UC])?(?<playerName>[a-zA-Z0-9_]+) ➲ (?<reasons>.+) ➲ \\d+d \\((?<expireDateDay>\\d+)\\.(?<expireDateMonth>\\d+)\\.(?<expireDateYear>\\d+) (?<expireTimeHour>\\d+):(?<expireTimeMinute>\\d+)\\)$");
private static final Pattern HOUSEBAN_ADD_PATTERN = compile("^\\[HV] » (?:\\[UC])?(?<issuerPlayerName>[a-zA-Z0-9_]+) hat (?:\\[UC])?(?<playerName>[a-zA-Z0-9_]+)s Hausverbot gegeben\\. » (?<reason>.+) » \\d+d \\((?<expireDateDay>\\d+)\\.(?<expireDateMonth>\\d+)\\.(?<expireDateYear>\\d+) (?<expireTimeHour>\\d+):(?<expireTimeMinute>\\d+)\\)$");
Expand All @@ -63,11 +64,16 @@ public boolean onMessageReceive(Text text, String message) {
return true;
}

Matcher medicReviveStartMatcher = MEDIC_REVIVE_START.matcher(message);
Matcher medicReviveStartMatcher = MEDIC_REVIVE_START_PATTERN.matcher(message);
if (medicReviveStartMatcher.find()) {
utilService.delayedAction(() -> commandService.sendCommand("dinfo"), COMMAND_COOLDOWN_MILLIS);
}

Matcher medicRespawnMatcher = MEDIC_RESPAWN_PATTERN.matcher(message);
if (medicRespawnMatcher.find()) {
utilService.delayedAction(() -> commandService.sendCommand("togglephone"), COMMAND_COOLDOWN_MILLIS);
}

Matcher housebanHeaderMatcher = HOUSEBAN_HEADER_PATTERN.matcher(message);
if (housebanHeaderMatcher.find()) {
this.activeCheck = currentTimeMillis();
Expand Down