MCPcopy Create free account
hub / github.com/Teneted/Tenet / serialize

Method serialize

src/main/java/org/bukkit/inventory/ItemStack.java:451–470  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

449 }
450
451 @Override
452 @NotNull
453 @Utility
454 public Map<String, Object> serialize() {
455 Map<String, Object> result = new LinkedHashMap<String, Object>();
456
457 result.put("v", Bukkit.getUnsafe().getDataVersion()); // Include version to indicate we are using modern material names (or LEGACY prefix)
458 result.put("type", getType().name());
459
460 if (getAmount() != 1) {
461 result.put("amount", getAmount());
462 }
463
464 ItemMeta meta = getItemMeta();
465 if (!Bukkit.getItemFactory().equals(meta, null)) {
466 result.put("meta", meta);
467 }
468
469 return result;
470 }
471
472 /**
473 * Required method for configuration serialization

Callers

nothing calls this directly

Calls 9

getUnsafeMethod · 0.95
getTypeMethod · 0.95
getAmountMethod · 0.95
getItemMetaMethod · 0.95
getItemFactoryMethod · 0.95
putMethod · 0.65
getDataVersionMethod · 0.65
nameMethod · 0.65
equalsMethod · 0.65

Tested by

no test coverage detected