Exemplo n.º 1
0
 @Override
 public void load(DataKey key) throws NPCLoadException {
   if (key.keyExists("hand")) equipment[0] = ItemStorage.loadItemStack(key.getRelative("hand"));
   if (key.keyExists("helmet"))
     equipment[1] = ItemStorage.loadItemStack(key.getRelative("helmet"));
   if (key.keyExists("chestplate"))
     equipment[2] = ItemStorage.loadItemStack(key.getRelative("chestplate"));
   if (key.keyExists("leggings"))
     equipment[3] = ItemStorage.loadItemStack(key.getRelative("leggings"));
   if (key.keyExists("boots")) equipment[4] = ItemStorage.loadItemStack(key.getRelative("boots"));
 }
Exemplo n.º 2
0
 private void saveOrRemove(DataKey key, ItemStack item) {
   if (item != null) ItemStorage.saveItem(key, item);
   else {
     if (key.keyExists("")) key.removeKey("");
   }
 }