From 0382b1adfe53570acff35c4017fd9c55deabd93f Mon Sep 17 00:00:00 2001 From: themode Date: Sat, 3 Apr 2021 00:09:13 +0200 Subject: [PATCH] ItemMetaBuilder annotations --- .../minestom/server/item/ItemMetaBuilder.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/minestom/server/item/ItemMetaBuilder.java b/src/main/java/net/minestom/server/item/ItemMetaBuilder.java index 844e59c7f..3cca989cb 100644 --- a/src/main/java/net/minestom/server/item/ItemMetaBuilder.java +++ b/src/main/java/net/minestom/server/item/ItemMetaBuilder.java @@ -24,61 +24,73 @@ public abstract class ItemMetaBuilder implements Cloneable { protected NBTCompound originalNBT; + @Contract("_ -> this") public @NotNull ItemMetaBuilder damage(int damage) { this.damage = damage; return this; } + @Contract("_ -> this") public @NotNull ItemMetaBuilder unbreakable(boolean unbreakable) { this.unbreakable = unbreakable; return this; } + @Contract("_ -> this") public @NotNull ItemMetaBuilder hideFlag(int hideFlag) { this.hideFlag = hideFlag; return this; } + @Contract("_ -> this") public @NotNull ItemMetaBuilder displayName(@Nullable Component displayName) { this.displayName = displayName; return this; } - public @NotNull ItemMetaBuilder lore(List<@NotNull Component> lore) { + @Contract("_ -> this") + public @NotNull ItemMetaBuilder lore(@NotNull List<@NotNull Component> lore) { this.lore = lore; return this; } + @Contract("_ -> this") public @NotNull ItemMetaBuilder lore(Component... lore) { lore(Arrays.asList(lore)); return this; } + @Contract("_ -> this") public @NotNull ItemMetaBuilder enchantments(@NotNull Map enchantments) { this.enchantmentMap.putAll(enchantments); return this; } + @Contract("_, _ -> this") public @NotNull ItemMetaBuilder enchantment(@NotNull Enchantment enchantment, short level) { this.enchantmentMap.put(enchantment, level); return this; } + @Contract("-> this") public @NotNull ItemMetaBuilder clearEnchantment() { this.enchantmentMap.clear(); return this; } - public @NotNull ItemMetaBuilder attributes(List attributes) { + @Contract("_ -> this") + public @NotNull ItemMetaBuilder attributes(@NotNull List<@NotNull ItemAttribute> attributes) { this.attributes = attributes; return this; } + @Contract("_ -> this") public @NotNull ItemMetaBuilder customModelData(int customModelData) { this.customModelData = customModelData; return this; } + @Contract("-> new") public abstract @NotNull ItemMeta build(); public abstract void read(@NotNull NBTCompound nbtCompound);