mirror of https://github.com/webbukkit/dynmap.git
32 lines
1.4 KiB
Java
32 lines
1.4 KiB
Java
package org.dynmap.fabric_1_20_4.mixin;
|
|
|
|
import net.minecraft.network.ClientConnection;
|
|
import net.minecraft.server.PlayerManager;
|
|
import net.minecraft.server.network.ConnectedClientData;
|
|
import net.minecraft.server.network.ServerPlayerEntity;
|
|
|
|
import org.dynmap.fabric_1_20_4.event.PlayerEvents;
|
|
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;
|
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|
|
|
@Mixin(PlayerManager.class)
|
|
public class PlayerManagerMixin {
|
|
@Inject(method = "onPlayerConnect", at = @At("TAIL"))
|
|
public void onPlayerConnect(ClientConnection connection, ServerPlayerEntity player, ConnectedClientData ccd, CallbackInfo info) {
|
|
PlayerEvents.PLAYER_LOGGED_IN.invoker().onPlayerLoggedIn(player);
|
|
}
|
|
|
|
@Inject(method = "remove", at = @At("HEAD"))
|
|
public void remove(ServerPlayerEntity player, CallbackInfo info) {
|
|
PlayerEvents.PLAYER_LOGGED_OUT.invoker().onPlayerLoggedOut(player);
|
|
}
|
|
|
|
@Inject(method = "respawnPlayer", at = @At("RETURN"))
|
|
public void respawnPlayer(ServerPlayerEntity player, boolean alive, CallbackInfoReturnable<ServerPlayerEntity> info) {
|
|
PlayerEvents.PLAYER_RESPAWN.invoker().onPlayerRespawn(info.getReturnValue());
|
|
}
|
|
}
|