-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathMenuItemStack.java
More file actions
419 lines (358 loc) · 12 KB
/
MenuItemStack.java
File metadata and controls
419 lines (358 loc) · 12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
package fr.maxlego08.menu.api;
import fr.maxlego08.menu.api.attribute.AttributeMergeStrategy;
import fr.maxlego08.menu.api.attribute.AttributeWrapper;
import fr.maxlego08.menu.api.context.BuildContext;
import fr.maxlego08.menu.api.context.MenuItemStackContext;
import fr.maxlego08.menu.api.enums.MenuItemRarity;
import fr.maxlego08.menu.api.itemstack.*;
import fr.maxlego08.menu.api.utils.LoreType;
import fr.maxlego08.menu.api.utils.Placeholders;
import org.bukkit.NamespacedKey;
import org.bukkit.OfflinePlayer;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
import java.util.List;
import java.util.Map;
public interface MenuItemStack extends MenuItemStackContext {
/**
* Build an item stack using the provided build context.
* This method constructs an ItemStack instance based on the given context,
* applying any necessary configurations and customizations.
*
* @param context The build context containing relevant information.
* @return The constructed ItemStack.
*/
ItemStack build(BuildContext context);
/**
* Build an item stack using the provided player context.
* This method constructs an ItemStack instance for the player,
* applying any necessary configurations and customizations.
*
* @param player The player for whom the item stack is being built.
* @return The constructed ItemStack for the specified player.
*/
ItemStack build(Player player);
/**
* Build an item stack using the given player and whether to use the cache or not.
*
* @param player The player to use to build the item stack.
* @param useCache Whether to use the cache or not.
* @return The built item stack.
*/
ItemStack build(Player player, boolean useCache);
/**
* Build an item stack using the given player, use cache and placeholders.
*
* @param player The player to use to build the item stack.
* @param useCache Whether to use the cache or not.
* @param placeholders The placeholders to use in the item stack construction.
* @return The built item stack.
*/
ItemStack build(Player player, boolean useCache, Placeholders placeholders);
/**
* Sets the material of the item stack.
*
* @param material The new material.
*/
void setMaterial(String material);
/**
* Sets the target player placeholder for the menu item stack.
* This placeholder is used to represent the target player in the menu configurations.
*
* @param targetPlayer The target player placeholder to set.
*/
void setTargetPlayer(String targetPlayer);
/**
* Updates the configured amount placeholder for the item stack.
*
* @param amount the amount expression to set.
*/
void setAmount(String amount);
/**
* Defines the skull texture URL for this item stack.
*
* @param url the skull URL to use.
*/
void setUrl(String url);
/**
* Sets the legacy data value for this item stack.
*
* @param data the data value to apply.
*/
void setData(String data);
/**
* Sets the durability of the item stack.
*
* @param durability the durability to apply.
*/
/**
* This méthod is deprecated, now use placeholder support
* Use getDura or parseDura
* @return durability
*/
@Deprecated
int getDurability();
String getDura();
int parseDura(Player player);
int parseDura(OfflinePlayer offlinePlayer, Placeholders placeholders);
void setDurability(int durability);
void setDurability(String durability);
Potion getPotion();
/**
* Applies a potion configuration to this item stack.
*
* @param potion the potion descriptor to use.
*/
void setPotion(Potion potion);
/**
* Replaces the lore lines attached to this item stack.
*
* @param lore the lore lines to apply.
*/
void setLore(List<String> lore);
/**
* Sets the item flags applied to this item stack.
*
* @param flags the flags to set.
*/
void setFlags(List<ItemFlag> flags);
/**
* Defines the display name for the item stack.
*
* @param displayName the display name to set.
*/
void setDisplayName(String displayName);
/**
* Enables or disables the glowing effect on the item.
*
* @param isGlowing {@code true} to enable the effect.
*/
void setGlowing(boolean isGlowing);
/**
* Sets the custom model data identifier using a string value.
*
* @param modelID the identifier to use.
*/
void setModelID(String modelID);
/**
* Sets the custom model data identifier using an integer value.
*
* @param modelID the identifier to use.
*/
void setModelID(int modelID);
/**
* Applies the provided enchantments to this item stack.
*
* @param enchantments the enchantments to set.
*/
void setEnchantments(Map<Enchantment, Integer> enchantments);
/**
* Sets the attributes applied to this item stack.
*
* @param attributes the attributes to apply.
*/
void setAttributes(List<AttributeWrapper> attributes);
/**
* Sets the strategy for merging attribute modifiers when applying custom attributes to items.
* The chosen strategy will be used when calling {@link #setAttributes(List)}.
*
* @param attributeMergeStrategy the strategy for merging attribute modifiers.
* @see AttributeMergeStrategy
*/
void setAttributeMergeStrategy(AttributeMergeStrategy attributeMergeStrategy);
/**
* Applies a banner configuration to this item stack.
*
* @param banner the banner descriptor to use.
*/
void setBanner(Banner banner);
/**
* Applies a firework configuration to this item stack.
*
* @param firework the firework descriptor to use.
*/
void setFirework(Firework firework);
/**
* Applies a leather armor configuration to this item stack.
*
* @param leatherArmor the leather armor descriptor to use.
*/
void setLeatherArmor(LeatherArmor leatherArmor);
/**
* Sets the tooltip style identifier applied to this item stack.
*
* @param toolTipStyle the tooltip style key to use.
*/
void setToolTipStyle(String toolTipStyle);
/**
* Sets the translated display names available for this item stack.
*
* @param translatedDisplayName the map of locale to display name.
*/
void setTranslatedDisplayName(Map<String, String> translatedDisplayName);
/**
* Sets the translated lore entries available for this item stack.
*
* @param translatedLore the map of locale to lore lines.
*/
void setTranslatedLore(Map<String, List<String>> translatedLore);
/**
* Marks whether PlaceholderAPI is required for this item stack.
*
* @param needPlaceholderAPI {@code true} when PlaceholderAPI is needed.
*/
void setNeedPlaceholderAPI(boolean needPlaceholderAPI);
/**
* Sets the cached item stack value used when caching is enabled.
*
* @param cacheItemStack the ItemStack to cache.
*/
void setCacheItemStack(ItemStack cacheItemStack);
/**
* Sets the maximum stack size for the item.
*
* @param maxStackSize the new maximum stack size.
*/
void setMaxStackSize(int maxStackSize);
/**
* Sets the maximum damage for the item.
*
* @param maxDamage the maximum damage value.
*/
void setMaxDamage(int maxDamage);
/**
* Sets the current damage value for the item.
*
* @param damage the damage to apply.
*/
void setDamage(int damage);
/**
* Sets the repair cost associated with the item.
*
* @param repairCost the repair cost value.
*/
void setRepairCost(int repairCost);
/**
* Enables or disables the unbreakable flag on the item.
*
* @param unbreakableEnabled {@code true} to enable the flag.
*/
void setUnbreakableEnabled(Boolean unbreakableEnabled);
/**
* Controls the visibility of the unbreakable tooltip.
*
* @param unbreakableShowInTooltip {@code true} to show the tooltip.
*/
void setUnbreakableShowInTooltip(Boolean unbreakableShowInTooltip);
/**
* Enables or disables fire resistance on the item.
*
* @param fireResistant {@code true} to enable fire resistance.
*/
void setFireResistant(Boolean fireResistant);
/**
* Controls the visibility of the tooltip.
*
* @param hideTooltip {@code true} to hide the tooltip.
*/
void setHideTooltip(Boolean hideTooltip);
/**
* Controls whether additional tooltip information is hidden.
*
* @param hideAdditionalTooltip {@code true} to hide additional tooltip content.
*/
void setHideAdditionalTooltip(Boolean hideAdditionalTooltip);
/**
* Enables or disables the enchantment glint.
*
* @param enchantmentGlint {@code true} to enable the glint.
*/
void setEnchantmentGlint(Boolean enchantmentGlint);
/**
* Controls the visibility of enchantments in the tooltip.
*
* @param enchantmentShowInTooltip {@code true} to show enchantments.
*/
void setEnchantmentShowInTooltip(Boolean enchantmentShowInTooltip);
/**
* Controls the visibility of attributes in the tooltip.
*
* @param attributeShowInTooltip {@code true} to show attributes.
*/
void setAttributeShowInTooltip(Boolean attributeShowInTooltip);
/**
* Sets the trim configuration applied to armor items.
*
* @param trimConfiguration the trim configuration to apply.
*/
void setTrimConfiguration(TrimConfiguration trimConfiguration);
/**
* Sets the rarity assigned to this item stack.
*
* @param itemRarity the rarity to apply.
*/
void setItemRarity(MenuItemRarity itemRarity);
/**
* Enables or disables lore centering.
*
* @param centerLore {@code true} to center lore.
*/
void setCenterLore(boolean centerLore);
/**
* Enables or disables display name centering.
*
* @param centerName {@code true} to center the name.
*/
void setCenterName(boolean centerName);
/**
* Sets how lore should be merged when applied.
*
* @param loreType the lore merge strategy.
*/
void setLoreType(LoreType loreType);
/**
* Parses the configured amount for the provided player.
*
* @param player the player context.
* @return the parsed amount.
*/
int parseAmount(Player player);
/**
* Parses the configured amount for the provided player using placeholders.
*
* @param player the player context.
* @param placeholders placeholder values to apply.
* @return the parsed amount.
*/
int parseAmount(Player player, Placeholders placeholders);
/**
* Parses the configured amount for the provided offline player using placeholders.
*
* @param offlinePlayer the offline player context.
* @param placeholders placeholder values to apply.
* @return the parsed amount.
*/
int parseAmount(OfflinePlayer offlinePlayer, Placeholders placeholders);
/**
* Sets the item model identifier used for newer rendering APIs.
*
* @param itemModel the item model identifier to set.
*/
void setItemModel(NamespacedKey itemModel);
/**
* Sets the equipped model identifier used for wearable items.
*
* @param equippedModel the equipped model identifier to set.
*/
void setEquippedModel(String equippedModel);
/**
* Controls whether default attributes should be cleared on the item.
*
* @param clearDefaultAttributes {@code true} to clear default attributes.
*/
void setClearDefaultAttributes(boolean clearDefaultAttributes);
void addItemComponent(@NotNull ItemComponent itemMetadata);
}