Package com.massivecraft.mcore.xlib.gson

Examples of com.massivecraft.mcore.xlib.gson.JsonObject.addProperty()


    ItemStack[] itemStacks = src.getContents();
   
    if (src instanceof PlayerInventory)
    {
      // Add the size "player"
      jsonInventory.addProperty(SIZE, PLAYER);
     
      // Cast to PlayerInventory
      PlayerInventory psrc = (PlayerInventory)src;
     
      // helmet
View Full Code Here


      }
    }
    else
    {
      // Add the size *length*
      jsonInventory.addProperty(SIZE, itemStacks.length);
    }
   
    // Add the content at the end since we like to have it at the bottom of return json.
    for (int i = 0; i < itemStacks.length; i++)
    {
View Full Code Here

    }

    // Otherwise object
    JsonObject obj = new JsonObject();
   
    obj.addProperty(HOST_FACTION_ID, src.getHostFactionId());
   
    if (!src.isHostFactionAllowed())
    {
      obj.addProperty(HOST_FACTION_ALLOWED, src.isHostFactionAllowed());
    }
View Full Code Here

   
    obj.addProperty(HOST_FACTION_ID, src.getHostFactionId());
   
    if (!src.isHostFactionAllowed())
    {
      obj.addProperty(HOST_FACTION_ALLOWED, src.isHostFactionAllowed());
    }
   
    if (!src.getFactionIds().isEmpty())
    {
      obj.add(FACTION_IDS, context.serialize(src.getFactionIds(), SET_OF_STRING_TYPE));
View Full Code Here

    }
   
    JsonObject ret = new JsonObject();
   
    String type = src.getClass().getCanonicalName();
    ret.addProperty(TYPE, type);
   
    JsonElement value = context.serialize(src);
    ret.add(VALUE, value);
   
    return ret;
View Full Code Here

  {
    if (potionEffect == null) return null;
   
    JsonObject ret = new JsonObject();
   
    ret.addProperty(POTION_EFFECT_ID, potionEffect.getType().getId());
    ret.addProperty(POTION_DURATION, potionEffect.getDuration());
    ret.addProperty(POTION_AMPLIFIER, potionEffect.getAmplifier());
    ret.addProperty(POTION_AMBIENT, potionEffect.isAmbient());
   
    return ret;
View Full Code Here

    if (potionEffect == null) return null;
   
    JsonObject ret = new JsonObject();
   
    ret.addProperty(POTION_EFFECT_ID, potionEffect.getType().getId());
    ret.addProperty(POTION_DURATION, potionEffect.getDuration());
    ret.addProperty(POTION_AMPLIFIER, potionEffect.getAmplifier());
    ret.addProperty(POTION_AMBIENT, potionEffect.isAmbient());
   
    return ret;
  }
View Full Code Here

   
    JsonObject ret = new JsonObject();
   
    ret.addProperty(POTION_EFFECT_ID, potionEffect.getType().getId());
    ret.addProperty(POTION_DURATION, potionEffect.getDuration());
    ret.addProperty(POTION_AMPLIFIER, potionEffect.getAmplifier());
    ret.addProperty(POTION_AMBIENT, potionEffect.isAmbient());
   
    return ret;
  }
 
View Full Code Here

    JsonObject ret = new JsonObject();
   
    ret.addProperty(POTION_EFFECT_ID, potionEffect.getType().getId());
    ret.addProperty(POTION_DURATION, potionEffect.getDuration());
    ret.addProperty(POTION_AMPLIFIER, potionEffect.getAmplifier());
    ret.addProperty(POTION_AMBIENT, potionEffect.isAmbient());
   
    return ret;
  }
 
  // -------------------------------------------- //
View Full Code Here

  public static JsonObject convertEnchantLevelMap(Map<Enchantment, Integer> enchantLevelMap)
  {
    JsonObject ret = new JsonObject();
    for (Entry<Enchantment, Integer> entry : enchantLevelMap.entrySet())
    {
      ret.addProperty(String.valueOf(entry.getKey().getId()), entry.getValue());
    }
    return ret;
  }
 
  public static Map<Enchantment, Integer> convertEnchantLevelMap(JsonElement jsonElement)
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.