From 38a33b7298b2ab5d233e131037b5a828507273c5 Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Mon, 26 Oct 2026 10:14:19 +0100 Subject: [PATCH] Show the resulting value on number step buttons Each step button on the number screen shows the value it leads to, and marks when that value is the minimum or maximum. --- .../src/de/steamwar/lobby/LobbySystem.properties | 3 +++ .../src/de/steamwar/lobby/LobbySystem_de.properties | 3 +++ .../de/steamwar/lobby/particle/gui/ValueEditors.java | 10 ++++++---- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/LobbySystem/src/de/steamwar/lobby/LobbySystem.properties b/LobbySystem/src/de/steamwar/lobby/LobbySystem.properties index 02ac4c6f..958570b8 100644 --- a/LobbySystem/src/de/steamwar/lobby/LobbySystem.properties +++ b/LobbySystem/src/de/steamwar/lobby/LobbySystem.properties @@ -86,6 +86,9 @@ PARTICLE_VALUE_SELECTED = §aSelected PARTICLE_VALUE_RESET = §eReset to {0} PARTICLE_NUMBER_RANGE = §7Range§8: §e{0} §8- §e{1} PARTICLE_NUMBER_TYPE = §eClick to type a value +PARTICLE_NUMBER_RESULT = §7→ §e{0} +PARTICLE_NUMBER_AT_MAX = §7→ §e{0} §8(max) +PARTICLE_NUMBER_AT_MIN = §7→ §e{0} §8(min) PARTICLE_COLOR_EDITOR = §0Colours PARTICLE_COLOR_REMOVE = §eClick to remove PARTICLE_COLOR_ADD = §aAdd colour diff --git a/LobbySystem/src/de/steamwar/lobby/LobbySystem_de.properties b/LobbySystem/src/de/steamwar/lobby/LobbySystem_de.properties index 4e6dd860..45598f58 100644 --- a/LobbySystem/src/de/steamwar/lobby/LobbySystem_de.properties +++ b/LobbySystem/src/de/steamwar/lobby/LobbySystem_de.properties @@ -86,6 +86,9 @@ PARTICLE_VALUE_SELECTED = §aAusgewählt PARTICLE_VALUE_RESET = §eAuf {0} zurücksetzen PARTICLE_NUMBER_RANGE = §7Bereich§8: §e{0} §8- §e{1} PARTICLE_NUMBER_TYPE = §eZum Eingeben klicken +PARTICLE_NUMBER_RESULT = §7→ §e{0} +PARTICLE_NUMBER_AT_MAX = §7→ §e{0} §8(Max) +PARTICLE_NUMBER_AT_MIN = §7→ §e{0} §8(Min) PARTICLE_COLOR_EDITOR = §0Farben PARTICLE_COLOR_REMOVE = §eZum Entfernen klicken PARTICLE_COLOR_ADD = §aFarbe hinzufügen diff --git a/LobbySystem/src/de/steamwar/lobby/particle/gui/ValueEditors.java b/LobbySystem/src/de/steamwar/lobby/particle/gui/ValueEditors.java index da2c1a97..635dc468 100644 --- a/LobbySystem/src/de/steamwar/lobby/particle/gui/ValueEditors.java +++ b/LobbySystem/src/de/steamwar/lobby/particle/gui/ValueEditors.java @@ -86,10 +86,12 @@ class ValueEditors { private SWItem stepItem(Player player, Material material, double delta, double step, double value, double min, double max, boolean integer, Predicate apply, Runnable reopen) { String label = (delta < 0 ? "§c-" : "§a+") + number(Math.abs(delta)); - return new SWItem(material, label, clickType -> { - // Snap to the step grid and drop floating point noise, so repeated steps do not drift - double next = integer ? Math.round(value + delta) : Math.round(Math.round((value + delta) / step) * step * 1e6) / 1e6; - apply.test(Math.max(min, Math.min(max, next))); + // Snap to the step grid and drop floating point noise, so repeated steps do not drift + double unclamped = integer ? Math.round(value + delta) : Math.round(Math.round((value + delta) / step) * step * 1e6) / 1e6; + double next = Math.max(min, Math.min(max, unclamped)); + String limit = next == max && unclamped >= max ? "PARTICLE_NUMBER_AT_MAX" : next == min && unclamped <= min ? "PARTICLE_NUMBER_AT_MIN" : "PARTICLE_NUMBER_RESULT"; + return new SWItem(material, label, List.of(msg(limit, player, number(next))), false, clickType -> { + apply.test(next); reopen.run(); }); }