diff --git a/api/src/main/java/me/bymartrixx/playerevents/api/mixin/PlayerManagerMixin.java b/api/src/main/java/me/bymartrixx/playerevents/api/mixin/PlayerManagerMixin.java index 8df09a8..7c05672 100644 --- a/api/src/main/java/me/bymartrixx/playerevents/api/mixin/PlayerManagerMixin.java +++ b/api/src/main/java/me/bymartrixx/playerevents/api/mixin/PlayerManagerMixin.java @@ -6,6 +6,7 @@ import net.minecraft.server.PlayerManager; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.stat.Stats; +import net.minecraft.unmapped.C_eyqfalbd; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -14,7 +15,7 @@ @Mixin(PlayerManager.class) public class PlayerManagerMixin { @Inject(at = @At(value = "TAIL"), method = "onPlayerConnect") - private void onPlayerJoin(ClientConnection connection, ServerPlayerEntity player, CallbackInfo info) { + private void onPlayerJoin(ClientConnection connection, ServerPlayerEntity player, C_eyqfalbd c_eyqfalbd, CallbackInfo ci) { PlayerJoinCallback.EVENT.invoker().joinServer(player, player.getServer()); if (player.getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(Stats.LEAVE_GAME)) < 1) { PlayerFirstJoinCallback.EVENT.invoker().joinServerForFirstTime(player, player.getServer()); diff --git a/api/src/main/java/me/bymartrixx/playerevents/api/mixin/ServerPlayNetworkHandlerMixin.java b/api/src/main/java/me/bymartrixx/playerevents/api/mixin/ServerPlayNetworkHandlerMixin.java index 9c7893a..61c041d 100644 --- a/api/src/main/java/me/bymartrixx/playerevents/api/mixin/ServerPlayNetworkHandlerMixin.java +++ b/api/src/main/java/me/bymartrixx/playerevents/api/mixin/ServerPlayNetworkHandlerMixin.java @@ -2,7 +2,6 @@ import me.bymartrixx.playerevents.api.event.CommandExecutionCallback; import me.bymartrixx.playerevents.api.event.PlayerLeaveCallback; -import net.minecraft.network.message.MessageSignatureList; import net.minecraft.network.packet.c2s.play.ChatCommandC2SPacket; import net.minecraft.server.network.ServerPlayNetworkHandler; import net.minecraft.server.network.ServerPlayerEntity; @@ -13,23 +12,21 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import java.util.Optional; - @Mixin(ServerPlayNetworkHandler.class) -@SuppressWarnings({"MixinAnnotationTarget", "UnresolvedMixinReference"}) +//don't want to suppress those warnings, custom commands actually don't work public class ServerPlayNetworkHandlerMixin { @Shadow public ServerPlayerEntity player; // Just after the command is executed // 1.20 - @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerPlayNetworkHandler;checkForSpam()V"), - method = "method_44356(Lnet/minecraft/class_7472;Ljava/util/Optional;)V", require = 0) - private void onCommandExecuted(ChatCommandC2SPacket packet, Optional optional, CallbackInfo ci) { + @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/server/MinecraftServer;submit(Ljava/lang/Runnable;)Ljava/util/concurrent/CompletableFuture;", shift = At.Shift.AFTER), + method = "onChatCommand(Lnet/minecraft/network/packet/c2s/play/ChatCommandC2SPacket;)V") + private void onCommandExecuted(ChatCommandC2SPacket packet, CallbackInfo ci) { CommandExecutionCallback.EVENT.invoker().onExecuted(packet.command(), this.player.getCommandSource()); } - @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerPlayerEntity;onDisconnect()V"), method = "onDisconnected") + @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/network/listener/AbstractServerPacketHandler;onDisconnected(Lnet/minecraft/text/Text;)V"), method = "onDisconnected") private void onPlayerLeave(Text reason, CallbackInfo info) { PlayerLeaveCallback.EVENT.invoker().leaveServer(this.player, this.player.getServer()); } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 91103fe..a09d793 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,10 +1,10 @@ [versions] -minecraft = "1.20.1" -quilt_mappings = "1.20.1+build.11" -fabric_loader = "0.14.21" +minecraft = "1.20.2" +quilt_mappings = "1.20.2+build.1" +fabric_loader = "0.14.22" -fabric_api = "0.85.0+1.20.1" -placeholder_api = "2.1.2+1.20.1" +fabric_api = "0.89.2+1.20.2" +placeholder_api = "2.2.0+1.20.2" [libraries] minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" }