-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
fabric/versions/1.20.2/src/main/java/cn/evole/mods/mcbot/init/mixins/MixinPlayerList.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package cn.evole.mods.mcbot.init.mixins; | ||
|
||
|
||
import cn.evole.mods.mcbot.init.callbacks.IEvents; | ||
import net.minecraft.network.Connection; | ||
import net.minecraft.server.level.ServerPlayer; | ||
import net.minecraft.server.network.CommonListenerCookie; | ||
import net.minecraft.server.players.PlayerList; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
/** | ||
* Author cnlimiter | ||
* CreateTime 2023/5/19 0:51 | ||
* Name MixinPlayerList | ||
* Description | ||
*/ | ||
|
||
@Mixin(value = PlayerList.class, priority = 1001) | ||
public abstract class MixinPlayerList { | ||
@Inject(method = "placeNewPlayer", at = @At(value = "TAIL")) | ||
public void PlayerList_placeNewPlayer(Connection connection, ServerPlayer player, CommonListenerCookie commonListenerCookie, CallbackInfo ci) { | ||
IEvents.PLAYER_LOGGED_IN.invoker().onPlayerLoggedIn(player.getCommandSenderWorld(), player); | ||
} | ||
|
||
@Inject(method = "remove", at = @At(value = "HEAD")) | ||
public void PlayerList_remove(ServerPlayer player, CallbackInfo ci) { | ||
IEvents.PLAYER_LOGGED_OUT.invoker().onPlayerLoggedOut(player.getCommandSenderWorld(), player); | ||
} | ||
} |