SteamWar/BauSystem2.0
Archiviert
12
0

Update Loader
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2023-05-01 17:13:15 +02:00
Ursprung 7e78c2890a
Commit 792f16fadf
4 geänderte Dateien mit 38 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -21,11 +21,15 @@ package de.steamwar.bausystem.features.loadern;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.loadern.elements.LoaderElement;
import de.steamwar.bausystem.features.loadern.elements.impl.LoaderTNT;
import de.steamwar.bausystem.features.loadern.elements.impl.LoaderWait;
import de.steamwar.bausystem.shared.EnumDisplay;
import de.steamwar.inventory.SWItem;
import de.steamwar.inventory.SWListInv;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@ -109,14 +113,36 @@ public class Loader implements Listener {
LOADER_MAP.remove(p);
}
public void settings() {
public void settings(SettingsSorting settingsSorting) {
List<SWListInv.SWListEntry<LoaderElement>> list = new ArrayList<>();
for (LoaderElement element : elements) {
if (settingsSorting != null) {
if (settingsSorting == SettingsSorting.WAIT && !(element instanceof LoaderWait)) {
continue;
}
if (settingsSorting == SettingsSorting.INTERACTIONS && (element instanceof LoaderWait || element instanceof LoaderTNT)) {
continue;
}
}
list.add(new SWListInv.SWListEntry<>(element.menu(p), element));
}
new SWListInv<>(p, "Loader Settings", false, list, (clickType, entry) -> {
entry.click(p, this::settings);
}).open();
SWListInv<LoaderElement> swListInv = new SWListInv<>(p, "Loader Settings", false, list, (clickType, entry) -> {
entry.click(p, () -> settings(settingsSorting));
});
SWItem onlyWaitElements = new SWItem(Material.CLOCK, "§eNur Warten", clickType -> {
settings(settingsSorting == SettingsSorting.WAIT ? null : SettingsSorting.WAIT);
});
if (settingsSorting == SettingsSorting.WAIT) onlyWaitElements.setEnchanted(true);
swListInv.setItem(48, onlyWaitElements);
SWItem onlyInteractionsElements = new SWItem(Material.TNT, "§eNur Interaktionen", clickType -> {
settings(settingsSorting == SettingsSorting.INTERACTIONS ? null : SettingsSorting.INTERACTIONS);
});
if (settingsSorting == SettingsSorting.INTERACTIONS) onlyInteractionsElements.setEnchanted(true);
swListInv.setItem(50, onlyInteractionsElements);
swListInv.open();
}
@EventHandler
@ -125,6 +151,11 @@ public class Loader implements Listener {
stop();
}
public enum SettingsSorting {
WAIT,
INTERACTIONS,
}
@AllArgsConstructor
public enum Stage implements EnumDisplay {
SETUP("LOADER_SETUP"),
@ -133,6 +164,6 @@ public class Loader implements Listener {
END("LOADER_END");
@Getter
private String chatValue;
private final String chatValue;
}
}

Datei anzeigen

@ -80,7 +80,7 @@ public class LoaderCommand extends SWCommand {
public void settingsLoader(@Validator Player player) {
Loader loader = Loader.getLoader(player);
if (loaderNullCheck(loader, player)) return;
loader.settings();
loader.settings(null);
}
@ClassValidator(value = Player.class, local = true)

Datei anzeigen

@ -19,7 +19,6 @@
package de.steamwar.bausystem.features.loadern.elements;
import de.steamwar.bausystem.features.loader.LoaderButton;
import de.steamwar.inventory.SWItem;
import de.steamwar.inventory.SWListInv;
import org.bukkit.Location;

Datei anzeigen

@ -1,7 +1,7 @@
package de.steamwar.bausystem.features.script.variables;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.loader.Loader;
import de.steamwar.bausystem.features.loadern.Loader;
import de.steamwar.bausystem.features.tpslimit.TPSLimitUtils;
import de.steamwar.bausystem.features.tpslimit.TPSUtils;
import de.steamwar.bausystem.features.tracer.record.ActiveTracer;