Browse Source

cancel players in portal in non vanilla worlds

Kajetan Johannes Hammerle 3 years ago
parent
commit
b864ea7a45
1 changed files with 9 additions and 0 deletions
  1. 9 0
      src/me/hammerle/kp/Events.java

+ 9 - 0
src/me/hammerle/kp/Events.java

@@ -368,4 +368,13 @@ public class Events implements Listener {
             e.setCancelled(true);
         }
     }
+
+    @EventHandler
+    public void onPlayerPortal(PlayerPortalEvent e) {
+        World from = e.getFrom().getWorld();
+        World to = e.getTo().getWorld();
+        if(!isVanillaWorld(from) || !isVanillaWorld(to)) {
+            e.setCancelled(true);
+        }
+    }
 }