mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-01-06 00:18:36 +01:00
Explicitly cancels the portal if there is no nether or end.
https://github.com/BentoBoxWorld/BentoBox/issues/1036
This commit is contained in:
parent
46bd8c04e2
commit
336f4e9bd4
@ -60,11 +60,17 @@ public class PortalTeleportationListener implements Listener {
|
||||
}
|
||||
World fromWorld = e.getFrom().getWorld();
|
||||
World overWorld = Util.getWorld(fromWorld);
|
||||
|
||||
if (fromWorld == null || !plugin.getIWM().inWorld(overWorld) || !plugin.getIWM().isEndGenerate(overWorld)) {
|
||||
|
||||
if (fromWorld == null || !plugin.getIWM().inWorld(overWorld)) {
|
||||
// Do nothing special
|
||||
return false;
|
||||
}
|
||||
|
||||
// 1.14.4 requires explicit cancellation to prevent teleporting to the normal nether
|
||||
if (!plugin.getIWM().isEndGenerate(overWorld)) {
|
||||
e.setCancelled(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
// STANDARD END
|
||||
if (!plugin.getIWM().isEndIslands(overWorld)) {
|
||||
@ -133,10 +139,17 @@ public class PortalTeleportationListener implements Listener {
|
||||
World fromWorld = e.getFrom().getWorld();
|
||||
World overWorld = Util.getWorld(fromWorld);
|
||||
|
||||
if (fromWorld == null || !plugin.getIWM().inWorld(overWorld) || !plugin.getIWM().isNetherGenerate(overWorld)) {
|
||||
if (fromWorld == null || !plugin.getIWM().inWorld(overWorld)) {
|
||||
// Do nothing special
|
||||
return false;
|
||||
}
|
||||
|
||||
// 1.14.4 requires explicit cancellation to prevent teleporting to the normal nether
|
||||
if (!plugin.getIWM().isNetherGenerate(overWorld)) {
|
||||
e.setCancelled(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
// STANDARD NETHER
|
||||
if (!plugin.getIWM().isNetherIslands(overWorld)) {
|
||||
if (fromWorld.getEnvironment() != Environment.NETHER) {
|
||||
|
@ -174,7 +174,7 @@ public class PortalTeleportationListenerTest {
|
||||
PortalTeleportationListener np = new PortalTeleportationListener(plugin);
|
||||
PlayerPortalEvent e = new PlayerPortalEvent(null, from, null, TeleportCause.END_PORTAL);
|
||||
np.onEndIslandPortal(e);
|
||||
assertFalse(e.isCancelled());
|
||||
assertTrue(e.isCancelled());
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user