2013-02-18 03:46:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
package StevenDimDoors.mod_pocketDim;
|
|
|
|
|
2013-05-27 14:10:07 +02:00
|
|
|
|
2013-02-18 03:46:16 +01:00
|
|
|
import net.minecraft.entity.item.EntityItem;
|
2013-05-27 14:10:07 +02:00
|
|
|
|
2013-02-18 03:46:16 +01:00
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
2013-05-27 14:10:07 +02:00
|
|
|
import net.minecraft.item.ItemArmor;
|
2013-02-18 03:46:16 +01:00
|
|
|
import cpw.mods.fml.common.IPlayerTracker;
|
|
|
|
|
|
|
|
|
|
|
|
public class PlayerRespawnTracker implements IPlayerTracker
|
|
|
|
{
|
2013-06-14 01:01:54 +02:00
|
|
|
public PlayerRespawnTracker()
|
|
|
|
{
|
|
|
|
if (properties == null)
|
|
|
|
properties = DDProperties.instance();
|
|
|
|
}
|
2013-02-18 03:46:16 +01:00
|
|
|
|
2013-06-14 01:01:54 +02:00
|
|
|
private static DDProperties properties = null;
|
2013-02-18 03:46:16 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onPlayerLogin(EntityPlayer player) {
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onPlayerLogout(EntityPlayer player) {
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onPlayerChangedDimension(EntityPlayer player) {
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onPlayerRespawn(EntityPlayer player)
|
|
|
|
{
|
2013-06-14 01:01:54 +02:00
|
|
|
if(player.worldObj.provider.dimensionId==properties.LimboDimensionID)
|
2013-02-18 03:46:16 +01:00
|
|
|
{
|
|
|
|
|
2013-06-14 01:01:54 +02:00
|
|
|
if(!player.worldObj.isRemote && properties.LimboReturnsInventoryEnabled)
|
2013-02-18 03:46:16 +01:00
|
|
|
{
|
|
|
|
|
2013-04-14 03:15:06 +02:00
|
|
|
if(player.username!=null)
|
2013-02-18 03:46:16 +01:00
|
|
|
{
|
|
|
|
|
2013-04-14 03:15:06 +02:00
|
|
|
if(!mod_pocketDim.limboSpawnInventory.isEmpty()&&mod_pocketDim.limboSpawnInventory.containsKey(player.username))
|
|
|
|
{
|
|
|
|
for(EntityItem drop : mod_pocketDim.limboSpawnInventory.get(player.username))
|
|
|
|
{
|
2013-05-27 14:10:07 +02:00
|
|
|
if(drop.getEntityItem().getItem() instanceof ItemArmor)
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2013-04-14 03:15:06 +02:00
|
|
|
player.inventory.addItemStackToInventory(drop.getEntityItem());
|
2013-02-18 03:46:16 +01:00
|
|
|
|
|
|
|
|
2013-04-14 03:15:06 +02:00
|
|
|
}
|
|
|
|
}
|
2013-02-18 03:46:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|