diff --git a/pom.xml b/pom.xml
index 6760898..4def3df 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
4.0.0
com.gmail.llmdlio
TownyFlight
- 1.10.0
+ 1.10.1
TownyFlight
A flight plugin for Towny servers.
diff --git a/src/main/java/com/gmail/llmdlio/townyflight/listeners/PlayerTeleportListener.java b/src/main/java/com/gmail/llmdlio/townyflight/listeners/PlayerTeleportListener.java
index badd35f..40b4206 100644
--- a/src/main/java/com/gmail/llmdlio/townyflight/listeners/PlayerTeleportListener.java
+++ b/src/main/java/com/gmail/llmdlio/townyflight/listeners/PlayerTeleportListener.java
@@ -16,7 +16,7 @@ public class PlayerTeleportListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR)
private void playerTeleports(PlayerTeleportEvent event) {
- if (event.getCause() != TeleportCause.PLUGIN || event.getCause() != TeleportCause.COMMAND)
+ if (!aTeleportCauseThatMatters(event.getCause()))
return;
Player player = event.getPlayer();
@@ -29,6 +29,11 @@ private void playerTeleports(PlayerTeleportEvent event) {
TownyFlightAPI.getInstance().removeFlight(player, false, true, "");
}
+ private boolean aTeleportCauseThatMatters(TeleportCause teleportCause) {
+ return teleportCause == TeleportCause.PLUGIN || teleportCause == TeleportCause.COMMAND ||
+ teleportCause == TeleportCause.ENDER_PEARL || teleportCause == TeleportCause.CHORUS_FRUIT;
+ }
+
private boolean flightAllowedDestination(Player player, Location loc) {
Resident resident = TownyUniverse.getInstance().getResident(player.getUniqueId());
return resident != null && TownyFlightAPI.allowedLocation(player, loc, resident);