LoaderRework #175
@ -810,7 +810,7 @@ LOADER_BUTTON_FENCEGATE=Fencegate
|
||||
LOADER_HELP_SETUP=§8/§eloader setup §8- §7Starts recording actions
|
||||
LOADER_HELP_START=§8/§eloader start §8- §7Playback of previously recorded action
|
||||
LOADER_HELP_PAUSE=§8/§7loader pause §8- §7Pauses Loader
|
||||
LOADER_HELP_SETTINGS=§8/§7loader settings §8- §7Shows Loader settings
|
||||
LOADER_HELP_GUI=§8/§7loader gui §8- §7Shows Loader gui
|
||||
LOADER_HELP_STOP=§8/§eloader stop §8- §7Stops recording/playback
|
||||
LOADER_NO_LOADER=§cYou have no Laoder. Create one with /loader setup
|
||||
LOADER_NEW=§7Load your cannon and fire it once, to initialise the loader.
|
||||
|
@ -783,7 +783,7 @@ LOADER_BUTTON_FENCEGATE=Fencegate
|
||||
LOADER_HELP_SETUP=§8/§eloader setup §8- §7Startet die Aufnahme der Aktionen
|
||||
LOADER_HELP_START=§8/§eloader start §8- §7Spielt die zuvor aufgenommenen Aktionen ab
|
||||
LOADER_HELP_PAUSE=§8/§7loader pause §8- §7Pausiert das Abspielen
|
||||
LOADER_HELP_SETTINGS=§8/§7loader settings §8- §7Zeigt die Einstellungen an
|
||||
LOADER_HELP_GUI=§8/§7loader settings §8- §7Zeigt die Einstellungen an
|
||||
LOADER_HELP_STOP=§8/§eloader stop §8- §7Stoppt die Aufnahme bzw. das Abspielen
|
||||
LOADER_NO_LOADER=§cDu hast noch keinen Loader. Erstelle dir einen mit /loader setup
|
||||
LOADER_NEW=§7Belade und feuer einmal die Kanone ab, um den Loader zu initialisieren.
|
||||
|
@ -24,6 +24,7 @@ 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.SWAnvilInv;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
import de.steamwar.inventory.SWListInv;
|
||||
import lombok.AllArgsConstructor;
|
||||
@ -123,7 +124,7 @@ public class Loader implements Listener {
|
||||
LOADER_MAP.remove(p);
|
||||
}
|
||||
|
||||
public void settings(SettingsSorting settingsSorting) {
|
||||
public void gui(SettingsSorting settingsSorting) {
|
||||
List<SWListInv.SWListEntry<LoaderElement>> list = new ArrayList<>();
|
||||
for (LoaderElement element : elements) {
|
||||
if (settingsSorting != null) {
|
||||
@ -139,17 +140,62 @@ public class Loader implements Listener {
|
||||
SWListInv<LoaderElement> swListInv = new SWListInv<>(p, "Loader Settings", false, list, (clickType, loaderElement) -> {});
|
||||
swListInv.setCallback((clickType, entry) -> entry.click(p, swListInv::open));
|
||||
|
||||
SWItem onlyInteractionsElements = new SWItem(Material.REPEATER, "§eNur Interaktionen", clickType -> {
|
||||
gui(settingsSorting == SettingsSorting.INTERACTIONS ? null : SettingsSorting.INTERACTIONS);
|
||||
});
|
||||
if (settingsSorting == SettingsSorting.INTERACTIONS) onlyInteractionsElements.setEnchanted(true);
|
||||
swListInv.setItem(47, onlyInteractionsElements);
|
||||
|
||||
SWItem onlyWaitElements = new SWItem(Material.CLOCK, "§eNur Warten", clickType -> {
|
||||
settings(settingsSorting == SettingsSorting.WAIT ? null : SettingsSorting.WAIT);
|
||||
gui(settingsSorting == SettingsSorting.WAIT ? null : SettingsSorting.WAIT);
|
||||
});
|
||||
if (settingsSorting == SettingsSorting.WAIT) onlyWaitElements.setEnchanted(true);
|
||||
swListInv.setItem(48, onlyWaitElements);
|
||||
|
||||
SWItem onlyInteractionsElements = new SWItem(Material.REPEATER, "§eNur Interaktionen", clickType -> {
|
||||
settings(settingsSorting == SettingsSorting.INTERACTIONS ? null : SettingsSorting.INTERACTIONS);
|
||||
});
|
||||
if (settingsSorting == SettingsSorting.INTERACTIONS) onlyInteractionsElements.setEnchanted(true);
|
||||
swListInv.setItem(50, onlyInteractionsElements);
|
||||
if (settingsSorting == SettingsSorting.WAIT) {
|
||||
SWItem waitBetweenTNT = new SWItem(Material.TNT, "§7Wait Time zwischen TNT", clickType -> {
|
||||
SWAnvilInv swAnvilInv = new SWAnvilInv(p, "§7Wartezeit", "");
|
||||
swAnvilInv.setCallback(s -> {
|
||||
try {
|
||||
long delay = Long.parseLong(s);
|
||||
if (delay < 0) delay = 0;
|
||||
for (int i = 1; i < elements.size() - 1; i++) {
|
||||
if (!(elements.get(i - 1) instanceof LoaderTNT)) continue;
|
||||
if (!(elements.get(i + 1) instanceof LoaderTNT)) continue;
|
||||
if (!(elements.get(i) instanceof LoaderWait)) continue;
|
||||
((LoaderWait) elements.get(i)).setDelay(delay);
|
||||
}
|
||||
} catch (NumberFormatException ignored) {
|
||||
}
|
||||
gui(settingsSorting);
|
||||
});
|
||||
swAnvilInv.open();
|
||||
});
|
||||
swListInv.setItem(50, waitBetweenTNT);
|
||||
|
||||
SWItem waitTime = new SWItem(Material.PAPER, "§7Wait Time alle", clickType -> {
|
||||
SWAnvilInv swAnvilInv = new SWAnvilInv(p, "§7Wartezeit", "");
|
||||
swAnvilInv.setCallback(s -> {
|
||||
try {
|
||||
long delay = Long.parseLong(s);
|
||||
if (delay < 0) delay = 0;
|
||||
long finalDelay = delay;
|
||||
elements.stream()
|
||||
.filter(LoaderWait.class::isInstance)
|
||||
.map(LoaderWait.class::cast)
|
||||
.forEach(loaderWait -> loaderWait.setDelay(finalDelay));
|
||||
} catch (NumberFormatException ignored) {
|
||||
}
|
||||
swListInv.open();
|
||||
});
|
||||
gui(settingsSorting);
|
||||
});
|
||||
swListInv.setItem(51, waitTime);
|
||||
} else {
|
||||
SWItem empty = new SWItem(Material.STRUCTURE_VOID, "§7", clickType -> {});
|
||||
swListInv.setItem(50, empty);
|
||||
swListInv.setItem(51, empty);
|
||||
}
|
||||
|
||||
swListInv.open();
|
||||
}
|
||||
|
@ -76,11 +76,11 @@ public class LoaderCommand extends SWCommand {
|
||||
BauSystem.MESSAGE.send("LOADER_PAUSED", player);
|
||||
}
|
||||
|
||||
@Register(value = "settings", description = "LOADER_HELP_SETTINGS")
|
||||
public void settingsLoader(@Validator Player player) {
|
||||
@Register(value = "gui", description = "LOADER_HELP_GUI")
|
||||
public void guiLoader(@Validator Player player) {
|
||||
Loader loader = Loader.getLoader(player);
|
||||
if (loaderNullCheck(loader, player)) return;
|
||||
loader.settings(null);
|
||||
loader.gui(null);
|
||||
}
|
||||
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
|
@ -25,6 +25,7 @@ import de.steamwar.inventory.SWAnvilInv;
|
||||
import de.steamwar.inventory.SWInventory;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -35,6 +36,7 @@ import java.util.Arrays;
|
||||
public class LoaderWait implements LoaderElement, Listener {
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private long delay;
|
||||
|
||||
public LoaderWait(long delay) {
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren