{
EntityPlayerMP player1 = new EntityPlayerMP(FMLCommonHandler.instance().getMinecraftServerInstance(), DimensionManager.getWorld(0), EntityHelperBase.getSimpleGameProfileFromName(args[1]), new ItemInWorldManager(DimensionManager.getWorld(0)));
FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().readPlayerDataFromFile(player1);
if(Morph.proxy.tickHandlerServer.getMorphDataFromPlayer(player1).hasKey("morphData"))
{
MorphState state = Morph.proxy.tickHandlerServer.getSelfState(DimensionManager.getWorld(0), player1);
MorphInfo info = new MorphInfo(args[1], state, state);
info.morphProgress = 80;
info.healthOffset = Morph.proxy.tickHandlerServer.getMorphDataFromPlayer(player1).getDouble("healthOffset");
Morph.proxy.tickHandlerServer.getMorphDataFromPlayer(player1).removeTag("morphData");
PacketHandler.sendToAll(Morph.channels, info.getMorphInfoAsPacket());
Morph.proxy.tickHandlerServer.setPlayerMorphInfo(player1, null);
func_152373_a(icommandsender, this, "morph.command.forcingDemorph", args[1]);
//Workaround to force save.
FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().playerEntityList.add(player1);
FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().saveAllPlayerData();
FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().playerEntityList.remove(player1);
}
else
{
icommandsender.addChatMessage(new ChatComponentTranslation("morph.command.noMorphData", args[1]));
}
}
catch(Exception e)
{
icommandsender.addChatMessage(new ChatComponentTranslation("morph.command.cannotReadMorphData", args[1]));
}
}
else
{
icommandsender.addChatMessage(new ChatComponentTranslation("morph.command.notOnline", args[1]));
}
}
else if(args[0].equalsIgnoreCase("clear"))
{
EntityPlayer player;
if(args.length > 1)
{
player = PlayerSelector.matchOnePlayer(icommandsender, args[1]);
}
else
{
player = getCommandSenderAsPlayer(icommandsender);
}
if (player == null)
{
player = MinecraftServer.getServer().getConfigurationManager().func_152612_a(args[1]);
}
if(player != null)
{
MorphInfo info = Morph.proxy.tickHandlerServer.getPlayerMorphInfo(player);
MorphState state1;
MorphState state2 = Morph.proxy.tickHandlerServer.getSelfState(player.worldObj, player);
if(info != null)
{
state1 = info.nextState;
MorphInfo info2 = new MorphInfo(player.getCommandSenderName(), state1, state2);
info2.setMorphing(true);
info2.healthOffset = info.healthOffset;
info2.preMorphHealth = player.getHealth();
Morph.proxy.tickHandlerServer.setPlayerMorphInfo(player, info2);
PacketHandler.sendToAll(Morph.channels, info2.getMorphInfoAsPacket());
player.worldObj.playSoundAtEntity(player, "morph:morph", 1.0F, 1.0F);
}
Morph.proxy.tickHandlerServer.removeAllPlayerMorphsExcludingCurrentMorph(player);
MorphHandler.updatePlayerOfMorphStates((EntityPlayerMP)player, null, true);
func_152373_a(icommandsender, this, "morph.command.clearingMorphs", args[1]);
}
else
{
try
{
EntityPlayerMP player1 = new EntityPlayerMP(FMLCommonHandler.instance().getMinecraftServerInstance(), DimensionManager.getWorld(0), EntityHelperBase.getSimpleGameProfileFromName(args[1]), new ItemInWorldManager(DimensionManager.getWorld(0)));
FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().readPlayerDataFromFile(player1);
if(Morph.proxy.tickHandlerServer.getMorphDataFromPlayer(player1).hasKey("morphData"))
{
MorphState state = Morph.proxy.tickHandlerServer.getSelfState(DimensionManager.getWorld(0), player1);
MorphInfo info = new MorphInfo(args[1], state, state);
info.morphProgress = 80;
info.healthOffset = Morph.proxy.tickHandlerServer.getMorphDataFromPlayer(player1).getDouble("healthOffset");