use of net.blay09.mods.waystones.network.message.MessageConfig in project Waystones by blay09.
the class CommonProxy method onPlayerLoggedIn.
@SubscribeEvent
public void onPlayerLoggedIn(PlayerEvent.PlayerLoggedInEvent event) {
GlobalWaystones globalWaystones = GlobalWaystones.get(event.player.world);
PlayerWaystoneData waystoneData = PlayerWaystoneData.fromPlayer(event.player);
List<WaystoneEntry> validWaystones = Lists.newArrayList();
for (WaystoneEntry waystone : waystoneData.getWaystones()) {
if (waystone.isGlobal()) {
if (globalWaystones.getGlobalWaystone(waystone.getName()) == null) {
continue;
}
}
validWaystones.add(waystone);
}
for (WaystoneEntry waystone : globalWaystones.getGlobalWaystones()) {
if (!validWaystones.contains(waystone)) {
validWaystones.add(waystone);
}
}
PlayerWaystoneHelper.store(event.player, validWaystones.toArray(new WaystoneEntry[validWaystones.size()]), waystoneData.getLastFreeWarp(), waystoneData.getLastWarpStoneUse());
NetworkHandler.channel.sendTo(new MessageConfig(), (EntityPlayerMP) event.player);
WaystoneManager.sendPlayerWaystones(event.player);
}
Aggregations