SteamWar/BauSystem2.0
Archiviert
12
0

Test TNTSimulatorListener
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2021-12-05 21:07:44 +01:00
Ursprung 38086589fc
Commit cd360c1911
3 geänderte Dateien mit 17 neuen und 12 gelöschten Zeilen

Datei anzeigen

@ -0,0 +1,16 @@
package de.steamwar.bausystem.features.simulator;
import de.steamwar.bausystem.linkage.Disable;
import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked;
@Linked(LinkageType.DISABLE_LINK)
public class TNTSimulatorDisable implements Disable {
@Override
public void disable() {
for (TNTSimulator simulator : TNTSimulator.TNT_SIMULATOR_MAP.values()) {
simulator.save();
}
}
}

Datei anzeigen

@ -23,7 +23,6 @@ package de.steamwar.bausystem.features.simulator;
import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.linkage.Disable;
import de.steamwar.bausystem.linkage.LinkageType; import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.Linked;
import org.bukkit.FluidCollisionMode; import org.bukkit.FluidCollisionMode;
@ -48,8 +47,7 @@ import static de.steamwar.bausystem.features.simulator.TNTSimulator.WAND;
import static de.steamwar.bausystem.features.simulator.TNTSimulator.get; import static de.steamwar.bausystem.features.simulator.TNTSimulator.get;
@Linked(LinkageType.LISTENER) @Linked(LinkageType.LISTENER)
@Linked(LinkageType.DISABLE_LINK) public class TNTSimulatorListener implements Listener {
public class TNTSimulatorListener implements Listener, Disable {
private boolean permissionCheck(Player player) { private boolean permissionCheck(Player player) {
if (!Permission.hasPermission(player, Permission.WORLD)) { if (!Permission.hasPermission(player, Permission.WORLD)) {
@ -144,11 +142,4 @@ public class TNTSimulatorListener implements Listener, Disable {
public void onPlayerQuit(PlayerQuitEvent event) { public void onPlayerQuit(PlayerQuitEvent event) {
get(event.getPlayer()).saveAndDelete(); get(event.getPlayer()).saveAndDelete();
} }
@Override
public void disable() {
for (TNTSimulator simulator : TNTSimulator.TNT_SIMULATOR_MAP.values()) {
simulator.save();
}
}
} }

Datei anzeigen

@ -37,7 +37,6 @@ import org.bukkit.event.Listener;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.InventoryHolder;
@Linked(LinkageType.LISTENER) @Linked(LinkageType.LISTENER)
@ -64,7 +63,6 @@ public class SmartPlaceListener implements Listener {
@EventHandler @EventHandler
public void onPlayerInteract(PlayerInteractEvent event) { public void onPlayerInteract(PlayerInteractEvent event) {
System.out.println(event);
if (event.getAction() != Action.RIGHT_CLICK_BLOCK) return; if (event.getAction() != Action.RIGHT_CLICK_BLOCK) return;
if (event.getPlayer().getGameMode() == GameMode.SPECTATOR) return; if (event.getPlayer().getGameMode() == GameMode.SPECTATOR) return;
if (!Config.getInstance().get(event.getPlayer()).getPlainValueOrDefault("smartPlace", false)) return; if (!Config.getInstance().get(event.getPlayer()).getPlainValueOrDefault("smartPlace", false)) return;