Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
f0a23e0d5f
Commit
6929a60c0f
@ -28,9 +28,7 @@ import org.bukkit.event.EventHandler;
|
|||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.*;
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -46,6 +44,15 @@ public class WarpListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerMove(PlayerMoveEvent event) {
|
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())) {
|
if (warpsShown.containsKey(event.getPlayer())) {
|
||||||
warpsShown.get(event.getPlayer()).forEach(warp -> {
|
warpsShown.get(event.getPlayer()).forEach(warp -> {
|
||||||
warp.hide(event.getPlayer());
|
warp.hide(event.getPlayer());
|
||||||
@ -62,7 +69,7 @@ public class WarpListener implements Listener {
|
|||||||
current.setY(event.getPlayer().getLocation().getY() - 1);
|
current.setY(event.getPlayer().getLocation().getY() - 1);
|
||||||
|
|
||||||
Map<String, Location> locations = new HashMap<>();
|
Map<String, Location> locations = new HashMap<>();
|
||||||
if (event.getPlayer().isSneaking()) {
|
if (sneaking) {
|
||||||
Bukkit.getOnlinePlayers().forEach(player -> {
|
Bukkit.getOnlinePlayers().forEach(player -> {
|
||||||
locations.put(player.getName(), player.getLocation());
|
locations.put(player.getName(), player.getLocation());
|
||||||
});
|
});
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren