use of com.github.sirblobman.api.nms.ItemHandler in project CombatLogX by SirBlobman.
the class StoredInventory method loadItemStack.
@Nullable
private static ItemStack loadItemStack(CitizensExpansion expansion, ConfigurationSection section, String path) {
Validate.notNull(section, "section must not be null!");
Validate.notEmpty(path, "path must not be empty!");
if (!section.isSet(path)) {
return null;
}
if (!section.isString(path)) {
return null;
}
String value = section.getString(path);
if (value == null) {
return null;
}
ICombatLogX plugin = expansion.getPlugin();
MultiVersionHandler multiVersionHandler = plugin.getMultiVersionHandler();
ItemHandler itemHandler = multiVersionHandler.getItemHandler();
return itemHandler.fromBase64String(value);
}
use of com.github.sirblobman.api.nms.ItemHandler in project CombatLogX by SirBlobman.
the class StoredInventory method saveItemStack.
private static void saveItemStack(CitizensExpansion expansion, ConfigurationSection section, String path, ItemStack item) {
if (item == null) {
section.set(path, null);
return;
}
ICombatLogX plugin = expansion.getPlugin();
MultiVersionHandler multiVersionHandler = plugin.getMultiVersionHandler();
ItemHandler itemHandler = multiVersionHandler.getItemHandler();
String base64 = itemHandler.toBase64String(item);
section.set(path, base64);
}
Aggregations