From 03f32e24c5f4b381e06476acf3604e7b914e9acc Mon Sep 17 00:00:00 2001 From: HSGamer Date: Tue, 5 Mar 2024 10:41:11 +0700 Subject: [PATCH] fix component not found --- .../me/hsgamer/morefoworld/listener/PortalListener.java | 7 ++++++- .../me/hsgamer/morefoworld/listener/RespawnListener.java | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/me/hsgamer/morefoworld/listener/PortalListener.java b/src/main/java/me/hsgamer/morefoworld/listener/PortalListener.java index 40f5c55..a410a54 100644 --- a/src/main/java/me/hsgamer/morefoworld/listener/PortalListener.java +++ b/src/main/java/me/hsgamer/morefoworld/listener/PortalListener.java @@ -17,12 +17,17 @@ import java.util.Optional; public class PortalListener extends ListenerComponent { - private final DebugComponent debug = plugin.get(DebugComponent.class); + private DebugComponent debug; public PortalListener(BasePlugin plugin) { super(plugin); } + @Override + public void load() { + debug = plugin.get(DebugComponent.class); + } + @EventHandler public void onPortalReady(EntityPortalReadyEvent event) { if (event.getPortalType() != PortalType.NETHER) return; diff --git a/src/main/java/me/hsgamer/morefoworld/listener/RespawnListener.java b/src/main/java/me/hsgamer/morefoworld/listener/RespawnListener.java index 4f4f869..0add3dd 100644 --- a/src/main/java/me/hsgamer/morefoworld/listener/RespawnListener.java +++ b/src/main/java/me/hsgamer/morefoworld/listener/RespawnListener.java @@ -11,12 +11,17 @@ import java.util.Optional; public class RespawnListener extends ListenerComponent { - private final DebugComponent debug = plugin.get(DebugComponent.class); + private DebugComponent debug; public RespawnListener(BasePlugin plugin) { super(plugin); } + @Override + public void load() { + debug = plugin.get(DebugComponent.class); + } + @EventHandler public void onRespawn(PlayerRespawnEvent event) { debug.debug("Respawn: " + event.getPlayer().getName() + " in " + event.getRespawnLocation());