2014-06-22 16:50:31 +02:00
|
|
|
package com.pahimar.ee3.handler;
|
|
|
|
|
2023-01-03 17:47:36 +01:00
|
|
|
import static com.pahimar.ee3.api.blacklist.BlacklistRegistryProxy.Blacklist;
|
|
|
|
|
2014-09-04 17:30:22 +02:00
|
|
|
import com.pahimar.ee3.network.PacketHandler;
|
2015-02-25 06:03:59 +01:00
|
|
|
import com.pahimar.ee3.network.message.MessageChalkSettings;
|
2016-05-25 05:12:49 +02:00
|
|
|
import com.pahimar.ee3.network.message.MessageSyncBlacklist;
|
2014-09-11 22:13:39 +02:00
|
|
|
import com.pahimar.ee3.network.message.MessageSyncEnergyValues;
|
2015-02-25 06:03:59 +01:00
|
|
|
import com.pahimar.ee3.settings.ChalkSettings;
|
|
|
|
import com.pahimar.ee3.util.EntityHelper;
|
2014-06-22 16:50:31 +02:00
|
|
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
2014-09-04 17:30:22 +02:00
|
|
|
import net.minecraft.entity.player.EntityPlayerMP;
|
2015-02-25 06:03:59 +01:00
|
|
|
import net.minecraft.nbt.NBTTagCompound;
|
2014-06-22 16:50:31 +02:00
|
|
|
|
2016-05-22 19:21:46 +02:00
|
|
|
public class PlayerEventHandler {
|
2015-01-29 16:50:38 +01:00
|
|
|
@SubscribeEvent
|
2023-01-03 17:47:36 +01:00
|
|
|
public void
|
|
|
|
onPlayerLoggedIn(cpw.mods.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent event
|
|
|
|
) {
|
2016-05-22 19:21:46 +02:00
|
|
|
if (event.player != null) {
|
2023-01-03 17:47:36 +01:00
|
|
|
NBTTagCompound playerCustomData
|
|
|
|
= EntityHelper.getCustomEntityData(event.player);
|
2015-02-25 06:03:59 +01:00
|
|
|
|
|
|
|
// Chalk Settings
|
|
|
|
ChalkSettings chalkSettings = new ChalkSettings();
|
|
|
|
chalkSettings.readFromNBT(playerCustomData);
|
|
|
|
chalkSettings.writeToNBT(playerCustomData);
|
|
|
|
EntityHelper.saveCustomEntityData(event.player, playerCustomData);
|
2023-01-03 17:47:36 +01:00
|
|
|
PacketHandler.INSTANCE.sendTo(
|
|
|
|
new MessageChalkSettings(chalkSettings), (EntityPlayerMP) event.player
|
|
|
|
);
|
2015-02-25 06:03:59 +01:00
|
|
|
|
2023-01-03 17:47:36 +01:00
|
|
|
PacketHandler.INSTANCE.sendTo(
|
|
|
|
new MessageSyncEnergyValues(), (EntityPlayerMP) event.player
|
|
|
|
);
|
|
|
|
PacketHandler.INSTANCE.sendTo(
|
|
|
|
new MessageSyncBlacklist(Blacklist.KNOWLEDGE),
|
|
|
|
(EntityPlayerMP) event.player
|
|
|
|
);
|
|
|
|
PacketHandler.INSTANCE.sendTo(
|
|
|
|
new MessageSyncBlacklist(Blacklist.EXCHANGE),
|
|
|
|
(EntityPlayerMP) event.player
|
|
|
|
);
|
2015-02-25 06:03:59 +01:00
|
|
|
}
|
2015-02-05 05:48:07 +01:00
|
|
|
}
|
2014-06-22 16:50:31 +02:00
|
|
|
}
|