SteamWar/BauSystem2.0
Archiviert
12
0

Update WarpListener
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2022-01-20 20:24:40 +01:00
Ursprung f0a23e0d5f
Commit 6929a60c0f

Datei anzeigen

@ -28,9 +28,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.*;
import org.bukkit.util.Vector;
import java.util.ArrayList;
@ -46,6 +44,15 @@ public class WarpListener implements Listener {
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
createStuff(event, event.getPlayer().isSneaking());
}
@EventHandler
public void onPlayerToggleSneak(PlayerToggleSneakEvent event) {
createStuff(event, event.isSneaking());
}
private void createStuff(PlayerEvent event, boolean sneaking) {
if (warpsShown.containsKey(event.getPlayer())) {
warpsShown.get(event.getPlayer()).forEach(warp -> {
warp.hide(event.getPlayer());
@ -62,7 +69,7 @@ public class WarpListener implements Listener {
current.setY(event.getPlayer().getLocation().getY() - 1);
Map<String, Location> locations = new HashMap<>();
if (event.getPlayer().isSneaking()) {
if (sneaking) {
Bukkit.getOnlinePlayers().forEach(player -> {
locations.put(player.getName(), player.getLocation());
});