refactor: Java 21 support, config/API updates, GUI polish
This commit is contained in:
parent
bfdf197de4
commit
ceb4c804b7
76 changed files with 1210 additions and 999 deletions
|
|
@ -5,8 +5,8 @@ import dev.loki.lomines.data.config.loader.entity.PlayerSpawnConfigLoader;
|
|||
import dev.loki.lomines.data.config.loader.entity.TeleportConfigLoader;
|
||||
import dev.loki.lomines.data.config.loader.region.RegionConfigLoader;
|
||||
import dev.loki.lomines.data.config.loader.region.WorldGuardConfigLoader;
|
||||
import dev.loki.lomines.data.config.loader.reset.ResetConfigLoader;
|
||||
import dev.loki.lomines.data.config.loader.reward.RewardConfigLoader;
|
||||
import dev.loki.lomines.data.config.loader.system.ResetConfigLoader;
|
||||
import dev.loki.lomines.data.config.loader.system.UIConfigLoader;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
|
|
@ -156,6 +156,7 @@ public final class ConfigLoader {
|
|||
public ConfigLoadException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public ConfigLoadException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,20 +49,6 @@ public record MineConfig(
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Total volume of the mine (for progress calculation).
|
||||
*/
|
||||
public int volume() {
|
||||
return region.totalVolume();
|
||||
}
|
||||
|
||||
/**
|
||||
* World name where the mine is located.
|
||||
*/
|
||||
public String worldName() {
|
||||
return region.worldName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates builder for fluent construction.
|
||||
*/
|
||||
|
|
@ -87,6 +73,20 @@ public record MineConfig(
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Total volume of the mine (for progress calculation).
|
||||
*/
|
||||
public int volume() {
|
||||
return region.totalVolume();
|
||||
}
|
||||
|
||||
/**
|
||||
* World name where the mine is located.
|
||||
*/
|
||||
public String worldName() {
|
||||
return region.worldName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the spawn location for stuck players.
|
||||
* If playerSpawn is not set, falls back to teleport location.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package dev.loki.lomines.data.config.block;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
|
|
|||
|
|
@ -10,12 +10,6 @@ import java.util.Objects;
|
|||
*/
|
||||
public sealed interface BlockKey permits BlockKey.Vanilla, BlockKey.Oraxen, BlockKey.ItemsAdder {
|
||||
|
||||
/**
|
||||
* Serializes this key to string format for YAML storage.
|
||||
* Format: "stone" (vanilla), "oraxen:my_block", "itemsadder:custom_block"
|
||||
*/
|
||||
String serialize();
|
||||
|
||||
/**
|
||||
* Deserializes a string to appropriate BlockKey type.
|
||||
*
|
||||
|
|
@ -43,6 +37,12 @@ public sealed interface BlockKey permits BlockKey.Vanilla, BlockKey.Oraxen, Bloc
|
|||
return new Vanilla(material);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes this key to string format for YAML storage.
|
||||
* Format: "stone" (vanilla), "oraxen:my_block", "itemsadder:custom_block"
|
||||
*/
|
||||
String serialize();
|
||||
|
||||
// --- Implementations ---
|
||||
|
||||
record Vanilla(Material material) implements BlockKey {
|
||||
|
|
|
|||
|
|
@ -80,9 +80,11 @@ public final class RegionConfigLoader {
|
|||
public void save(YamlConfiguration yaml, RegionConfig region) {
|
||||
int i = 1;
|
||||
for (var cuboid : region.regions()) {
|
||||
yaml.set("region.selection." + i, LocationParser.format(cuboid.getMin()));
|
||||
Location min = new Location(cuboid.getWorld(), cuboid.getMinX(), cuboid.getMinY(), cuboid.getMinZ());
|
||||
yaml.set("region.selection." + i, LocationParser.format(min));
|
||||
i++;
|
||||
yaml.set("region.selection." + i, LocationParser.format(cuboid.getMax()));
|
||||
Location max = new Location(cuboid.getWorld(), cuboid.getMaxX(), cuboid.getMaxY(), cuboid.getMaxZ());
|
||||
yaml.set("region.selection." + i, LocationParser.format(max));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,10 @@
|
|||
package dev.loki.lomines.data.config.loader.region;
|
||||
|
||||
import dev.loki.lomines.data.config.ConfigLoader;
|
||||
import dev.loki.lomines.integration.worldguard.WorldGuardConfig;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Loader for WorldGuard configuration section.
|
||||
|
|
|
|||
|
|
@ -36,7 +36,8 @@ public final class RewardConfigLoader {
|
|||
}
|
||||
|
||||
private RewardEntry parseRewardEntry(Map<?, ?> map) {
|
||||
double chance = ((Number) map.getOrDefault("chance", 0)).doubleValue();
|
||||
Object chanceObj = map.get("chance");
|
||||
double chance = chanceObj instanceof Number n ? n.doubleValue() : 0.0;
|
||||
|
||||
List<BlockKey> blocks = new ArrayList<>();
|
||||
List<?> blockList = (List<?>) map.get("blocks");
|
||||
|
|
@ -56,9 +57,17 @@ public final class RewardConfigLoader {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
List<String> commands = (List<String>) map.getOrDefault("commands", List.of());
|
||||
boolean preventDrops = (Boolean) map.getOrDefault("prevent-drops", false);
|
||||
List<String> commands = new ArrayList<>();
|
||||
Object commandsObj = map.get("commands");
|
||||
if (commandsObj instanceof List<?> list) {
|
||||
for (Object obj : list) {
|
||||
if (obj != null) {
|
||||
commands.add(obj.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
Object preventDropsObj = map.get("prevent-drops");
|
||||
boolean preventDrops = preventDropsObj instanceof Boolean b && b;
|
||||
|
||||
return new RewardEntry(blocks, chance, items, commands, preventDrops);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@ package dev.loki.lomines.data.config.loader.system;
|
|||
import dev.loki.lomines.data.config.reset.ResetConfig;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Loader for reset configuration section.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
package dev.loki.lomines.data.config.loader.system;
|
||||
|
||||
import dev.loki.lomines.data.config.ui.UIConfig;
|
||||
import dev.loki.lomines.data.config.ui.HologramConfig;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Loader for UI configuration section.
|
||||
|
|
@ -25,10 +27,21 @@ public final class UIConfigLoader {
|
|||
actionBarEnabled,
|
||||
yaml.getString("ui.actionbar.format", UIConfig.DEFAULT_ACTIONBAR_FORMAT),
|
||||
yaml.getDouble("ui.actionbar.range", 50.0),
|
||||
yaml.getString("ui.timer-format", UIConfig.DEFAULT_TIMER_FORMAT)
|
||||
yaml.getString("ui.timer-format", UIConfig.DEFAULT_TIMER_FORMAT),
|
||||
parseHologram(yaml)
|
||||
);
|
||||
}
|
||||
|
||||
private HologramConfig parseHologram(YamlConfiguration yaml) {
|
||||
boolean enabled = yaml.getBoolean("ui.hologram.enabled", false);
|
||||
List<String> format = yaml.getStringList("ui.hologram.format");
|
||||
if (format.isEmpty()) {
|
||||
format = HologramConfig.defaults().format();
|
||||
}
|
||||
double height = yaml.getDouble("ui.hologram.height", 2.5);
|
||||
return new HologramConfig(enabled, format, height);
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves UI configuration to YAML.
|
||||
*/
|
||||
|
|
@ -37,5 +50,8 @@ public final class UIConfigLoader {
|
|||
yaml.set("ui.actionbar.format", ui.actionBarFormat());
|
||||
yaml.set("ui.actionbar.range", ui.actionBarRange());
|
||||
yaml.set("ui.timer-format", ui.timerFormat());
|
||||
yaml.set("ui.hologram.enabled", ui.hologram().enabled());
|
||||
yaml.set("ui.hologram.format", ui.hologram().format());
|
||||
yaml.set("ui.hologram.height", ui.hologram().height());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
package dev.loki.lomines.data.config.parser;
|
||||
|
||||
/**
|
||||
* Exception for configuration parsing errors.
|
||||
*/
|
||||
public class ConfigParseException extends Exception {
|
||||
|
||||
public ConfigParseException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public ConfigParseException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +1,7 @@
|
|||
package dev.loki.lomines.data.config.reset;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Configuration for mine reset behavior.
|
||||
|
|
@ -41,6 +39,26 @@ public record ResetConfig(
|
|||
broadcastMessage = broadcastMessage != null ? broadcastMessage : "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Default config: 5 minutes, 10% trigger disabled.
|
||||
*/
|
||||
public static ResetConfig defaults() {
|
||||
return new ResetConfig(
|
||||
DEFAULT_INTERVAL,
|
||||
DEFAULT_PERCENT_TRIGGER,
|
||||
false,
|
||||
List.of(),
|
||||
""
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builder for fluent construction.
|
||||
*/
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Interval in ticks (20 ticks = 1 second).
|
||||
*/
|
||||
|
|
@ -69,26 +87,6 @@ public record ResetConfig(
|
|||
return percentEnabled && percentTrigger > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default config: 5 minutes, 10% trigger disabled.
|
||||
*/
|
||||
public static ResetConfig defaults() {
|
||||
return new ResetConfig(
|
||||
DEFAULT_INTERVAL,
|
||||
DEFAULT_PERCENT_TRIGGER,
|
||||
false,
|
||||
List.of(),
|
||||
""
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builder for fluent construction.
|
||||
*/
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private Duration interval = DEFAULT_INTERVAL;
|
||||
private double percentTrigger = DEFAULT_PERCENT_TRIGGER;
|
||||
|
|
@ -96,6 +94,26 @@ public record ResetConfig(
|
|||
private List<String> commands = List.of();
|
||||
private String broadcastMessage = "";
|
||||
|
||||
private static Duration parseDuration(String s) {
|
||||
s = s.trim().toLowerCase();
|
||||
try {
|
||||
if (s.endsWith("s")) {
|
||||
return Duration.ofSeconds(Long.parseLong(s.substring(0, s.length() - 1)));
|
||||
} else if (s.endsWith("m")) {
|
||||
return Duration.ofMinutes(Long.parseLong(s.substring(0, s.length() - 1)));
|
||||
} else if (s.endsWith("h")) {
|
||||
return Duration.ofHours(Long.parseLong(s.substring(0, s.length() - 1)));
|
||||
} else if (s.endsWith("d")) {
|
||||
return Duration.ofDays(Long.parseLong(s.substring(0, s.length() - 1)));
|
||||
} else {
|
||||
// Assume seconds if no suffix
|
||||
return Duration.ofSeconds(Long.parseLong(s));
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
return DEFAULT_INTERVAL;
|
||||
}
|
||||
}
|
||||
|
||||
public Builder interval(Duration interval) {
|
||||
this.interval = interval;
|
||||
return this;
|
||||
|
|
@ -134,25 +152,5 @@ public record ResetConfig(
|
|||
public ResetConfig build() {
|
||||
return new ResetConfig(interval, percentTrigger, percentEnabled, commands, broadcastMessage);
|
||||
}
|
||||
|
||||
private static Duration parseDuration(String s) {
|
||||
s = s.trim().toLowerCase();
|
||||
try {
|
||||
if (s.endsWith("s")) {
|
||||
return Duration.ofSeconds(Long.parseLong(s.substring(0, s.length() - 1)));
|
||||
} else if (s.endsWith("m")) {
|
||||
return Duration.ofMinutes(Long.parseLong(s.substring(0, s.length() - 1)));
|
||||
} else if (s.endsWith("h")) {
|
||||
return Duration.ofHours(Long.parseLong(s.substring(0, s.length() - 1)));
|
||||
} else if (s.endsWith("d")) {
|
||||
return Duration.ofDays(Long.parseLong(s.substring(0, s.length() - 1)));
|
||||
} else {
|
||||
// Assume seconds if no suffix
|
||||
return Duration.ofSeconds(Long.parseLong(s));
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
return DEFAULT_INTERVAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,9 +4,7 @@ import dev.loki.lomines.data.config.block.BlockKey;
|
|||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
|
|
@ -18,6 +16,20 @@ public record RewardConfig(List<RewardEntry> entries) {
|
|||
entries = entries != null ? List.copyOf(entries) : List.of();
|
||||
}
|
||||
|
||||
/**
|
||||
* Empty reward config.
|
||||
*/
|
||||
public static RewardConfig empty() {
|
||||
return new RewardConfig(List.of());
|
||||
}
|
||||
|
||||
/**
|
||||
* Single entry reward config builder.
|
||||
*/
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns rewards applicable for the given block.
|
||||
*/
|
||||
|
|
@ -34,20 +46,6 @@ public record RewardConfig(List<RewardEntry> entries) {
|
|||
return !entries.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Empty reward config.
|
||||
*/
|
||||
public static RewardConfig empty() {
|
||||
return new RewardConfig(List.of());
|
||||
}
|
||||
|
||||
/**
|
||||
* Single entry reward config builder.
|
||||
*/
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
// --- Reward Entry ---
|
||||
|
||||
public record RewardEntry(
|
||||
|
|
|
|||
|
|
@ -12,10 +12,7 @@ import java.util.Optional;
|
|||
* Supports multiple spawn points for a single mine.
|
||||
* Used to teleport players out when they are suffocating after mine reset.
|
||||
*/
|
||||
public final class PlayerSpawnConfig {
|
||||
|
||||
private final boolean enabled;
|
||||
private final List<Location> locations;
|
||||
public record PlayerSpawnConfig(boolean enabled, List<Location> locations) {
|
||||
|
||||
public PlayerSpawnConfig(boolean enabled, List<Location> locations) {
|
||||
this.enabled = enabled;
|
||||
|
|
@ -35,34 +32,6 @@ public final class PlayerSpawnConfig {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the primary spawn location (first in list) if enabled.
|
||||
*/
|
||||
public Optional<Location> getLocation() {
|
||||
return locations.isEmpty() ? Optional.empty() : Optional.of(locations.get(0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all spawn locations.
|
||||
*/
|
||||
public List<Location> getLocations() {
|
||||
return locations;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if spawn is enabled and has at least one location.
|
||||
*/
|
||||
public boolean enabled() {
|
||||
return enabled && !locations.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of configured spawn locations.
|
||||
*/
|
||||
public int count() {
|
||||
return locations.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Disabled spawn config (default).
|
||||
*/
|
||||
|
|
@ -84,6 +53,36 @@ public final class PlayerSpawnConfig {
|
|||
return new PlayerSpawnConfig(true, locations);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the primary spawn location (first in list) if enabled.
|
||||
*/
|
||||
public Optional<Location> getLocation() {
|
||||
return locations.isEmpty() ? Optional.empty() : Optional.of(locations.get(0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all spawn locations.
|
||||
*/
|
||||
@Override
|
||||
public List<Location> locations() {
|
||||
return locations;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if spawn is enabled and has at least one location.
|
||||
*/
|
||||
@Override
|
||||
public boolean enabled() {
|
||||
return enabled && !locations.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of configured spawn locations.
|
||||
*/
|
||||
public int count() {
|
||||
return locations.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new config with an additional location.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package dev.loki.lomines.data.config.teleport;
|
|||
import org.bukkit.Location;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
|
@ -12,10 +11,7 @@ import java.util.Optional;
|
|||
* Configuration for mine teleportation on reset.
|
||||
* Supports multiple teleport locations for a single mine.
|
||||
*/
|
||||
public final class TeleportConfig {
|
||||
|
||||
private final boolean enabled;
|
||||
private final List<Location> locations;
|
||||
public record TeleportConfig(boolean enabled, List<Location> locations) {
|
||||
|
||||
public TeleportConfig(boolean enabled, List<Location> locations) {
|
||||
this.enabled = enabled;
|
||||
|
|
@ -35,34 +31,6 @@ public final class TeleportConfig {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the primary teleport location (first in list) if enabled.
|
||||
*/
|
||||
public Optional<Location> getLocation() {
|
||||
return locations.isEmpty() ? Optional.empty() : Optional.of(locations.get(0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all teleport locations.
|
||||
*/
|
||||
public List<Location> getLocations() {
|
||||
return locations;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if teleport is enabled and has at least one location.
|
||||
*/
|
||||
public boolean enabled() {
|
||||
return enabled && !locations.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of configured teleport locations.
|
||||
*/
|
||||
public int count() {
|
||||
return locations.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Disabled teleport config.
|
||||
*/
|
||||
|
|
@ -84,6 +52,36 @@ public final class TeleportConfig {
|
|||
return new TeleportConfig(true, locations);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the primary teleport location (first in list) if enabled.
|
||||
*/
|
||||
public Optional<Location> getLocation() {
|
||||
return locations.isEmpty() ? Optional.empty() : Optional.of(locations.get(0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all teleport locations.
|
||||
*/
|
||||
@Override
|
||||
public List<Location> locations() {
|
||||
return locations;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if teleport is enabled and has at least one location.
|
||||
*/
|
||||
@Override
|
||||
public boolean enabled() {
|
||||
return enabled && !locations.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of configured teleport locations.
|
||||
*/
|
||||
public int count() {
|
||||
return locations.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new config with an additional location.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ import java.util.List;
|
|||
* Configuration for holograms displayed above mines.
|
||||
*
|
||||
* @param enabled whether holograms are enabled
|
||||
* @param format list of lines with placeholders {mine}, {percent}, {bar}, {time}
|
||||
* @param height offset above the mine region (in blocks)
|
||||
* @param format list of lines with placeholders {mine}, {percent}, {bar}, {time}
|
||||
* @param height offset above the mine region (in blocks)
|
||||
*/
|
||||
public record HologramConfig(
|
||||
boolean enabled,
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@ package dev.loki.lomines.data.config.ui;
|
|||
import dev.loki.lomines.util.format.ColorUtils;
|
||||
import net.kyori.adventure.text.Component;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Configuration for UI elements (action bar, messages).
|
||||
*/
|
||||
|
|
@ -16,14 +14,10 @@ public record UIConfig(
|
|||
HologramConfig hologram
|
||||
) {
|
||||
|
||||
public UIConfig {
|
||||
hologram = hologram != null ? hologram : HologramConfig.disabled();
|
||||
}
|
||||
|
||||
public static final String DEFAULT_ACTIONBAR_FORMAT = "<green>{mine}</green> <gray>{percent}%</gray> <dark_gray>({time})";
|
||||
public static final String DEFAULT_TIMER_FORMAT = "mm:ss";
|
||||
|
||||
public UIConfig {
|
||||
hologram = hologram != null ? hologram : HologramConfig.disabled();
|
||||
actionBarFormat = actionBarFormat != null && !actionBarFormat.isBlank()
|
||||
? actionBarFormat
|
||||
: DEFAULT_ACTIONBAR_FORMAT;
|
||||
|
|
@ -33,6 +27,20 @@ public record UIConfig(
|
|||
actionBarRange = Math.max(1, actionBarRange);
|
||||
}
|
||||
|
||||
/**
|
||||
* Default configuration.
|
||||
*/
|
||||
public static UIConfig defaults() {
|
||||
return new UIConfig(true, DEFAULT_ACTIONBAR_FORMAT, 50.0, DEFAULT_TIMER_FORMAT, HologramConfig.defaults());
|
||||
}
|
||||
|
||||
/**
|
||||
* Disabled configuration (no UI).
|
||||
*/
|
||||
public static UIConfig disabled() {
|
||||
return new UIConfig(false, "", 0, DEFAULT_TIMER_FORMAT, HologramConfig.disabled());
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the action bar format with placeholders.
|
||||
* Placeholders: {mine}, {percent}, {time}, {blocks}, {total}
|
||||
|
|
@ -71,18 +79,4 @@ public record UIConfig(
|
|||
public double actionBarRangeSquared() {
|
||||
return actionBarRange * actionBarRange;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default configuration.
|
||||
*/
|
||||
public static UIConfig defaults() {
|
||||
return new UIConfig(true, DEFAULT_ACTIONBAR_FORMAT, 50.0, DEFAULT_TIMER_FORMAT, HologramConfig.defaults());
|
||||
}
|
||||
|
||||
/**
|
||||
* Disabled configuration (no UI).
|
||||
*/
|
||||
public static UIConfig disabled() {
|
||||
return new UIConfig(false, "", 0, DEFAULT_TIMER_FORMAT, HologramConfig.disabled());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue