From c7ccefa1c03806f3d176f8122b9893c51846295a Mon Sep 17 00:00:00 2001 From: BillyGalbreath Date: Wed, 9 Jun 2021 11:03:55 -0500 Subject: [PATCH] Add toggle for end portal safe teleporting --- ...ggle-for-end-portal-safe-teleporting.patch | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 patches/server/0224-Add-toggle-for-end-portal-safe-teleporting.patch diff --git a/patches/server/0224-Add-toggle-for-end-portal-safe-teleporting.patch b/patches/server/0224-Add-toggle-for-end-portal-safe-teleporting.patch new file mode 100644 index 000000000..6eab623ed --- /dev/null +++ b/patches/server/0224-Add-toggle-for-end-portal-safe-teleporting.patch @@ -0,0 +1,62 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Wed, 9 Jun 2021 11:03:40 -0500 +Subject: [PATCH] Add toggle for end portal safe teleporting + + +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 35c15afc3f4bbe10dc7638e926564f51285fda4c..18e5110047f13c213e70d3e094b94fecb4408d18 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -2603,7 +2603,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne + } + + this.E(); +- this.tickEndPortal(); // Paper - make end portalling safe ++ if (world.purpurConfig.endPortalSafeTeleporting) this.tickEndPortal(); // Paper - make end portalling safe // Purpur + } + } + +diff --git a/src/main/java/net/minecraft/world/level/block/BlockEnderPortal.java b/src/main/java/net/minecraft/world/level/block/BlockEnderPortal.java +index 31eabc40562462f98cc039a55453f200ca4eaa5c..56e81e3e2bbe87d28440ddb9a6285c781ec6530e 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockEnderPortal.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockEnderPortal.java +@@ -60,6 +60,22 @@ public class BlockEnderPortal extends BlockTileEntity { + // return; // CraftBukkit - always fire event in case plugins wish to change it + } + ++ // Purpur start ++ if (!world.purpurConfig.endPortalSafeTeleporting) { ++ // CraftBukkit start - Entity in portal ++ EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ())); ++ world.getServer().getPluginManager().callEvent(event); ++ ++ if (entity instanceof EntityPlayer) { ++ ((EntityPlayer) entity).changeDimension(worldserver, PlayerTeleportEvent.TeleportCause.END_PORTAL); ++ return; ++ } ++ // CraftBukkit end ++ entity.teleportTo(worldserver, null); ++ return; ++ } ++ // Purpur end ++ + // Paper start - move all of this logic into portal tick + entity.portalWorld = ((WorldServer)world); + entity.portalBlock = blockposition.immutableCopy(); +diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +index bd434559414a209db9e13c49303cab4a9f84ac15..5f1bfe41b9f7f24b86e72ea3b57acb3a7da95ad3 100644 +--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java ++++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +@@ -553,6 +553,11 @@ public class PurpurWorldConfig { + dragonEggTeleport = getBoolean("blocks.dragon_egg.teleport", dragonEggTeleport); + } + ++ public boolean endPortalSafeTeleporting = true; ++ private void endPortalSettings() { ++ endPortalSafeTeleporting = getBoolean("blocks.end_portal.safe-teleporting", endPortalSafeTeleporting); ++ } ++ + public boolean snowOnBlueIce = true; + public boolean mobsSpawnOnPackedIce = true; + public boolean mobsSpawnOnBlueIce = true;