9
0
mirror of https://gitlab.com/SamB440/rpgregions-2.git synced 2025-12-30 20:29:18 +00:00

feature: Add %rpgregions_region_timed%, fix: timed regions being timed globally instead of individually

This commit is contained in:
SamB440
2022-06-05 22:05:15 +01:00
parent 6c83e59e34
commit 2be1fe3cb8
5 changed files with 56 additions and 11 deletions

View File

@@ -3,8 +3,10 @@ package net.islandearth.rpgregions.managers.data.account;
import net.islandearth.rpgregions.managers.data.region.Discovery;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
public class RPGRegionsAccount {
@@ -12,11 +14,13 @@ public class RPGRegionsAccount {
private final UUID uuid;
private final Map<String, Discovery> discoveredRegions;
private final List<AccountCooldown> cooldowns;
private final Map<String, Long> secondsInRegion;
public RPGRegionsAccount(UUID uuid, Map<String, Discovery> discoveredRegions) {
this.uuid = uuid;
this.discoveredRegions = discoveredRegions;
this.cooldowns = new ArrayList<>();
this.secondsInRegion = new HashMap<>();
}
public UUID getUuid() {
@@ -35,6 +39,18 @@ public class RPGRegionsAccount {
return cooldowns;
}
public Optional<Long> getStartTimeInRegion(String region) {
return Optional.ofNullable(secondsInRegion.getOrDefault(region, null));
}
public void addStartTimeInRegion(String region, long time) {
secondsInRegion.put(region, time);
}
public void removeStartTimeInRegion(String region) {
secondsInRegion.remove(region);
}
public enum AccountCooldown {
ICON_COMMAND,
TELEPORT

View File

@@ -36,7 +36,8 @@ public enum Translations {
EXIT_LORE(TranslationKey.of("exit_lore")),
CANNOT_ENTER(TranslationKey.of("cannot_enter")),
COOLDOWN(TranslationKey.of("cooldown")),
REGION_ENTER_ACTIONBAR(TranslationKey.of("region_enter_actionbar"));
REGION_ENTER_ACTIONBAR(TranslationKey.of("region_enter_actionbar")),
DISCOVERING_AREA_PLACEHOLDER(TranslationKey.of("discovering_area_placeholder"));
private final TranslationKey key;
private final boolean isList;

View File

@@ -23,4 +23,5 @@ next_page_lore:
exit_lore:
- "&fExit the GUI"
cooldown: "&cThat is currently on cooldown."
region_enter_actionbar: "&a%0"
region_enter_actionbar: "&a%0"
discovering_area_placeholder: "&6Discovering a new area (%0%)..."