ItemMetaBuilder annotations

This commit is contained in:
themode 2021-04-03 00:09:13 +02:00
parent 9abbef35ae
commit 0382b1adfe

View File

@ -24,61 +24,73 @@ public abstract class ItemMetaBuilder implements Cloneable {
protected NBTCompound originalNBT; protected NBTCompound originalNBT;
@Contract("_ -> this")
public @NotNull ItemMetaBuilder damage(int damage) { public @NotNull ItemMetaBuilder damage(int damage) {
this.damage = damage; this.damage = damage;
return this; return this;
} }
@Contract("_ -> this")
public @NotNull ItemMetaBuilder unbreakable(boolean unbreakable) { public @NotNull ItemMetaBuilder unbreakable(boolean unbreakable) {
this.unbreakable = unbreakable; this.unbreakable = unbreakable;
return this; return this;
} }
@Contract("_ -> this")
public @NotNull ItemMetaBuilder hideFlag(int hideFlag) { public @NotNull ItemMetaBuilder hideFlag(int hideFlag) {
this.hideFlag = hideFlag; this.hideFlag = hideFlag;
return this; return this;
} }
@Contract("_ -> this")
public @NotNull ItemMetaBuilder displayName(@Nullable Component displayName) { public @NotNull ItemMetaBuilder displayName(@Nullable Component displayName) {
this.displayName = displayName; this.displayName = displayName;
return this; return this;
} }
public @NotNull ItemMetaBuilder lore(List<@NotNull Component> lore) { @Contract("_ -> this")
public @NotNull ItemMetaBuilder lore(@NotNull List<@NotNull Component> lore) {
this.lore = lore; this.lore = lore;
return this; return this;
} }
@Contract("_ -> this")
public @NotNull ItemMetaBuilder lore(Component... lore) { public @NotNull ItemMetaBuilder lore(Component... lore) {
lore(Arrays.asList(lore)); lore(Arrays.asList(lore));
return this; return this;
} }
@Contract("_ -> this")
public @NotNull ItemMetaBuilder enchantments(@NotNull Map<Enchantment, Short> enchantments) { public @NotNull ItemMetaBuilder enchantments(@NotNull Map<Enchantment, Short> enchantments) {
this.enchantmentMap.putAll(enchantments); this.enchantmentMap.putAll(enchantments);
return this; return this;
} }
@Contract("_, _ -> this")
public @NotNull ItemMetaBuilder enchantment(@NotNull Enchantment enchantment, short level) { public @NotNull ItemMetaBuilder enchantment(@NotNull Enchantment enchantment, short level) {
this.enchantmentMap.put(enchantment, level); this.enchantmentMap.put(enchantment, level);
return this; return this;
} }
@Contract("-> this")
public @NotNull ItemMetaBuilder clearEnchantment() { public @NotNull ItemMetaBuilder clearEnchantment() {
this.enchantmentMap.clear(); this.enchantmentMap.clear();
return this; return this;
} }
public @NotNull ItemMetaBuilder attributes(List<ItemAttribute> attributes) { @Contract("_ -> this")
public @NotNull ItemMetaBuilder attributes(@NotNull List<@NotNull ItemAttribute> attributes) {
this.attributes = attributes; this.attributes = attributes;
return this; return this;
} }
@Contract("_ -> this")
public @NotNull ItemMetaBuilder customModelData(int customModelData) { public @NotNull ItemMetaBuilder customModelData(int customModelData) {
this.customModelData = customModelData; this.customModelData = customModelData;
return this; return this;
} }
@Contract("-> new")
public abstract @NotNull ItemMeta build(); public abstract @NotNull ItemMeta build();
public abstract void read(@NotNull NBTCompound nbtCompound); public abstract void read(@NotNull NBTCompound nbtCompound);