2014-06-22 16:50:31 +02:00
|
|
|
package com.pahimar.ee3.handler;
|
|
|
|
|
2014-06-26 21:19:59 +02:00
|
|
|
import com.pahimar.ee3.reference.Settings;
|
2014-06-22 16:50:31 +02:00
|
|
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
|
|
|
import net.minecraftforge.event.entity.player.PlayerEvent;
|
|
|
|
|
2014-06-22 20:03:30 +02:00
|
|
|
import java.io.File;
|
|
|
|
import java.io.IOException;
|
|
|
|
|
2014-06-22 16:50:31 +02:00
|
|
|
public class PlayerEventHandler
|
|
|
|
{
|
|
|
|
@SubscribeEvent
|
2014-06-26 21:19:59 +02:00
|
|
|
public void onPlayerLoadFromFileEvent(PlayerEvent.LoadFromFile event)
|
2014-06-22 16:50:31 +02:00
|
|
|
{
|
2014-06-26 21:19:59 +02:00
|
|
|
if (!event.entityPlayer.worldObj.isRemote)
|
2014-06-22 20:03:30 +02:00
|
|
|
{
|
2014-06-26 21:19:59 +02:00
|
|
|
if (Settings.PLAYER_DAT_LOCATION == null || Settings.PLAYER_DAT_LOCATION.length() == 0 || !Settings.PLAYER_DAT_LOCATION.equalsIgnoreCase(event.playerDirectory.getPath()))
|
2014-06-22 20:03:30 +02:00
|
|
|
{
|
2014-06-26 21:19:59 +02:00
|
|
|
Settings.PLAYER_DAT_LOCATION = event.playerDirectory.getPath();
|
2014-06-22 20:03:30 +02:00
|
|
|
}
|
2014-06-26 21:19:59 +02:00
|
|
|
|
|
|
|
File playerFile = event.getPlayerFile("ee3");
|
|
|
|
if (!playerFile.exists())
|
2014-06-22 20:03:30 +02:00
|
|
|
{
|
2014-06-26 21:19:59 +02:00
|
|
|
try
|
|
|
|
{
|
|
|
|
playerFile.createNewFile();
|
|
|
|
}
|
|
|
|
catch (IOException e)
|
|
|
|
{
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
2014-06-22 20:03:30 +02:00
|
|
|
}
|
|
|
|
}
|
2014-06-22 16:50:31 +02:00
|
|
|
}
|
|
|
|
}
|