Sync mail to client on login, do not display mail indicator on logout

This commit is contained in:
mezz committed 2015-12-12 17:45:12 -08:00
1 parent d0c8c92863
commit e2f32ab767
8 files changed
+31 -70

No files matched your search

@@ -14,8 +14,7 @@ import forestry.core.network.PacketRegistry;
import forestry.mail.network.packets.PacketLetterInfoRequest;
import forestry.mail.network.packets.PacketLetterInfoResponse;
import forestry.mail.network.packets.PacketLetterTextSet;
import forestry.mail.network.packets.PacketPOBoxInfoRequest;
import forestry.mail.network.packets.PacketPOBoxInfoResponse;
import forestry.mail.network.packets.PacketPOBoxInfoUpdate;
import forestry.mail.network.packets.PacketTraderAddressRequest;
import forestry.mail.network.packets.PacketTraderAddressResponse;
@@ -24,11 +23,10 @@ public class PacketRegistryMail extends PacketRegistry {
public void registerPackets() {
registerServerPacket(new PacketLetterInfoRequest());
registerServerPacket(new PacketTraderAddressRequest());
registerServerPacket(new PacketPOBoxInfoRequest());
registerServerPacket(new PacketLetterTextSet());
registerClientPacket(new PacketLetterInfoResponse());
registerClientPacket(new PacketTraderAddressResponse());
registerClientPacket(new PacketPOBoxInfoResponse());
registerClientPacket(new PacketPOBoxInfoUpdate());
}
}
@@ -1,44 +0,0 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.mail.network.packets;
import java.io.IOException;
import net.minecraft.entity.player.EntityPlayerMP;
import forestry.core.network.DataInputStreamForestry;
import forestry.core.network.ForestryPacket;
import forestry.core.network.IForestryPacketServer;
import forestry.core.network.PacketIdServer;
import forestry.core.proxy.Proxies;
import forestry.mail.MailAddress;
import forestry.mail.POBox;
import forestry.mail.PostRegistry;
public class PacketPOBoxInfoRequest extends ForestryPacket implements IForestryPacketServer {
public PacketPOBoxInfoRequest() {
}
@Override
public PacketIdServer getPacketId() {
return PacketIdServer.POBOX_INFO_REQUEST;
}
@Override
public void onPacketData(DataInputStreamForestry data, EntityPlayerMP player) throws IOException {
MailAddress address = new MailAddress(player.getGameProfile());
POBox pobox = PostRegistry.getOrCreatePOBox(player.worldObj, address);
if (pobox != null) {
Proxies.net.sendToPlayer(new PacketPOBoxInfoResponse(pobox.getPOBoxInfo()), player);
}
}
}
@@ -22,14 +22,14 @@ import forestry.core.network.PacketIdClient;
import forestry.mail.POBoxInfo;
import forestry.mail.gui.GuiMailboxInfo;
public class PacketPOBoxInfoResponse extends ForestryPacket implements IForestryPacketClient {
public class PacketPOBoxInfoUpdate extends ForestryPacket implements IForestryPacketClient {
public POBoxInfo poboxInfo;
public PacketPOBoxInfoResponse() {
public PacketPOBoxInfoUpdate() {
}
public PacketPOBoxInfoResponse(POBoxInfo info) {
public PacketPOBoxInfoUpdate(POBoxInfo info) {
this.poboxInfo = info;
}