Search in sources :

Example 1 with PlayerProvider

use of kingdoms.server.PlayerProvider in project Tale-of-Kingdoms by Ivasik78.

the class SPacketBank method server.

@Override
public void server(EntityPlayerMP player) {
    PlayerProvider provider = PlayerProvider.get(player);
    int count = buf().readShort();
    boolean deposit = buf().readBoolean();
    if (deposit) {
        if (provider.getGoldTotal() >= count) {
            provider.addBankGold(count);
            provider.decreaseGold(count);
        }
    } else {
        if (provider.getBankGold() >= count) {
            provider.addGold(count);
            provider.decreaseBankGold(count, player);
        }
    }
}
Also used : PlayerProvider(kingdoms.server.PlayerProvider)

Example 2 with PlayerProvider

use of kingdoms.server.PlayerProvider in project Tale-of-Kingdoms by Ivasik78.

the class SPacketWarden method server.

@Override
public void server(EntityPlayerMP player) {
    PlayerProvider provider = PlayerProvider.get(player);
    if (provider.getGoldTotal() >= 1000) {
        EntityLiving entity = (EntityLiving) UltimateHelper.INSTANCE.getEntity(ByteBufUtils.readUTF8String(buf()), player.worldObj);
        entity.setLocationAndAngles(player.posX, player.posY, player.posZ, 0.0F, 0.0F);
        player.worldObj.spawnEntityInWorld(entity);
        PlayerProvider.get(player).decreaseGold(1000);
    }
}
Also used : EntityLiving(net.minecraft.entity.EntityLiving) PlayerProvider(kingdoms.server.PlayerProvider)

Example 3 with PlayerProvider

use of kingdoms.server.PlayerProvider in project Tale-of-Kingdoms by Ivasik78.

the class CPacketSyncBank method client.

@Override
public void client(EntityPlayer player) {
    PlayerProvider provider = PlayerProvider.get(player);
    int count = buf().readInt();
    boolean bank = buf().readBoolean();
    if (bank) {
        provider.setBankGold(count);
    } else {
        provider.setGoldTotal(count);
    }
}
Also used : PlayerProvider(kingdoms.server.PlayerProvider)

Aggregations

PlayerProvider (kingdoms.server.PlayerProvider)3 EntityLiving (net.minecraft.entity.EntityLiving)1