11package net .set .spawn .mod .mixin ;
22
3- import net .minecraft .network .ClientConnection ;
43import net .minecraft .server .PlayerManager ;
54import net .minecraft .server .network .ServerPlayerEntity ;
65import net .minecraft .text .Text ;
76import net .set .spawn .mod .SetSpawn ;
87import org .spongepowered .asm .mixin .Mixin ;
98import org .spongepowered .asm .mixin .injection .At ;
10- import org .spongepowered .asm .mixin .injection .Inject ;
11- import org .spongepowered .asm .mixin .injection .callback .CallbackInfo ;
9+ import org .spongepowered .asm .mixin .injection .Redirect ;
1210
1311@ Mixin (PlayerManager .class )
1412public class PlayerManagerMixin {
15-
16- @ Inject (method = "onPlayerConnect" , at = @ At ("TAIL" ))
17- public void onPlayerConnect (ClientConnection connection , ServerPlayerEntity player , CallbackInfo ci ) {
13+ @ Redirect (
14+ method = {
15+ "Lnet/minecraft/server/PlayerManager;onPlayerConnect(Lnet/minecraft/network/ClientConnection;Lnet/minecraft/server/network/ServerPlayerEntity;)V" ,
16+ "Lnet/minecraft/server/PlayerManager;onPlayerConnect(Lnet/minecraft/network/ClientConnection;Lnet/minecraft/server/network/ServerPlayerEntity;I)V"
17+ },
18+ at = @ At (value = "INVOKE" , target = "Lnet/minecraft/server/network/ServerPlayerEntity;onSpawn()V" ),
19+ require = 0
20+ )
21+ private void onPlayerConnect (ServerPlayerEntity player ) {
22+ player .onSpawn ();
1823 if (SetSpawn .shouldSendErrorMessage ) {
1924 Text message = Text .of ("§c" + SetSpawn .errorMessage + " This run is not verifiable." );
2025 player .sendMessage (message , false );
2126 }
2227 SetSpawn .shouldSendErrorMessage = false ;
2328 }
24-
2529}
0 commit comments