@Override public void onPlayerLogin(EntityPlayer receiver) { this.par1player = (Player) receiver; getData(receiver); if (receiver.username == "aginsun") { gold.addGold(receiver, 150000); worthy.addWorthy(receiver, 15000F); } PacketDispatcher.sendPacketToPlayer( PacketType.populatePacket(new PacketGold(receiver.username, gold.getGoldTotal(receiver))), par1player); PacketDispatcher.sendPacketToPlayer( PacketType.populatePacket(new PacketWorthy(receiver.username, worthy.getWorthy(receiver))), par1player); }
@Override public ItemStack getStackInSlot(int i) { int j = 0; if (inventory[i] != null) { for (int k = 0; k < inventory[i].stackSize; k++) { Item item = inventory[i].getItem(); String s = item.getItemName(); FMLLog.fine(s); j = goldvalues.PriceItem(s); if (FMLCommonHandler.instance().getEffectiveSide().isServer()) gold.addGold(setPlayerName(player), j); this.par1player = (Player) player; PacketDispatcher.sendPacketToPlayer( PacketType.populatePacket(new PacketGold(player.username, gold.getGoldTotal(player))), par1player); } if (j != 0) { inventory[i] = null; } } return inventory[i]; }
public void getData(EntityPlayer player) { if (player != null) { data = player.getEntityData().getCompoundTag(player.PERSISTED_NBT_TAG); if (data.hasKey("GoldTotal")) { int i = data.getInteger("GoldTotal"); gold.setGold(player, i); } if (data.hasKey("Worthy")) ; { float j = data.getFloat("Worthy"); worthy.setWorthy(player, j); } } }
public void SetData(EntityPlayer player) { data = player.getEntityData().getCompoundTag(player.PERSISTED_NBT_TAG); data.setInteger("GoldTotal", gold.getGoldTotal(player)); data.setFloat("Worthy", worthy.getWorthy(player)); player.getEntityData().setCompoundTag(player.PERSISTED_NBT_TAG, data); }