diff --git a/gradle.properties b/gradle.properties index 1ab9cf9..c16ceaf 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,6 +10,6 @@ loader_version=0.11.6 fabric_version=0.36.1+1.17 # Mod Properties -mod_version=1.0.0 +mod_version=1.0.1 maven_group=xyz.nucleoid archives_base_name=game-parties diff --git a/src/main/java/xyz/nucleoid/parties/PartyManager.java b/src/main/java/xyz/nucleoid/parties/PartyManager.java index e6d3237..e24bf8a 100644 --- a/src/main/java/xyz/nucleoid/parties/PartyManager.java +++ b/src/main/java/xyz/nucleoid/parties/PartyManager.java @@ -3,6 +3,7 @@ import com.google.common.collect.Lists; import it.unimi.dsi.fastutil.objects.Object2ObjectMap; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents; import net.minecraft.server.MinecraftServer; import net.minecraft.server.network.ServerPlayerEntity; import org.jetbrains.annotations.Nullable; @@ -23,6 +24,11 @@ private PartyManager(MinecraftServer server) { } public static void register() { + ServerPlayConnectionEvents.DISCONNECT.register((handler, server) -> { + var partyManager = PartyManager.get(server); + partyManager.onPlayerLogOut(handler.player); + }); + GameEvents.COLLECT_PLAYERS_FOR_JOIN.register((gameSpace, player, additional) -> { var partyManager = PartyManager.get(player.server); diff --git a/src/main/java/xyz/nucleoid/parties/mixin/PlayerManagerMixin.java b/src/main/java/xyz/nucleoid/parties/mixin/PlayerManagerMixin.java deleted file mode 100644 index c378bba..0000000 --- a/src/main/java/xyz/nucleoid/parties/mixin/PlayerManagerMixin.java +++ /dev/null @@ -1,24 +0,0 @@ -package xyz.nucleoid.parties.mixin; - -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.PlayerManager; -import net.minecraft.server.network.ServerPlayerEntity; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import xyz.nucleoid.plasmid.party.PartyManager; - -@Mixin(PlayerManager.class) -public class PlayerManagerMixin { - @Shadow - @Final - private MinecraftServer server; - - @Inject(method = "remove", at = @At("RETURN")) - private void removePlayer(ServerPlayerEntity player, CallbackInfo ci) { - PartyManager.get(this.server).onPlayerLogOut(player); - } -} diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 3bbe671..faed2a5 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -10,7 +10,6 @@ "entrypoints": { "main": ["xyz.nucleoid.parties.GameParties"] }, - "mixins": ["game_parties.mixins.json"], "depends": { "fabricloader": ">=0.9.1", "fabric": "*", diff --git a/src/main/resources/game_parties.mixins.json b/src/main/resources/game_parties.mixins.json deleted file mode 100644 index 6ca9a3e..0000000 --- a/src/main/resources/game_parties.mixins.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "required": true, - "minVersion": "0.8", - "package": "xyz.nucleoid.parties.mixin", - "compatibilityLevel": "JAVA_16", - "mixins": [ - "PlayerManagerMixin" - ], - "injectors": { - "defaultRequire": 1 - } -}