SteamWar/BauSystem2.0
Archiviert
12
0

LoaderRework #175

Zusammengeführt
YoyoNow hat 20 Commits von LoaderRework nach master 2023-05-09 18:31:42 +02:00 zusammengeführt
8 geänderte Dateien mit 61 neuen und 56 gelöschten Zeilen
Nur Änderungen aus Commit 6e82b57fbf werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -788,47 +788,36 @@ TRACE_GUI_POSITION_EXPLODED = §7Exploded§8: §e{0}
# Loader
LOADER_SETUP = §eSetup
LOADER_RUNNING = §aRunning
LOADER_SINGLE_SIDEBAR = §aSingle
LOADER_PAUSE = §7Pause
LOADER_END = §8Finished
LOADER_MESSAGE_CLEAR = §7Loader cleared
LOADER_MESSAGE_CLEAR_HELP = §cYou have to be in Setup-Mode to clear the Loader
LOADER_MESSAGE_TNT = §eTNT added {0}
LOADER_MESSAGE_INTERACT = §e{0} added {1}
LOADER_BUTTON_TNT = TNT
LOADER_BUTTON_SWITCH=Lever
LOADER_BUTTON_WOOD_BUTTON=Button
LOADER_BUTTON_STONE_BUTTON=Button
LOADER_BUTTON_WOOD_BUTTON=Wooden Button
LOADER_BUTTON_STONE_BUTTON=Stone Button
LOADER_BUTTON_PRESSURE_PLATE=Pressure plate
LOADER_BUTTON_WEIGHTED_PRESSURE_PLATE=Pressure plate
LOADER_BUTTON_TRIPWIRE=Tripwire
LOADER_BUTTON_NOTEBLOCK=Noteblock
LOADER_BUTTON_DAYLIGHTSENSOR=Daylightsensor
LOADER_BUTTON_INVALID=Invalid
LOADER_BUTTON_COMPARATOR=Comparator
LOADER_BUTTON_REPEATER=Repeater
LOADER_BUTTON_LECTERN=Lectern
LOADER_BUTTON_TRAPDOOR=Trapdoor
LOADER_BUTTON_DOOR=Door
LOADER_BUTTON_FENCEGATE=Fencegate
LOADER_HELP_SETUP=§8/§eloader setup §8- §7Starts recording actions
LOADER_HELP_UNDO=§8/§7loader undo §8- §7Removes last recorded action
LOADER_HELP_START=§8/§eloader start §8- §7Playback of previously recorded action
LOADER_HELP_WAIT=§8/§7loader wait §8[§7Ticks§8] - §7Sets wait time between shots
LOADER_HELP_SPEED=§8/§7loader speed §8[§7Ticks§8] - §7Sets wait time between actions
LOADER_HELP_PAUSE=§8/§7loader pause §8- §7Pauses Loader
LOADER_HELP_RESUME=§8/§7loader resume §8- §7Resumes Loader
LOADER_HELP_SETTINGS=§8/§7loader settings §8- §7Shows Loader settings
LOADER_HELP_STOP=§8/§eloader stop §8- §7Stops recording/playback
LOADER_HELP_CLEAR=§8/§eloader clear §8- §7Clears recording
LOADER_HELP_SINGLE=§8/§eloader single §8- §7Starts a single shot
LOADER_HELP_OTHER=§7The loader works with §eIngame§8-§eTicks §7(20 ticks per Second)
LOADER_NO_LOADER=§cYou have no Laoder. Create one with /loader setup
LOADER_BACK_SETUP=§7DYour Loader is in Setup again
LOADER_NEW=§7Load your cannon and fire it once, to initialise the loader.
LOADER_HOW_TO_START=§7Then, execute /§eloader start§7 to start the Loader
LOADER_ACTIVE=§7The Loader is now active.
LOADER_STOP=§7The Loader has been stopped.
LOADER_PAUSED=§7The Loader is now paused.
LOADER_RESUME=§7The Loader is resuming.
LOADER_SINGLE=§7The Loader is shooting once.
LOADER_SMALL_TIME=§cThe wait time is too small
LOADER_NEW_TIME=§7The wait time is now: {0}, before {1}
LOADER_NEW_LOAD_TIME=§7The action wait time is now: {0}, before {1}
LOADER_UNDO=§7Undo succesful.
LOADER_PERMS=§cYou are not allowed to use the Loader here
LOADER_GUI_NAME=§eLoader
LOADER_GUI_NEW=§eNew Loader
@ -842,6 +831,7 @@ LOADER_GUI_SPEED=§eSpeed
LOADER_GUI_SPEED_LORE=§7Currently: §e{0}
LOADER_GUI_SPEED_TITLE=§7Block placing speed
LOADER_GUI_STOP=§eStop Loader
# Loadtimer
LOADTIMER_HELP_OVERVIEW=§7Compete with your friends loading your cannon and get information about the cannon
LOADTIMER_HELP_START_1=§8/§eloadtimer start §8-§7 Starts the simple Loadtimer

Datei anzeigen

@ -761,47 +761,36 @@ TRACE_GUI_POSITION_EXPLODED = §7Explodiert§8: §e{0}
# Loader
LOADER_SETUP = §eEinrichtung
LOADER_RUNNING = §aLaufend
LOADER_SINGLE_SIDEBAR = §aEiner
LOADER_PAUSE = §7Pausiert
LOADER_END = §8Beendet
LOADER_MESSAGE_CLEAR = §7Loader gecleart
LOADER_MESSAGE_CLEAR_HELP = §cDu must im Setup-Modus sein um den Loader zu clearen
LOADER_MESSAGE_TNT = §eTNT hinzugefügt {0}
LOADER_MESSAGE_INTERACT = §e{0} hinzugefügt {1}
LOADER_BUTTON_TNT = TNT
LOADER_BUTTON_SWITCH=Hebel
LOADER_BUTTON_WOOD_BUTTON=Knopf
LOADER_BUTTON_STONE_BUTTON=Knopf
LOADER_BUTTON_WOOD_BUTTON=Holzknopf
LOADER_BUTTON_STONE_BUTTON=Steinknopf
LOADER_BUTTON_PRESSURE_PLATE=Druckplatte
LOADER_BUTTON_WEIGHTED_PRESSURE_PLATE=Druckplatte
LOADER_BUTTON_TRIPWIRE=Tripwire
LOADER_BUTTON_NOTEBLOCK=Noteblock
LOADER_BUTTON_DAYLIGHTSENSOR=Tageslichtsensor
LOADER_BUTTON_INVALID=Invalider
LOADER_BUTTON_COMPARATOR=Comparator
LOADER_BUTTON_REPEATER=Repeater
LOADER_BUTTON_LECTERN=Lectern
LOADER_BUTTON_TRAPDOOR=Trapdoor
LOADER_BUTTON_DOOR=Door
LOADER_BUTTON_FENCEGATE=Fencegate
LOADER_HELP_SETUP=§8/§eloader setup §8- §7Startet die Aufnahme der Aktionen
LOADER_HELP_UNDO=§8/§7loader undo §8- §7Entfernt die zuletzt aufgenommene Aktion
LOADER_HELP_START=§8/§eloader start §8- §7Spielt die zuvor aufgenommenen Aktionen ab
LOADER_HELP_WAIT=§8/§7loader wait §8[§7Ticks§8] - §7Setzt die Wartezeit zwischen Schüssen
LOADER_HELP_SPEED=§8/§7loader speed §8[§7Ticks§8] - §7Setzt die Wartezeit zwischen Aktionen
LOADER_HELP_PAUSE=§8/§7loader pause §8- §7Pausiert das Abspielen
LOADER_HELP_RESUME=§8/§7loader resume §8- §7Spielt den Loader weiter ab
LOADER_HELP_SETTINGS=§8/§7loader settings §8- §7Zeigt die Einstellungen an
LOADER_HELP_STOP=§8/§eloader stop §8- §7Stoppt die Aufnahme bzw. das Abspielen
LOADER_HELP_CLEAR=§8/§eloader clear §8- §7Cleart die Aufnahme
LOADER_HELP_SINGLE=§8/§eloader single §8- §7Spielt die Aufnahme einmal ab
LOADER_HELP_OTHER=§7Der Loader arbeitet mit §eIngame§8-§eTicks §7(20 Ticks pro Sekunde)
LOADER_NO_LOADER=§cDu hast noch keinen Loader. Erstelle dir einen mit /loader setup
LOADER_BACK_SETUP=§7Dein Loader ist nun wieder im Setup
LOADER_NEW=§7Belade und feuer einmal die Kanone ab, um den Loader zu initialisieren.
LOADER_HOW_TO_START=§7Führe dann /§eloader start§7 um den Loader zu starten
LOADER_ACTIVE=§7Der Loader ist nun aktiviert.
LOADER_STOP=§7Der Loader ist nun gestoppt.
LOADER_PAUSED=§7Der Loader ist nun pausiert.
LOADER_RESUME=§7Der Loader läuft nun weiter.
LOADER_SINGLE=§7Der Loader schießt einmal.
LOADER_SMALL_TIME=§cDie Wartezeit ist zu klein
LOADER_NEW_TIME=§7Die Schusswartezeit ist nun: {0}, zuvor {1}
LOADER_NEW_LOAD_TIME=§7Die Setzwartezeit ist nun: {0}, zuvor {1}
LOADER_UNDO=§7Undo erfolgreich.
LOADER_PERMS=§cDu darfst hier nicht den Detonator nutzen
LOADER_GUI_NAME=§eLoader
LOADER_GUI_NEW=§eNeuer Loader
@ -815,6 +804,7 @@ LOADER_GUI_SPEED=§eGeschwindigkeit
LOADER_GUI_SPEED_LORE=§7Aktuell: §e{0}
LOADER_GUI_SPEED_TITLE=§7Block Platzier Geschwindigkeit
LOADER_GUI_STOP=§eLoader Stoppen
# Loadtimer
LOADTIMER_HELP_OVERVIEW=§7Messe dich und deine Freunde beim Beladen einer Kanone und bekomme informationen über die Kanone
LOADTIMER_HELP_START_1=§8/§eloadtimer start §8-§7 Startet den einfachen Loadtimer

Datei anzeigen

@ -76,7 +76,7 @@ public class LoaderCommand extends SWCommand {
BauSystem.MESSAGE.send("LOADER_PAUSED", player);
}
@Register(value = "settings", description = "LOADER_HELP_PAUSE")
@Register(value = "settings", description = "LOADER_HELP_SETTINGS")
public void settingsLoader(@Validator Player player) {
Loader loader = Loader.getLoader(player);
if (loaderNullCheck(loader, player)) return;

Datei anzeigen

@ -20,6 +20,7 @@
package de.steamwar.bausystem.features.loadern;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.SWUtils;
import de.steamwar.bausystem.features.loadern.elements.LoaderElement;
import de.steamwar.bausystem.features.loadern.elements.impl.*;
import de.steamwar.bausystem.features.tpslimit.TPSUtils;
@ -81,6 +82,7 @@ public class LoaderRecorder implements Listener {
addWaitTime(false);
loaderElementList.add(new LoaderTNT(event.getBlock().getLocation()));
message("LOADER_BUTTON_TNT");
}
@EventHandler
@ -97,35 +99,46 @@ public class LoaderRecorder implements Listener {
switch (type) {
case COMPARATOR:
loaderElementList.add(new LoaderComparator(block.getLocation()));
message("LOADER_BUTTON_COMPARATOR");
break;
case REPEATER:
loaderElementList.add(new LoaderRepeater(block.getLocation()));
message("LOADER_BUTTON_REPEATER");
break;
case NOTE_BLOCK:
loaderElementList.add(new LoaderNoteBlock(block.getLocation()));
message("LOADER_BUTTON_NOTEBLOCK");
break;
case LEVER:
loaderElementList.add(new LoaderLever(block.getLocation()));
message("LOADER_BUTTON_SWITCH");
break;
case DAYLIGHT_DETECTOR:
loaderElementList.add(new LoaderDaylightDetector(block.getLocation()));
message("LOADER_BUTTON_DAYLIGHTSENSOR");
break;
case LECTERN:
loaderElementList.add(new LoaderLectern(block.getLocation()));
message("LOADER_BUTTON_LECTERN");
break;
case IRON_TRAPDOOR:
break;
default:
if (type.name().endsWith("_TRAPDOOR")) {
loaderElementList.add(new LoaderOpenable(block.getLocation(), "Trapdoor", type));
loaderElementList.add(new LoaderOpenable(block.getLocation(), "LOADER_BUTTON_TRAPDOOR", type));
message("LOADER_BUTTON_TRAPDOOR");
} else if (type.name().endsWith("_DOOR")) {
loaderElementList.add(new LoaderOpenable(block.getLocation(), "Door", type));
loaderElementList.add(new LoaderOpenable(block.getLocation(), "LOADER_BUTTON_DOOR", type));
message("LOADER_BUTTON_DOOR");
} else if (type.name().endsWith("FENCE_GATE")) {
loaderElementList.add(new LoaderOpenable(block.getLocation(), "Fencegate", type));
loaderElementList.add(new LoaderOpenable(block.getLocation(), "LOADER_BUTTON_FENCEGATE", type));
message("LOADER_BUTTON_FENCEGATE");
} else if (type.name().endsWith("STONE_BUTTON")) {
loaderElementList.add(new LoaderTicks(block.getLocation(), "Stone Button", type, 20));
loaderElementList.add(new LoaderTicks(block.getLocation(), "LOADER_BUTTON_STONE_BUTTON", type, 20));
message("LOADER_BUTTON_STONE_BUTTON");
} else if (type.name().endsWith("BUTTON")) {
loaderElementList.add(new LoaderTicks(block.getLocation(), "Wooden Button", type, 30));
loaderElementList.add(new LoaderTicks(block.getLocation(), "LOADER_BUTTON_WOOD_BUTTON", type, 30));
message("LOADER_BUTTON_WOOD_BUTTON");
}
break;
}
@ -162,15 +175,18 @@ public class LoaderRecorder implements Listener {
Material type = toBlock.getType();
switch (type) {
case TRIPWIRE:
loaderMovement = new LoaderMovement(toBlock.getLocation(), "Tripwire", Material.STRING);
loaderMovement = new LoaderMovement(toBlock.getLocation(), "LOADER_BUTTON_TRIPWIRE", Material.STRING);
message("LOADER_BUTTON_TRIPWIRE");
break;
case LIGHT_WEIGHTED_PRESSURE_PLATE:
case HEAVY_WEIGHTED_PRESSURE_PLATE:
loaderMovement = new LoaderMovement(toBlock.getLocation(), "Weighted Pressure Plate", type);
loaderMovement = new LoaderMovement(toBlock.getLocation(), "LOADER_BUTTON_WEIGHTED_PRESSURE_PLATE", type);
message("LOADER_BUTTON_WEIGHTED_PRESSURE_PLATE");
break;
default:
if (type.name().endsWith("PRESSURE_PLATE")) {
loaderMovement = new LoaderMovement(toBlock.getLocation(), "Pressure Plate", type);
loaderMovement = new LoaderMovement(toBlock.getLocation(), "LOADER_BUTTON_PRESSURE_PLATE", type);
message("LOADER_BUTTON_PRESSURE_PLATE");
}
break;
}
@ -180,4 +196,8 @@ public class LoaderRecorder implements Listener {
}
}
}
private void message(String type) {
SWUtils.sendToActionbar(player, BauSystem.MESSAGE.parse("LOADER_MESSAGE_INTERACT", player, BauSystem.MESSAGE.parse(type, player), loaderElementList.size()));
}
}

Datei anzeigen

@ -98,6 +98,7 @@ public class LoaderMovement extends LoaderInteractionElement<LoaderMovement.Move
AnaloguePowerable analoguePowerable = (AnaloguePowerable) location.getBlock().getBlockData();
analoguePowerable.setPower(power);
location.getBlock().setBlockData(analoguePowerable, true);
update(analoguePowerable);
} else if (blockData instanceof Powerable) {
Powerable powerable = (Powerable) location.getBlock().getBlockData();
if (ticks < 0) {
@ -106,6 +107,7 @@ public class LoaderMovement extends LoaderInteractionElement<LoaderMovement.Move
powerable.setPowered(true);
}
location.getBlock().setBlockData(powerable, true);
update(powerable);
}
if (ticks >= 0) {
@ -115,10 +117,12 @@ public class LoaderMovement extends LoaderInteractionElement<LoaderMovement.Move
AnaloguePowerable analoguePowerable = (AnaloguePowerable) blockData;
analoguePowerable.setPower(0);
location.getBlock().setBlockData(analoguePowerable, true);
update(analoguePowerable);
} else {
Powerable powerable = (Powerable) blockData;
powerable.setPowered(false);
location.getBlock().setBlockData(powerable, true);
update(powerable);
}
if (finalWaitFor) {
nextAction.run();
@ -154,7 +158,7 @@ public class LoaderMovement extends LoaderInteractionElement<LoaderMovement.Move
});
}
swInventory.setItem(12, new SWItem(SWItem.getDye(1), "§c-1").getItemStack(), clickType -> {
swInventory.setItem(12, new SWItem(SWItem.getDye(1), "§c-1", Arrays.asList("§7Shift: §c-5"), false, clickType -> {}).getItemStack(), clickType -> {
ticks -= clickType.isShiftClick() ? 5 : 1;
if (ticks < 1) ticks = 1;
swInventory.setItem(13, item(player));
@ -171,7 +175,7 @@ public class LoaderMovement extends LoaderInteractionElement<LoaderMovement.Move
});
swAnvilInv.open();
});
swInventory.setItem(14, new SWItem(SWItem.getDye(10), "§a+1").getItemStack(), clickType -> {
swInventory.setItem(14, new SWItem(SWItem.getDye(10), "§a+1", Arrays.asList("§7Shift: §a+5"), false, clickType -> {}).getItemStack(), clickType -> {
ticks += clickType.isShiftClick() ? 5 : 1;
swInventory.setItem(13, item(player));
});

Datei anzeigen

@ -26,7 +26,6 @@ import de.steamwar.inventory.SWItem;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.data.Openable;
import org.bukkit.block.data.type.TrapDoor;
import org.bukkit.entity.Player;
import java.util.Arrays;

Datei anzeigen

@ -84,11 +84,13 @@ public class LoaderTicks extends LoaderInteractionElement<LoaderTicks.TicksSetti
Powerable powerable = (Powerable) location.getBlock().getBlockData();
powerable.setPowered(true);
location.getBlock().setBlockData(powerable, true);
update(powerable);
boolean finalWaitFor = waitFor;
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
powerable.setPowered(false);
location.getBlock().setBlockData(powerable, true);
update(powerable);
if (finalWaitFor) {
nextAction.run();
}

Datei anzeigen

@ -65,7 +65,7 @@ public class LoaderWait implements LoaderElement, Listener {
for (int i = 9; i < 18; i++) swInventory.setItem(i, new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7"));
swInventory.setItem(9, new SWItem(Material.ARROW, "§8Back").getItemStack(), clickType -> backAction.run());
swInventory.setItem(3, new SWItem(SWItem.getDye(1), "§c-1").getItemStack(), clickType -> {
swInventory.setItem(3, new SWItem(SWItem.getDye(1), "§c-1", Arrays.asList("§7Shift: §c-5"), false, clickType -> {}).getItemStack(), clickType -> {
delay -= clickType.isShiftClick() ? 5 : 1;
if (delay < 0) delay = 0;
swInventory.setItem(4, menu(player));
@ -82,7 +82,7 @@ public class LoaderWait implements LoaderElement, Listener {
});
swAnvilInv.open();
});
swInventory.setItem(5, new SWItem(SWItem.getDye(10), "§a+1").getItemStack(), clickType -> {
swInventory.setItem(5, new SWItem(SWItem.getDye(10), "§a+1", Arrays.asList("§7Shift: §a+5"), false, clickType -> {}).getItemStack(), clickType -> {
delay += clickType.isShiftClick() ? 5 : 1;
swInventory.setItem(4, menu(player));
});