SteamWar/BauSystem2.0
Archiviert
12
0

Fix delete errors
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2022-06-11 22:44:34 +02:00
Ursprung f75efee1ab
Commit 35aa984d17

Datei anzeigen

@ -54,7 +54,7 @@ import java.util.stream.Collectors;
public class SimulatorStorage implements Enable, Disable { public class SimulatorStorage implements Enable, Disable {
public static final World WORLD = Bukkit.getWorlds().get(0); public static final World WORLD = Bukkit.getWorlds().get(0);
private final File simulatorsDir = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "simulators"); private static final File simulatorsDir = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "simulators");
private static NamespacedKey simulatorSelection = SWUtils.getNamespaceKey("simulator_selection"); private static NamespacedKey simulatorSelection = SWUtils.getNamespaceKey("simulator_selection");
@ -99,7 +99,14 @@ public class SimulatorStorage implements Enable, Disable {
} }
public static void delete(String name) { public static void delete(String name) {
tntSimulators.remove(name); TNTSimulator tntSimulator = tntSimulators.remove(name);
if (tntSimulator != null) {
tntSimulator.getPlayerShowMode().forEach((player, simulatorEntityShowMode) -> {
SimulatorCursor.hide(player, tntSimulator);
});
tntSimulator.hide();
}
new File(simulatorsDir, name + ".simulator").delete();
} }
public static void removeSimulator(ItemStack itemStack) { public static void removeSimulator(ItemStack itemStack) {