From 42daa7c8cd9b74eb15cef99283d7ab9275d72cad Mon Sep 17 00:00:00 2001 From: sophie Date: Sun, 10 Nov 2024 17:05:06 +0200 Subject: [PATCH] stop threadexecutor on server shutdown --- src/main/java/ovh/sad/animalrp/AnimalRP.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/ovh/sad/animalrp/AnimalRP.java b/src/main/java/ovh/sad/animalrp/AnimalRP.java index 26bb806..df03a8e 100644 --- a/src/main/java/ovh/sad/animalrp/AnimalRP.java +++ b/src/main/java/ovh/sad/animalrp/AnimalRP.java @@ -2,6 +2,7 @@ package ovh.sad.animalrp; import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback; +import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; import net.minecraft.util.Identifier; import ovh.sad.animalrp.animals.Animal; import ovh.sad.animalrp.animals.Cat; @@ -98,5 +99,9 @@ ZZZzz /,`.-'`' -. ;-;;,_ (new InteractionCommand("cuddle", Mood.CUTE, "%s cuddles with you. %s", "You and %s start cuddling. How cute! %s")).Command(dispatcher, registryAccess, environment); }); + + ServerLifecycleEvents.SERVER_STOPPING.register((server) -> { + executor.shutdownNow(); + }); } } \ No newline at end of file