-
Notifications
You must be signed in to change notification settings - Fork 35
/
MenuItem.java
861 lines (710 loc) · 29.7 KB
/
MenuItem.java
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
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
package com.extendedclip.deluxemenus.menu;
import com.extendedclip.deluxemenus.DeluxeMenus;
import com.extendedclip.deluxemenus.action.ClickHandler;
import com.extendedclip.deluxemenus.config.DeluxeMenusConfig;
import com.extendedclip.deluxemenus.nbt.NbtProvider;
import com.extendedclip.deluxemenus.requirement.RequirementList;
import com.extendedclip.deluxemenus.utils.DebugLevel;
import com.extendedclip.deluxemenus.utils.StringUtils;
import com.extendedclip.deluxemenus.utils.VersionHelper;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import java.util.function.Function;
import java.util.logging.Level;
import java.util.stream.Collectors;
import com.google.common.collect.ImmutableMap;
import org.bukkit.Color;
import org.bukkit.DyeColor;
import org.bukkit.FireworkEffect;
import org.bukkit.Material;
import org.bukkit.block.Banner;
import org.bukkit.block.banner.Pattern;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.inventory.meta.BannerMeta;
import org.bukkit.inventory.meta.BlockStateMeta;
import org.bukkit.inventory.meta.EnchantmentStorageMeta;
import org.bukkit.inventory.meta.FireworkEffectMeta;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.LeatherArmorMeta;
import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.potion.PotionData;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionType;
import org.jetbrains.annotations.NotNull;
import static com.extendedclip.deluxemenus.utils.Constants.*;
public class MenuItem implements Cloneable {
/**
* A map between a slot name and the method used to get that item from a player's inventory
*/
private static final Map<String, Function<PlayerInventory, ItemStack>> INVENTORY_ITEM_ACCESSORS = ImmutableMap.<String, Function<PlayerInventory, ItemStack>>builder()
.put(MAIN_HAND, PlayerInventory::getItemInMainHand)
.put(OFF_HAND, PlayerInventory::getItemInOffHand)
.put(HELMET, PlayerInventory::getHelmet)
.put(CHESTPLATE, PlayerInventory::getChestplate)
.put(LEGGINGS, PlayerInventory::getLeggings)
.put(BOOTS, PlayerInventory::getBoots)
.build();
private String configMaterial;
private short configData;
private int configAmount;
private String customModelData;
private String configDynamicAmount = null;
private String configDisplayName;
private List<String> configLore;
private DyeColor configBaseColor;
private HeadType headType;
private String placeholderData;
private String rgb;
private Map<Enchantment, Integer> enchantments;
private List<PotionEffect> potionEffects;
private List<Pattern> bannerMeta;
private List<ItemFlag> itemFlags;
private boolean unbreakable;
private boolean hideAttributes;
private boolean hideEnchants;
private boolean hidePotionEffects;
private boolean hideUnbreakable;
private String lowercaseConfigMaterial;
private boolean displayNameHasPlaceholders;
private boolean loreHasPlaceholders;
private String nbtString;
private String nbtInt;
private List<String> nbtStrings;
private List<String> nbtInts;
private int slot;
private int priority;
private boolean updatePlaceholders;
private ClickHandler clickHandler;
private ClickHandler leftClickHandler;
private ClickHandler rightClickHandler;
private ClickHandler shiftLeftClickHandler;
private ClickHandler shiftRightClickHandler;
private ClickHandler middleClickHandler;
private RequirementList viewRequirements;
private RequirementList clickRequirements;
private RequirementList leftClickRequirements;
private RequirementList rightClickRequirements;
private RequirementList shiftLeftClickRequirements;
private RequirementList shiftRightClickRequirements;
private RequirementList middleClickRequirements;
@Override
public MenuItem clone() {
try {
return (MenuItem) super.clone();
} catch (final CloneNotSupportedException exception) {
DeluxeMenus.printStacktrace(
"Something went wrong while trying to clone menu item.",
exception
);
}
return new MenuItem();
}
public ItemStack getItemStack(@NotNull final MenuHolder holder) {
final Player viewer = holder.getViewer();
ItemStack itemStack = null;
int amount = 1;
if (isPlaceholderMaterial(lowercaseConfigMaterial)) {
configMaterial = holder.setPlaceholders(configMaterial.substring(PLACEHOLDER_PREFIX.length()));
lowercaseConfigMaterial = configMaterial.toLowerCase(Locale.ENGLISH);
}
if (isPlayerItem(lowercaseConfigMaterial)) {
final ItemStack playerItem = INVENTORY_ITEM_ACCESSORS.get(lowercaseConfigMaterial).apply(viewer.getInventory());
// Some of the methods are marked as @NotNull, and in theory that means they return an item with material STONE
if (playerItem == null) {
return new ItemStack(Material.STONE, amount);
}
itemStack = playerItem.clone();
amount = playerItem.getAmount();
}
final int temporaryAmount = amount;
if (isHeadItem(lowercaseConfigMaterial)) {
itemStack = getItemFromHook(headType.getHookName(), holder.setPlaceholders(configMaterial.substring(headType.getPrefix().length())))
.orElseGet(() -> DeluxeMenus.getInstance().getHead().clone());
} else if (isItemsAdderItem(lowercaseConfigMaterial)) {
itemStack = getItemFromHook("itemsadder", holder.setPlaceholders(configMaterial.substring(ITEMSADDER_PREFIX.length())))
.orElseGet(() -> new ItemStack(Material.STONE, temporaryAmount));
} else if (isOraxenItem(lowercaseConfigMaterial)) {
itemStack = getItemFromHook("oraxen", holder.setPlaceholders(configMaterial.substring(ORAXEN_PREFIX.length())))
.orElseGet(() -> new ItemStack(Material.STONE, temporaryAmount));
} else if (isWaterBottle(lowercaseConfigMaterial)) {
itemStack = createWaterBottle(amount);
} else if (itemStack == null) {
final Material material = Material.getMaterial(configMaterial.toUpperCase(Locale.ROOT));
if (material == null) {
DeluxeMenus.debug(
DebugLevel.HIGHEST,
Level.WARNING,
"Material: " + configMaterial + " is not valid! Setting to Stone."
);
itemStack = new ItemStack(Material.STONE, amount);
} else {
itemStack = new ItemStack(material, amount);
}
}
if (isBanner(itemStack.getType())) {
final BannerMeta meta = (BannerMeta) itemStack.getItemMeta();
if (meta != null) {
if (configBaseColor != null) {
meta.setBaseColor(configBaseColor);
}
if (bannerMeta != null) {
meta.setPatterns(bannerMeta);
}
itemStack.setItemMeta(meta);
}
}
if (isShield(itemStack.getType())) {
final BlockStateMeta blockStateMeta = (BlockStateMeta) itemStack.getItemMeta();
if (blockStateMeta != null) {
final Banner banner = (Banner) blockStateMeta.getBlockState();
if (configBaseColor != null) {
banner.setBaseColor(configBaseColor);
banner.update();
blockStateMeta.setBlockState(banner);
}
if (bannerMeta != null) {
banner.setPatterns(bannerMeta);
banner.update();
blockStateMeta.setBlockState(banner);
}
itemStack.setItemMeta(blockStateMeta);
}
}
if (hasPotionMeta(itemStack)) {
final PotionMeta meta = (PotionMeta) itemStack.getItemMeta();
if (meta != null) {
if (rgb != null) {
final String rgbString = holder.setPlaceholders(rgb);
final String[] parts = rgbString.split(",");
try {
meta.setColor(Color.fromRGB(Integer.parseInt(parts[0].trim()), Integer.parseInt(parts[1].trim()),
Integer.parseInt(parts[2].trim())));
} catch (Exception ignored) {
}
}
if (potionEffects != null && !potionEffects.isEmpty()) {
for (PotionEffect effect : potionEffects) {
meta.addCustomEffect(effect, true);
}
}
itemStack.setItemMeta(meta);
}
}
if (itemStack.getType() == Material.AIR) {
return itemStack;
}
if (placeholderData != null) {
try {
configData = Short.parseShort(holder.setPlaceholders(placeholderData));
} catch (final Exception exception) {
DeluxeMenus.printStacktrace(
"Invalid placeholder data found: " + holder.setPlaceholders(placeholderData) + ".",
exception
);
}
}
if (configData > 0) {
itemStack.setDurability(configData);
}
if (configAmount != -1) {
amount = configAmount;
}
if (this.configDynamicAmount != null) {
try {
final int dynamicAmount = (int) Double.parseDouble(holder.setPlaceholders(this.configDynamicAmount));
amount = Math.max(dynamicAmount, 1);
} catch (final NumberFormatException ignored) {
}
}
if (amount > 64) {
amount = 64;
}
itemStack.setAmount(amount);
final ItemMeta itemMeta = itemStack.getItemMeta();
if (itemMeta == null) {
return itemStack;
}
if (customModelData != null && VersionHelper.IS_CUSTOM_MODEL_DATA) {
try {
final int modelData = Integer.parseInt(holder.setPlaceholders(customModelData));
itemMeta.setCustomModelData(modelData);
} catch (final Exception ignored) {
}
}
if (this.configDisplayName != null) {
final String displayName = holder.setPlaceholders(this.configDisplayName);
itemMeta.setDisplayName(StringUtils.color(displayName));
}
if (this.configLore != null) {
final List<String> lore = configLore.stream()
.map(holder::setPlaceholders)
.map(StringUtils::color)
.map(line -> line.split("\n"))
.flatMap(Arrays::stream)
.map(line -> line.split("\\\\n"))
.flatMap(Arrays::stream)
.collect(Collectors.toList());
itemMeta.setLore(lore);
}
if (itemFlags != null && !itemFlags.isEmpty()) {
for (final ItemFlag flag : itemFlags) {
itemMeta.addItemFlags(flag);
}
}
if (this.hideAttributes) {
itemMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
}
if (this.hideEnchants) {
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
}
if (this.hidePotionEffects) {
itemMeta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
}
if (this.unbreakable) {
itemMeta.setUnbreakable(true);
}
if (this.hideUnbreakable) {
itemMeta.addItemFlags(ItemFlag.HIDE_UNBREAKABLE);
}
if (itemMeta instanceof LeatherArmorMeta && rgb != null) {
final String rgbString = holder.setPlaceholders(rgb);
final String[] parts = rgbString.split(",");
final LeatherArmorMeta leatherArmorMeta = (LeatherArmorMeta) itemMeta;
try {
leatherArmorMeta.setColor(Color.fromRGB(Integer.parseInt(parts[0].trim()), Integer.parseInt(parts[1].trim()),
Integer.parseInt(parts[2].trim())));
itemStack.setItemMeta(leatherArmorMeta);
} catch (final Exception exception) {
DeluxeMenus.printStacktrace(
"Invalid rgb colors found for leather armor: " + parts[0].trim() + ", " + parts[1].trim() + ", " +
parts[2].trim(),
exception
);
}
} else if (itemMeta instanceof FireworkEffectMeta && rgb != null) {
final String rgbString = holder.setPlaceholders(rgb);
final String[] parts = rgbString.split(",");
final FireworkEffectMeta fireworkEffectMeta = (FireworkEffectMeta) itemMeta;
try {
fireworkEffectMeta.setEffect(FireworkEffect.builder().withColor(Color.fromRGB(Integer.parseInt(parts[0].trim()),
Integer.parseInt(parts[1].trim()), Integer.parseInt(parts[2].trim()))).build());
itemStack.setItemMeta(fireworkEffectMeta);
} catch (final Exception exception) {
DeluxeMenus.printStacktrace(
"Invalid rgb colors found for firework or firework star: " + parts[0].trim() + ", "
+ parts[1].trim() + ", " + parts[2].trim(),
exception
);
}
} else if (itemMeta instanceof EnchantmentStorageMeta && enchantments != null) {
final EnchantmentStorageMeta enchantmentStorageMeta = (EnchantmentStorageMeta) itemMeta;
for (final Map.Entry<Enchantment, Integer> entry : enchantments.entrySet()) {
final boolean result = enchantmentStorageMeta.addStoredEnchant(entry.getKey(), entry.getValue(), true);
if (!result) {
DeluxeMenus.debug(
DebugLevel.HIGHEST,
Level.INFO,
"Failed to add enchantment " + entry.getKey().getName() + " to item " + itemStack.getType()
);
}
}
itemStack.setItemMeta(enchantmentStorageMeta);
} else {
itemStack.setItemMeta(itemMeta);
}
if (!(itemMeta instanceof EnchantmentStorageMeta) && this.enchantments != null) {
itemStack.addUnsafeEnchantments(enchantments);
}
if (NbtProvider.isAvailable()) {
if (this.nbtString != null) {
final String tag = holder.setPlaceholders(this.nbtString);
if (tag.contains(":")) {
final String[] parts = tag.split(":", 2);
itemStack = NbtProvider.setString(itemStack, parts[0], parts[1]);
}
}
if (this.nbtInt != null) {
final String tag = holder.setPlaceholders(this.nbtInt);
if (tag.contains(":")) {
final String[] parts = tag.split(":");
itemStack = NbtProvider.setInt(itemStack, parts[0], Integer.parseInt(parts[1]));
}
}
for (String nbtTag : this.nbtStrings) {
final String tag = holder.setPlaceholders(nbtTag);
if (tag.contains(":")) {
final String[] parts = tag.split(":", 2);
itemStack = NbtProvider.setString(itemStack, parts[0], parts[1]);
}
}
for (String nbtTag : this.nbtInts) {
final String tag = holder.setPlaceholders(nbtTag);
if (tag.contains(":")) {
final String[] parts = tag.split(":");
itemStack = NbtProvider.setInt(itemStack, parts[0], Integer.parseInt(parts[1]));
}
}
}
return itemStack;
}
/**
* Checks if the string starts with the substring "placeholder-". The check is case-sensitive.
*
* @param material The string to check
* @return true if the string starts with "placeholder-", false otherwise
*/
private boolean isPlaceholderMaterial(@NotNull final String material) {
return material.startsWith(PLACEHOLDER_PREFIX);
}
/**
* Checks if the string is a player item. The check is case-sensitive.
* Player items are: "main_hand", "off_hand", "armor_helmet", "armor_chestplate", "armor_leggings", "armor_boots"
*
* @param material The string to check
* @return true if the string is a player item, false otherwise
*/
private boolean isPlayerItem(@NotNull final String material) {
return INVENTORY_ITEM_ACCESSORS.containsKey(material);
}
/**
* Checks if the string is a head item. The check is case-insensitive.
* Head items are:
* <ul>
* <li>"head-{player-name}" (a simple named player head, supports placeholders. eg. "head-%player_name% or head-extendedclip")</li>
* <li>"texture-{texture-url}" (a head with a custom texture specified by a texture url. eg. "texture-93a728ad8d31486a7f9aad200edb373ea803d1fc5fd4321b2e2a971348234443")</li>
* <li>"basehead-{base64-encoded-texture-url}" (a head with a custom texture specified by a base64 encoded texture url)</li>
* <li>"hdb-{hdb-head-id}" (a head with a custom texture specified by a <a href="https://www.spigotmc.org/resources/14280/">HeadDatabase</a> id)</li>
* </ul>
*
* @param material The string to check
* @return true if the string is a head item, false otherwise
*/
private boolean isHeadItem(@NotNull final String material) {
final Optional<HeadType> headType = HeadType.parseHeadType(material);
headType.ifPresent(type -> this.headType = type);
return headType.isPresent();
}
/**
* Checks if the string is an ItemsAdder item. The check is case-sensitive.
* ItemsAdder items are: "itemsadder-{namespace:name}"
*
* @param material The string to check
* @return true if the string is an ItemsAdder item, false otherwise
*/
private boolean isItemsAdderItem(@NotNull final String material) {
return material.startsWith(ITEMSADDER_PREFIX);
}
/**
* Checks if the string is an Oraxen item. The check is case-sensitive.
* ItemsAdder items are: "oraxen-{namespace:name}"
*
* @param material The string to check
* @return true if the string is an Oraxen item, false otherwise
*/
private boolean isOraxenItem(@NotNull final String material) {
return material.startsWith(ORAXEN_PREFIX);
}
/**
* Checks if the material is a water bottle. The check is case-insensitive.
*
* @param material The material to check
* @return true if the material is a water bottle, false otherwise
*/
private boolean isWaterBottle(@NotNull final String material) {
return material.equalsIgnoreCase(WATER_BOTTLE);
}
/**
* Checks if the material is a banner.
*
* @param material The material to check
* @return true if the material is a banner, false otherwise
*/
private boolean isBanner(@NotNull final Material material) {
return material.name().endsWith("_BANNER");
}
/**
* Checks if the material is a shield.
*
* @param material The material to check
* @return true if the material is a shield, false otherwise
*/
private boolean isShield(@NotNull final Material material) {
return material == Material.SHIELD;
}
/**
* Checks if the ItemStack is a potion or can hold potion effects.
*
* @param itemStack The ItemStack to check
* @return true if the ItemStack is a potion or can hold a potion effect, false otherwise
*/
private boolean hasPotionMeta(@NotNull final ItemStack itemStack) {
return itemStack.getItemMeta() instanceof PotionMeta;
}
private @NotNull ItemStack createWaterBottle(final int amount) {
final ItemStack itemStack = new ItemStack(Material.POTION, amount);
final PotionMeta itemMeta = (PotionMeta) itemStack.getItemMeta();
if (itemMeta != null) {
final PotionData potionData = new PotionData(PotionType.WATER);
itemMeta.setBasePotionData(potionData);
itemStack.setItemMeta(itemMeta);
}
return itemStack;
}
private @NotNull Optional<ItemStack> getItemFromHook(String hookName, String... args) {
return DeluxeMenus.getInstance()
.getItemHook(hookName)
.map(itemHook -> itemHook.getItem(args));
}
public ClickHandler getClickHandler() {
return clickHandler;
}
public void setClickHandler(ClickHandler clickHandler) {
this.clickHandler = clickHandler;
}
public RequirementList getClickRequirements() {
return clickRequirements;
}
public void setClickRequirements(
RequirementList clickRequirements) {
this.clickRequirements = clickRequirements;
}
public void setPotionEffects(List<PotionEffect> potionEffects) {
this.potionEffects = potionEffects;
}
public String getCustomModelData() {
return customModelData;
}
public void setCustomModelData(String customModelData) {
this.customModelData = customModelData;
}
public DyeColor getConfigBaseColor() {
return configBaseColor;
}
public void setConfigBaseColor(DyeColor configBaseColor) {
this.configBaseColor = configBaseColor;
}
public @NotNull String getConfigMaterial() {
return configMaterial;
}
public void setConfigMaterial(@NotNull final String configMaterial) {
this.configMaterial = configMaterial;
this.lowercaseConfigMaterial = configMaterial.toLowerCase(Locale.ROOT);
}
public short getConfigData() {
return configData;
}
public void setConfigData(Short configData) {
this.configData = configData;
}
public int getConfigAmount() {
return configAmount;
}
public void setConfigAmount(int configAmount) {
this.configAmount = configAmount;
}
public String getConfigDisplayName() {
return configDisplayName;
}
public void setConfigDisplayName(String configDisplayName) {
this.configDisplayName = configDisplayName;
if (this.configDisplayName != null) {
this.displayNameHasPlaceholders = DeluxeMenusConfig.containsPlaceholders(this.configDisplayName);
}
}
public List<String> getConfigLore() {
return configLore;
}
public void setConfigLore(List<String> configLore) {
this.configLore = configLore;
if (this.configLore != null) {
this.loreHasPlaceholders = configLore.stream().anyMatch(DeluxeMenusConfig::containsPlaceholders);
}
}
public ClickHandler getLeftClickHandler() {
return leftClickHandler;
}
public void setLeftClickHandler(ClickHandler clickHandler) {
this.leftClickHandler = clickHandler;
}
public ClickHandler getRightClickHandler() {
return rightClickHandler;
}
public void setRightClickHandler(ClickHandler clickHandler) {
this.rightClickHandler = clickHandler;
}
public int getSlot() {
return slot;
}
public void setSlot(int slot) {
this.slot = slot;
}
public int getPriority() {
return priority;
}
public void setPriority(int priority) {
this.priority = priority;
}
public boolean hasViewRequirement() {
return viewRequirements != null && viewRequirements.getRequirements() != null;
}
public RequirementList getViewRequirements() {
return this.viewRequirements;
}
public void setViewRequirements(RequirementList r) {
this.viewRequirements = r;
}
public boolean displayNameHasPlaceholders() {
return displayNameHasPlaceholders;
}
public boolean loreHasPlaceholders() {
return loreHasPlaceholders;
}
public boolean updatePlaceholders() {
return updatePlaceholders;
}
public void setUpdatePlaceholders(boolean updatePlaceholders) {
this.updatePlaceholders = updatePlaceholders;
}
public boolean hideAttributes() {
return this.hideAttributes;
}
public void setHideAttributes(boolean hide) {
this.hideAttributes = hide;
}
public List<ItemFlag> itemFlags() {
return itemFlags;
}
public void setItemFlags(List<ItemFlag> flags) {
itemFlags = flags;
}
public boolean hideEnchants() {
return hideEnchants;
}
public void setHideEnchants(boolean hideEnchants) {
this.hideEnchants = hideEnchants;
}
public boolean hidePotionEffects() {
return hidePotionEffects;
}
public void setHidePotionEffects(boolean hidePotionEffects) {
this.hidePotionEffects = hidePotionEffects;
}
public void setEnchantments(Map<Enchantment, Integer> enchantments) {
this.enchantments = enchantments;
}
public RequirementList getLeftClickRequirements() {
return leftClickRequirements;
}
public void setLeftClickRequirements(RequirementList leftClickRequirements) {
this.leftClickRequirements = leftClickRequirements;
}
public RequirementList getRightClickRequirements() {
return rightClickRequirements;
}
public void setRightClickRequirements(RequirementList rightClickRequirements) {
this.rightClickRequirements = rightClickRequirements;
}
public List<Pattern> getBannerMeta() {
return bannerMeta;
}
public void setBannerMeta(List<Pattern> bannerMeta) {
this.bannerMeta = bannerMeta;
}
public String getConfigDynamicAmount() {
return configDynamicAmount;
}
public void setConfigDynamicAmount(String configDynamicAmount) {
this.configDynamicAmount = configDynamicAmount;
}
public boolean hideUnbreakable() {
return hideUnbreakable;
}
public void setHideUnbreakable(boolean b) {
this.hideUnbreakable = b;
}
public String getRGB() {
return rgb;
}
public void setRGB(String rgb) {
this.rgb = rgb;
}
public boolean isUnbreakable() {
return unbreakable;
}
public void setUnbreakable(boolean unbreakable) {
this.unbreakable = unbreakable;
}
public String getPlaceholderData() {
return placeholderData;
}
public void setPlaceholderData(String placeholderData) {
this.placeholderData = placeholderData;
}
public ClickHandler getShiftLeftClickHandler() {
return shiftLeftClickHandler;
}
public void setShiftLeftClickHandler(ClickHandler shiftLeftClickHandler) {
this.shiftLeftClickHandler = shiftLeftClickHandler;
}
public ClickHandler getShiftRightClickHandler() {
return shiftRightClickHandler;
}
public void setShiftRightClickHandler(ClickHandler shiftRightClickHandler) {
this.shiftRightClickHandler = shiftRightClickHandler;
}
public RequirementList getShiftLeftClickRequirements() {
return shiftLeftClickRequirements;
}
public void setShiftLeftClickRequirements(RequirementList shiftLeftClickRequirements) {
this.shiftLeftClickRequirements = shiftLeftClickRequirements;
}
public RequirementList getShiftRightClickRequirements() {
return shiftRightClickRequirements;
}
public void setShiftRightClickRequirements(RequirementList shiftRightClickRequirements) {
this.shiftRightClickRequirements = shiftRightClickRequirements;
}
public ClickHandler getMiddleClickHandler() {
return middleClickHandler;
}
public void setMiddleClickHandler(ClickHandler middleClickHandler) {
this.middleClickHandler = middleClickHandler;
}
public RequirementList getMiddleClickRequirements() {
return middleClickRequirements;
}
public void setMiddleClickRequirements(RequirementList middleClickRequirements) {
this.middleClickRequirements = middleClickRequirements;
}
public String getNbtString() {
return nbtString;
}
public void setNbtString(String nbtString) {
this.nbtString = nbtString;
}
public String getNbtInt() {
return nbtInt;
}
public void setNbtInt(String nbtInt) {
this.nbtInt = nbtInt;
}
public List<String> getNbtStrings() {
return nbtStrings;
}
public void setNbtStrings(List<String> nbtStrings) {
this.nbtStrings = nbtStrings;
}
public List<String> getNbtInts() {
return nbtInts;
}
public void setNbtInts(List<String> nbtInts) {
this.nbtInts = nbtInts;
}
}