コード例 #1
0
 @Override
 public void onDeath(DamageSource par1DamageSource) {
   super.onDeath(par1DamageSource);
   if (par1DamageSource.getEntity() instanceof EntityPlayerMP)
     ((EntityPlayerMP) par1DamageSource.getEntity())
         .triggerAchievement(TragicAchievements.overlord2);
   List<EntityPlayerMP> list =
       this.worldObj.getEntitiesWithinAABB(
           EntityPlayerMP.class, this.getEntityBoundingBox().expand(24.0, 24.0, 24.0));
   if (!list.isEmpty()) {
     for (EntityPlayerMP mp : list) {
       mp.triggerAchievement(TragicAchievements.overlord2);
     }
   }
 }
コード例 #2
0
  /**
   * Called when a player disconnects from the game. Writes player data to disk and removes them
   * from the world.
   */
  public void playerLoggedOut(EntityPlayerMP playerIn) {
    playerIn.triggerAchievement(StatList.leaveGameStat);
    this.writePlayerData(playerIn);
    WorldServer var2 = playerIn.getServerForPlayer();

    if (playerIn.ridingEntity != null) {
      var2.removePlayerEntityDangerously(playerIn.ridingEntity);
      logger.debug("removing player mount");
    }

    var2.removeEntity(playerIn);
    var2.getPlayerManager().removePlayer(playerIn);
    this.playerEntityList.remove(playerIn);
    this.field_177454_f.remove(playerIn.getUniqueID());
    this.playerStatFiles.remove(playerIn.getUniqueID());
    this.sendPacketToAllPlayers(
        new S38PacketPlayerListItem(
            S38PacketPlayerListItem.Action.REMOVE_PLAYER, new EntityPlayerMP[] {playerIn}));
  }