aboutsummaryrefslogtreecommitdiff
path: root/mod/src
diff options
context:
space:
mode:
authorsyeyoung <cyoung06@naver.com>2023-02-06 15:35:49 +0900
committersyeyoung <cyoung06@naver.com>2023-02-06 15:35:49 +0900
commit544fdb38a545ff346a8d12349067c805caac3862 (patch)
treeae724c0777d548dc685b9b3c64871d370d444366 /mod/src
parent02f6dc27e96f26ba2a14df90893ab3d06bbece4a (diff)
downloadSkyblock-Dungeons-Guide-544fdb38a545ff346a8d12349067c805caac3862.tar.gz
Skyblock-Dungeons-Guide-544fdb38a545ff346a8d12349067c805caac3862.tar.bz2
Skyblock-Dungeons-Guide-544fdb38a545ff346a8d12349067c805caac3862.zip
- better unloading
Signed-off-by: syeyoung <cyoung06@naver.com>
Diffstat (limited to 'mod/src')
-rwxr-xr-xmod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java1
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/PacketInjector.java8
2 files changed, 5 insertions, 4 deletions
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java
index 7a7ba7fb..b0d67ab0 100755
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java
@@ -304,6 +304,7 @@ public class DungeonsGuide implements DGInterface {
StompManager.getInstance().cleanup();
// have FUN!
+
for (Object registeredListener : registeredListeners) {
MinecraftForge.EVENT_BUS.unregister(registeredListener);
}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/PacketInjector.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/PacketInjector.java
index 54ba4f8a..676682ff 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/PacketInjector.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/PacketInjector.java
@@ -93,16 +93,16 @@ public class PacketInjector extends ChannelDuplexHandler {
super.write(ctx, msg, promise);
}
- private ChannelPipeline thePipeline;
+
@SubscribeEvent
public void onServerConnect(FMLNetworkEvent.ClientConnectedToServerEvent event) {
- (thePipeline =event.manager.channel().pipeline()).addBefore("packet_handler", "dg_packet_handler", this);
+ event.manager.channel().pipeline().addBefore("packet_handler", "dg_packet_handler", this);
}
public void cleanup() {
try {
- if (thePipeline != null)
- thePipeline.remove("dg_packet_handler");
+ if (Minecraft.getMinecraft().getNetHandler() != null)
+ Minecraft.getMinecraft().getNetHandler().getNetworkManager().channel().pipeline().remove("dg_packet_handler");
} catch (Exception e) {
}