SteamWar/BauSystem2.0
Archiviert
12
0

Update stuff
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2022-07-21 14:32:32 +02:00
Ursprung 662982f20e
Commit 07a1dd7195
6 geänderte Dateien mit 28 neuen und 12 gelöschten Zeilen

Datei anzeigen

@ -529,6 +529,7 @@ SIMULATOR_WAND_LORE_1 = §eRight click §8- §7adds a position
SIMULATOR_WAND_LORE_2 = §eSneaking §8- §7Free movement
SIMULATOR_WAND_LORE_3 = §eLeft click §8- §7Start the simulation
SIMULATOR_WAND_LORE_4 = §eRight click in air §8- §7Opens the gui
SIMULATOR_WAND_LORE_5 = §eOffhand §8- §7Simulator preview
SIMULATOR_REGION_FROZEN = §cSimulator cannot be used inside frozen regions

Datei anzeigen

@ -530,6 +530,7 @@ SIMULATOR_WAND_LORE_1 = §eRechtsklick §8- §7Füge eine Position hinzu
SIMULATOR_WAND_LORE_2 = §eSneaken §8- §7Freie Bewegung
SIMULATOR_WAND_LORE_3 = §eLinksklick §8- §7Starte die Simulation
SIMULATOR_WAND_LORE_4 = §eRechtsklick Luft §8- §7Öffne die GUI
SIMULATOR_WAND_LORE_5 = §eOffhand §8- §7Simulator Vorschau
SIMULATOR_REGION_FROZEN = §cSimulator kann nicht in eingefrorenen Regionen genutzt werden

Datei anzeigen

@ -60,6 +60,10 @@ public class SimulatorCursor {
return;
}
if (SimulatorStorage.getSimulator(player.getInventory().getItemInOffHand()) != null && result.getHitPosition().distanceSquared(player.getLocation().toVector()) < 25) {
return;
}
cursor = SimulatorEntityShowMode.createEntity(getPos(player, result), false);
cursor.display(player);
cursors.put(player, cursor);

Datei anzeigen

@ -123,7 +123,7 @@ public class SimulatorStorage implements Enable, Disable {
}
public static ItemStack getWand(Player p) {
ItemStack itemStack = new SWItem(Material.BLAZE_ROD, BauSystem.MESSAGE.parse("SIMULATOR_WAND_NAME", p), Arrays.asList(BauSystem.MESSAGE.parse("SIMULATOR_WAND_LORE_1", p), BauSystem.MESSAGE.parse("SIMULATOR_WAND_LORE_2", p), BauSystem.MESSAGE.parse("SIMULATOR_WAND_LORE_3", p), BauSystem.MESSAGE.parse("SIMULATOR_WAND_LORE_4", p)), false, null).getItemStack();
ItemStack itemStack = new SWItem(Material.BLAZE_ROD, BauSystem.MESSAGE.parse("SIMULATOR_WAND_NAME", p), Arrays.asList(BauSystem.MESSAGE.parse("SIMULATOR_WAND_LORE_1", p), BauSystem.MESSAGE.parse("SIMULATOR_WAND_LORE_2", p), BauSystem.MESSAGE.parse("SIMULATOR_WAND_LORE_3", p), BauSystem.MESSAGE.parse("SIMULATOR_WAND_LORE_4", p), BauSystem.MESSAGE.parse("SIMULATOR_WAND_LORE_5", p)), false, null).getItemStack();
ItemUtils.setItem(itemStack, "simulator");
return itemStack;
}

Datei anzeigen

@ -204,6 +204,10 @@ public class TNTSimulator {
return;
}
if (SimulatorStorage.getSimulator(player.getInventory().getItemInOffHand()) != null && result.getHitPosition().distanceSquared(player.getLocation().toVector()) < 25) {
return;
}
TNTElement tntElement = new TNTElement(SimulatorCursor.getPos(player, result));
tntElementList.add(tntElement);
TNTElementGUI.open(player, tntElement, null);

Datei anzeigen

@ -22,14 +22,8 @@ package de.steamwar.bausystem.features.simulator;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.features.simulator.gui.SimulatorSelectionGUI;
import de.steamwar.bausystem.features.tracer.TNTPosition;
import de.steamwar.bausystem.features.tracer.show.Record;
import de.steamwar.bausystem.features.tracer.show.ShowModeParameter;
import de.steamwar.bausystem.features.tracer.show.mode.TraceEntityShowMode;
import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.bausystem.shared.Pair;
import de.steamwar.bausystem.shared.ShowMode;
import de.steamwar.bausystem.utils.ItemUtils;
import org.bukkit.Bukkit;
import org.bukkit.FluidCollisionMode;
@ -103,8 +97,11 @@ public class TNTSimulatorListener implements Listener {
public void onPlayerMove(PlayerMoveEvent e) {
if (ItemUtils.isItem(e.getPlayer().getInventory().getItemInMainHand(), "simulator")) {
simulatorShowHide(e.getPlayer(), i -> null, PlayerInventory::getItemInMainHand, e.getTo());
TNTSimulator tntSimulator = SimulatorStorage.getSimulator(e.getPlayer().getInventory().getItemInOffHand());
if (tntSimulator != null) SimulatorPreviewStorage.hide(e.getPlayer());
} else {
simulatorShowHide(e.getPlayer(), i -> null, PlayerInventory::getItemInOffHand, e.getTo());
TNTSimulator tntSimulator = simulatorShowHide(e.getPlayer(), i -> null, PlayerInventory::getItemInOffHand, e.getTo());
if (tntSimulator != null) SimulatorPreviewStorage.show(e.getPlayer(), tntSimulator);
}
}
@ -118,16 +115,25 @@ public class TNTSimulatorListener implements Listener {
simulatorShowHide(e.getPlayer(), i -> e.getItemDrop().getItemStack(), i -> null, e.getPlayer().getLocation());
}
private void simulatorShowHide(Player player, Function<PlayerInventory, ItemStack> oldItemFunction, Function<PlayerInventory, ItemStack> newItemFunction, Location location) {
private TNTSimulator simulatorShowHide(Player player, Function<PlayerInventory, ItemStack> oldItemFunction, Function<PlayerInventory, ItemStack> newItemFunction, Location location) {
TNTSimulator oldSimulator = SimulatorStorage.getSimulator(oldItemFunction.apply(player.getInventory()));
SimulatorCursor.hide(player, oldSimulator);
TNTSimulator simulator = SimulatorStorage.getSimulator(newItemFunction.apply(player.getInventory()));
if (simulator == null) {
return;
}
if (simulator == null) return null;
SimulatorCursor.show(player, simulator, trace(player, location, simulator));
return simulator;
}
@EventHandler
public void onPlayerJoin(PlayerJoinEvent e) {
if (ItemUtils.isItem(e.getPlayer().getInventory().getItemInMainHand(), "simulator")) {
simulatorShowHide(e.getPlayer(), i -> null, PlayerInventory::getItemInMainHand, e.getPlayer().getLocation());
} else {
TNTSimulator tntSimulator = simulatorShowHide(e.getPlayer(), i -> null, PlayerInventory::getItemInOffHand, e.getPlayer().getLocation());
if (tntSimulator != null) SimulatorPreviewStorage.show(e.getPlayer(), tntSimulator);
}
}
@EventHandler