Search in sources :

Example 1 with IMixinServerScoreboard

use of org.spongepowered.common.interfaces.IMixinServerScoreboard in project SpongeCommon by SpongePowered.

the class MixinPlayerList method onPlayerLogOut.

@Inject(method = "playerLoggedOut(Lnet/minecraft/entity/player/EntityPlayerMP;)V", at = @At("HEAD"))
private void onPlayerLogOut(EntityPlayerMP player, CallbackInfo ci) {
    // Synchronise with user object
    NBTTagCompound nbt = new NBTTagCompound();
    player.writeToNBT(nbt);
    ((SpongeUser) ((IMixinEntityPlayerMP) player).getUserObject()).readFromNbt(nbt);
    // Remove player reference from scoreboard
    ((IMixinServerScoreboard) ((Player) player).getScoreboard()).removePlayer(player, false);
}
Also used : IMixinServerScoreboard(org.spongepowered.common.interfaces.IMixinServerScoreboard) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) SpongeUser(org.spongepowered.common.entity.player.SpongeUser) Inject(org.spongepowered.asm.mixin.injection.Inject)

Aggregations

NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 Inject (org.spongepowered.asm.mixin.injection.Inject)1 SpongeUser (org.spongepowered.common.entity.player.SpongeUser)1 IMixinServerScoreboard (org.spongepowered.common.interfaces.IMixinServerScoreboard)1