SteamWar/BauSystem2.0
Archiviert
12
0

Fix stuff and fix bugs
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2022-06-10 22:56:28 +02:00
Ursprung 426f257358
Commit bd7c13dfd7
7 geänderte Dateien mit 47 neuen und 11 gelöschten Zeilen

Datei anzeigen

@ -593,7 +593,6 @@ SIMULATOR_MATERIAL_NAME = §e{0}
SIMULATOR_MATERIAL_NAME_LORE = §7Material §8- §e{0} SIMULATOR_MATERIAL_NAME_LORE = §7Material §8- §e{0}
SIMULATOR_MATERIAL_CLICK = §eClick to choose SIMULATOR_MATERIAL_CLICK = §eClick to choose
SIMULATOR_TNT_SPAWN_ADD_IGNITION_PHASE = §eAdd prime phase SIMULATOR_TNT_SPAWN_ADD_IGNITION_PHASE = §eAdd prime phase
SIMULATOR_TNT_SPAWN_ADD_IGNITION_PHASE_SHIFT = §eShift-Click§8: §7Add prime phase with 1 tick offset
SIMULATOR_TNT_SPAWN_ADD_TNT = §eAdd TNT SIMULATOR_TNT_SPAWN_ADD_TNT = §eAdd TNT
SIMULATOR_TNT_SPAWN_REMOVE_TNT = §cRemove SIMULATOR_TNT_SPAWN_REMOVE_TNT = §cRemove
SIMULATOR_TNT_SPAWN_POSITION_ANVIL_GUI_NAME = Position SIMULATOR_TNT_SPAWN_POSITION_ANVIL_GUI_NAME = Position

Datei anzeigen

@ -581,7 +581,6 @@ SIMULATOR_TNT_SPAWN_MATERIAL_LORE_3 = §eRechts-Click §7Zum zurücksetzten
SIMULATOR_MATERIAL_GUI_NAME = Material ändern SIMULATOR_MATERIAL_GUI_NAME = Material ändern
SIMULATOR_MATERIAL_CLICK = §eKlicken zum wählen SIMULATOR_MATERIAL_CLICK = §eKlicken zum wählen
SIMULATOR_TNT_SPAWN_ADD_IGNITION_PHASE = §eZündphase hinzufügen SIMULATOR_TNT_SPAWN_ADD_IGNITION_PHASE = §eZündphase hinzufügen
SIMULATOR_TNT_SPAWN_ADD_IGNITION_PHASE_SHIFT = §eShift-Click§8: §7Zündphase hinzufügen und +1 Tick Offset
SIMULATOR_TNT_SPAWN_ADD_TNT = §eTNT hinzufügen SIMULATOR_TNT_SPAWN_ADD_TNT = §eTNT hinzufügen
SIMULATOR_TNT_SPAWN_REMOVE_TNT = §cEntfernen SIMULATOR_TNT_SPAWN_REMOVE_TNT = §cEntfernen
SIMULATOR_TNT_SPAWN_POSITION_ANVIL_GUI_NAME = Position SIMULATOR_TNT_SPAWN_POSITION_ANVIL_GUI_NAME = Position

Datei anzeigen

@ -0,0 +1,38 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2022 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.features.simulator;
import de.steamwar.bausystem.shared.AbstractEntity;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
public interface AbstractSimulatorEntity extends AbstractEntity {
void display(Player player);
void setPosition(Vector position);
boolean hide(Player player, boolean always);
int getId();
Entity getBukkitEntity();
}

Datei anzeigen

@ -54,14 +54,14 @@ public class SimulatorCursor {
List<SimulatorElement> elements = tntSimulator.getEntity(result.getHitEntity()); List<SimulatorElement> elements = tntSimulator.getEntity(result.getHitEntity());
tntSimulator.hide(player, elements); tntSimulator.hide(player, elements);
cursor = SimulatorEntityShowMode.createEntity(player, elements.isEmpty() ? getPos(player, result) : elements.get(0).getPosition(), true); cursor = SimulatorEntityShowMode.createEntity(elements.isEmpty() ? getPos(player, result) : elements.get(0).getPosition(), true);
cursor.display(player); cursor.display(player);
cursors.put(player, cursor); cursors.put(player, cursor);
BauSystem.MESSAGE.sendPrefixless("SIMULATOR_POSITION_EDIT", player, ChatMessageType.ACTION_BAR); BauSystem.MESSAGE.sendPrefixless("SIMULATOR_POSITION_EDIT", player, ChatMessageType.ACTION_BAR);
return; return;
} }
cursor = SimulatorEntityShowMode.createEntity(player, getPos(player, result), false); cursor = SimulatorEntityShowMode.createEntity(getPos(player, result), false);
cursor.display(player); cursor.display(player);
cursors.put(player, cursor); cursors.put(player, cursor);
BauSystem.MESSAGE.sendPrefixless("SIMULATOR_POSITION_ADD", player, ChatMessageType.ACTION_BAR); BauSystem.MESSAGE.sendPrefixless("SIMULATOR_POSITION_ADD", player, ChatMessageType.ACTION_BAR);

Datei anzeigen

@ -152,7 +152,7 @@ public class TNTSimulator {
public void edit(Player player, RayTraceResult result) { public void edit(Player player, RayTraceResult result) {
if (result == null) { if (result == null) {
TNTSimulatorGui.open(player, this, null, getTntElementList(), null); TNTSimulatorGui.open(player, this, null, this::getTntElementList, null);
return; return;
} }
@ -165,7 +165,7 @@ public class TNTSimulator {
if (elements.size() == 1) { if (elements.size() == 1) {
TNTElementGUI.open(player, (TNTElement) elements.get(0), null); TNTElementGUI.open(player, (TNTElement) elements.get(0), null);
} else { } else {
TNTSimulatorGui.open(player, null, null, elements, null); TNTSimulatorGui.open(player, null, null, () -> elements, null);
} }
return; return;
} }

Datei anzeigen

@ -360,7 +360,7 @@ public class TNTElementGUI {
})); }));
if (!tntElement.hasParent()) { if (!tntElement.hasParent()) {
inv.setItem(24, new SWItem(Material.TNT, BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_ADD_IGNITION_PHASE", player), Arrays.asList(BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_ADD_IGNITION_PHASE_SHIFT", player)), false, clickType -> { inv.setItem(24, new SWItem(Material.TNT, BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_ADD_IGNITION_PHASE", player), Arrays.asList(), false, clickType -> {
// Create TNTGroup // Create TNTGroup
tntSimulator.getTntElementList().remove(tntElement); tntSimulator.getTntElementList().remove(tntElement);
Vector vector = tntElement.getOwnPosition().clone(); Vector vector = tntElement.getOwnPosition().clone();

Datei anzeigen

@ -32,22 +32,22 @@ import org.bukkit.entity.Player;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.function.Supplier;
@UtilityClass @UtilityClass
public class TNTSimulatorGui { public class TNTSimulatorGui {
public void open(Player player, TNTSimulator currentTntSimulator, TNTGroup currentTntGroup, List<SimulatorElement> simulatorElements, Runnable back) { public void open(Player player, TNTSimulator currentTntSimulator, TNTGroup currentTntGroup, Supplier<List<SimulatorElement>> simulatorElements, Runnable back) {
List<SWListInv.SWListEntry<SimulatorElement>> swListEntryList = new ArrayList<>(); List<SWListInv.SWListEntry<SimulatorElement>> swListEntryList = new ArrayList<>();
for (SimulatorElement element : simulatorElements) { for (SimulatorElement element : simulatorElements.get()) {
swListEntryList.add(new SWListInv.SWListEntry<>(element.menu(player), element)); swListEntryList.add(new SWListInv.SWListEntry<>(element.menu(player), element));
} }
SWListInv<SimulatorElement> inv = new SWListInv<>(player, BauSystem.MESSAGE.parse("SIMULATOR_GUI_NAME", player), false, swListEntryList, (clickType, simulatorElement) -> { SWListInv<SimulatorElement> inv = new SWListInv<>(player, BauSystem.MESSAGE.parse("SIMULATOR_GUI_NAME", player), false, swListEntryList, (clickType, simulatorElement) -> {
if (simulatorElement instanceof TNTGroup) { if (simulatorElement instanceof TNTGroup) {
TNTGroup tntGroup = (TNTGroup) simulatorElement; TNTGroup tntGroup = (TNTGroup) simulatorElement;
List<SimulatorElement> elements = new ArrayList<>(tntGroup.getElements()); open(player, null, tntGroup, () -> new ArrayList<>(tntGroup.getElements()), () -> open(player, currentTntSimulator, currentTntGroup, simulatorElements, back));
open(player, null, tntGroup, elements, () -> open(player, currentTntSimulator, currentTntGroup, simulatorElements, back));
} else { } else {
TNTElementGUI.open(player, (TNTElement) simulatorElement, () -> open(player, currentTntSimulator, currentTntGroup, simulatorElements, back)); TNTElementGUI.open(player, (TNTElement) simulatorElement, () -> open(player, currentTntSimulator, currentTntGroup, simulatorElements, back));
} }