return out;
}
Data data = new Data();
PlayerInfo pi = PlayerInfo.getPlayerInfo(player.getPersistentID());
if (sendHome)
{
data.home = pi.getHome();
data.back = pi.getLastTeleportOrigin();
}
if (sendArmorAndHealth)
{
data.armor = player.inventory.getTotalArmorValue();
data.health = player.getHealth();
}
if (sendMoney)
{
data.money = APIRegistry.wallet.getWallet(player.getPersistentID());
}
if (sendPosition)
{
data.position = new WarpPoint(player);
}
data.ping = player.ping;
data.gameMode = player.theItemInWorldManager.getGameType().getName();
if (!player.getActivePotionEffects().isEmpty() && sendPotions)
{
@SuppressWarnings("unchecked")
Collection<PotionEffect> effects = player.getActivePotionEffects();
data.potions = new ArrayList<String>(effects.size());
for (PotionEffect effect : effects)
{
String name = StatCollector.translateToLocal(Potion.potionTypes[effect.getPotionID()].getName());
switch(effect.getAmplifier())
{
case 1:
name += " II";
break;
case 2:
name += " III";
break;
case 3:
name += " IV";
break;
}
data.potions.add(name);
}
}
if (sendXP)
{
data.xp = new XP();
data.xp.lvl = player.experienceLevel;
data.xp.bar = player.experience;
}
if (sendFood)
{
data.foodStats = new FoodStats();
data.foodStats.food = player.getFoodStats().getFoodLevel();
data.foodStats.saturation = player.getFoodStats().getSaturationLevel();
}
if (sendCapabilities)
{
data.capabilities = new Capabilities();
data.capabilities.allowEdit = player.capabilities.allowEdit;
data.capabilities.allowFlying = player.capabilities.allowFlying;
data.capabilities.isFlying = player.capabilities.isFlying;
data.capabilities.disableDamage = player.capabilities.disableDamage;
}
data.group = APIRegistry.perms.getPrimaryGroup(new UserIdent(player));
data.firstJoin = pi.getFirstJoin();
data.timePlayed = pi.getTimePlayed();
return GSON.toJsonTree(data);
}