Archiviert
13
0

Fix DoubleJumpListener

Dieser Commit ist enthalten in:
jojo 2020-08-16 09:48:05 +02:00
Ursprung cbf140cdfe
Commit 71a98bacaf

Datei anzeigen

@ -1,6 +1,6 @@
package de.steamwar.lobby.listener; package de.steamwar.lobby.listener;
import de.steamwar.lobby.utils.LobbyPlayer; import org.bukkit.GameMode;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -25,6 +25,9 @@ public class DoubleJumpListener implements Listener {
@EventHandler @EventHandler
public void handlePlayerToggleFlight(PlayerToggleFlightEvent event) { public void handlePlayerToggleFlight(PlayerToggleFlightEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
if (player.getGameMode() != GameMode.ADVENTURE && player.getGameMode() != GameMode.SURVIVAL) {
return;
}
event.setCancelled(true); event.setCancelled(true);
player.setAllowFlight(false); player.setAllowFlight(false);
@ -47,7 +50,9 @@ public class DoubleJumpListener implements Listener {
return; return;
player.setAllowFlight(true); player.setAllowFlight(true);
player.setFlying(false); if (player.getGameMode() == GameMode.ADVENTURE || player.getGameMode() == GameMode.SURVIVAL) {
player.setFlying(false);
}
} }