DREAMFIRE Docs ← Back to site
Loading...
Searching...
No Matches
IDreamItemStack.java
Go to the documentation of this file.
1/*
2 * MIT License
3 *
4 * Copyright (c) 2025 Dreamfire Studio
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
24package com.dreamfirestudios.dreamcore.DreamItems;
25
26import net.kyori.adventure.text.Component;
27import org.bukkit.Material;
28import org.bukkit.attribute.Attribute;
29import org.bukkit.attribute.AttributeModifier;
30import org.bukkit.enchantments.Enchantment;
31import org.bukkit.inventory.ItemFlag;
32import org.bukkit.persistence.PersistentDataContainer;
33import org.bukkit.plugin.Plugin;
34
35import java.util.*;
36
60public interface IDreamItemStack {
61
62 /* ------------------ Identity ------------------ */
63
68 default Optional<String> id() { return Optional.empty(); }
69
74 default Component displayName() { return Component.text(getClass().getSimpleName()); }
75
80 default Material type() { return Material.DIAMOND_PICKAXE; }
81
86 default int amount() { return 1; }
87
92 default OptionalInt customModelData() { return OptionalInt.empty(); }
93
98 default boolean unbreakable() { return false; }
99
100 /* ------------------ Visuals & extras ------------------ */
101
106 default List<Component> lore() { return List.of(); }
107
112 default Set<ItemFlag> flags() { return Set.of(); }
113
118 default Map<Enchantment, Integer> enchantments() { return Map.of(); }
119
129 default Map<Attribute, Collection<AttributeModifier>> attributeModifiers() { return Map.of(); }
130
147 default void writePdc(Plugin plugin, PersistentDataContainer pdc) { /* no-op */ }
148}
default List< Component > lore()
Lore lines (Adventure).
default Optional< String > id()
Optional stable ID.
default Material type()
Base material type for the item.
default Map< Attribute, Collection< AttributeModifier > > attributeModifiers()
Attribute modifiers.
default Component displayName()
Display name (Adventure).
default Set< ItemFlag > flags()
Item flags to apply (e.g., hide attributes).
default int amount()
Initial stack amount (clamped to ≥ 1).
default void writePdc(Plugin plugin, PersistentDataContainer pdc)
Hook to write any custom Persistent Data Container values.
default Map< Enchantment, Integer > enchantments()
Enchantments to apply after meta is set.
default OptionalInt customModelData()
Optional custom model data.
default boolean unbreakable()
Whether the item is unbreakable.