Search in sources :

Example 1 with PacketPOBoxInfo

use of forestry.mail.network.PacketPOBoxInfo in project ForestryMC by ForestryMC.

the class PacketHandlerMail method onPacketData.

@Override
public boolean onPacketData(int packetID, DataInputStream data, EntityPlayer player) throws IOException {
    PacketUpdate packet;
    switch(packetID) {
        case PacketIds.LETTER_INFO:
            PacketLetterInfo packetT = new PacketLetterInfo();
            packetT.readData(data);
            onLetterInfo(packetT);
            return true;
        case PacketIds.POBOX_INFO:
            PacketPOBoxInfo packetP = new PacketPOBoxInfo();
            packetP.readData(data);
            onPOBoxInfo(packetP);
            return true;
        case PacketIds.LETTER_RECIPIENT:
            packet = new PacketUpdate();
            packet.readData(data);
            onLetterRecipient(player, packet);
            return true;
        case PacketIds.LETTER_TEXT:
            packet = new PacketUpdate();
            packet.readData(data);
            onLetterText(player, packet);
            return true;
        case PacketIds.TRADING_ADDRESS_SET:
            packet = new PacketUpdate();
            packet.readData(data);
            onAddressSet(player, packet);
            return true;
        case PacketIds.POBOX_INFO_REQUEST:
            onPOBoxInfoRequest(player);
            return true;
    }
    return false;
}
Also used : PacketPOBoxInfo(forestry.mail.network.PacketPOBoxInfo) PacketUpdate(forestry.core.network.PacketUpdate) PacketLetterInfo(forestry.mail.network.PacketLetterInfo)

Example 2 with PacketPOBoxInfo

use of forestry.mail.network.PacketPOBoxInfo in project ForestryMC by ForestryMC.

the class PacketHandlerMail method onPOBoxInfoRequest.

private void onPOBoxInfoRequest(EntityPlayer player) {
    MailAddress address = new MailAddress(player.getGameProfile());
    POBox pobox = PostRegistry.getPOBox(player.worldObj, address);
    if (pobox == null) {
        return;
    }
    Proxies.net.sendToPlayer(new PacketPOBoxInfo(PacketIds.POBOX_INFO, pobox.getPOBoxInfo()), player);
}
Also used : PacketPOBoxInfo(forestry.mail.network.PacketPOBoxInfo)

Aggregations

PacketPOBoxInfo (forestry.mail.network.PacketPOBoxInfo)2 PacketUpdate (forestry.core.network.PacketUpdate)1 PacketLetterInfo (forestry.mail.network.PacketLetterInfo)1