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:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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%)..."
|
||||
Reference in New Issue
Block a user