예제 #1
0
파일: Coll.java 프로젝트: RFSMassacre/mcore
 // This is used in parallel with the isDefault.
 // Parallel usage is useful since we can then override isDeafult just like before.
 public static boolean isCustomDataDefault(Object entity) {
   if (!(entity instanceof Entity)) return true;
   JsonObject customData = ((Entity<?>) entity).getCustomData();
   if (customData == null) return true;
   if (customData.entrySet().size() == 0) return true;
   return false;
 }
예제 #2
0
 public static Map<Enchantment, Integer> convertEnchantLevelMap(JsonElement jsonElement) {
   JsonObject json = jsonElement.getAsJsonObject();
   Map<Enchantment, Integer> ret = new HashMap<Enchantment, Integer>();
   for (Entry<String, JsonElement> entry : json.entrySet()) {
     int id = Integer.valueOf(entry.getKey());
     Enchantment ench = Enchantment.getById(id);
     int lvl = entry.getValue().getAsInt();
     ret.put(ench, lvl);
   }
   return ret;
 }