From 0aa8d8f0e5ac6e574e85997bd0ddbe7a54306495 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 28 Jun 2020 04:21:40 -0400
Subject: [PATCH] Fix null pointer in portal search config

---
 .../Add-configurable-portal-search-radius.patch                | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Spigot-Server-Patches/Add-configurable-portal-search-radius.patch b/Spigot-Server-Patches/Add-configurable-portal-search-radius.patch
index ed9e673a98..0763d4b3ec 100644
--- a/Spigot-Server-Patches/Add-configurable-portal-search-radius.patch
+++ b/Spigot-Server-Patches/Add-configurable-portal-search-radius.patch
@@ -42,7 +42,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
              Location enter = this.getBukkitEntity().getLocation();
              Location exit = (worldserver == null) ? null : new Location(worldserver.getWorld(), d0, d1, d2, f1, f);
 -            PlayerPortalEvent event = new PlayerPortalEvent(this.getBukkitEntity(), enter, exit, cause, 128, true, resourcekey == DimensionManager.THE_END ? 0 : 16);
-+            PlayerPortalEvent event = new PlayerPortalEvent(this.getBukkitEntity(), enter, exit, cause, worldserver.paperConfig.portalSearchRadius, true, resourcekey == DimensionManager.THE_END ? 0 : worldserver.paperConfig.portalCreateRadius);
++            com.destroystokyo.paper.PaperWorldConfig config = worldserver != null ? worldserver.paperConfig : worldserver1.paperConfig; // Paper - portal radius
++            PlayerPortalEvent event = new PlayerPortalEvent(this.getBukkitEntity(), enter, exit, cause, config.portalSearchRadius, true, resourcekey == DimensionManager.THE_END ? 0 : config.portalCreateRadius); // Paper - portal radius
              Bukkit.getServer().getPluginManager().callEvent(event);
              if (event.isCancelled() || event.getTo() == null) {
                  return null;