001package net.tnemc.item.bukkit; 002/* 003 * The New Item Library 004 * Copyright (C) 2022 - 2025 Daniel "creatorfromhell" Vidmar 005 * 006 * This program is free software; you can redistribute it and/or 007 * modify it under the terms of the GNU Lesser General Public 008 * License as published by the Free Software Foundation; either 009 * version 3 of the License, or (at your option) any later version. 010 * 011 * This program is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 014 * Lesser General Public License for more details. 015 * 016 * You should have received a copy of the GNU Lesser General Public License 017 * along with this program; if not, write to the Free Software Foundation, 018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 019 */ 020 021import net.kyori.adventure.text.Component; 022import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; 023import net.tnemc.item.AbstractItemStack; 024import net.tnemc.item.bukkit.platform.BukkitItemPlatform; 025import net.tnemc.item.bukkit.platform.impl.BukkitAttributeModifiersComponent; 026import net.tnemc.item.bukkit.platform.impl.BukkitBundleComponent; 027import net.tnemc.item.bukkit.platform.impl.BukkitContainerComponent; 028import net.tnemc.item.bukkit.platform.impl.BukkitCustomNameComponent; 029import net.tnemc.item.bukkit.platform.impl.BukkitDamageComponent; 030import net.tnemc.item.bukkit.platform.impl.BukkitDyedColorComponent; 031import net.tnemc.item.bukkit.platform.impl.BukkitEnchantableComponent; 032import net.tnemc.item.bukkit.platform.impl.BukkitEnchantmentsComponent; 033import net.tnemc.item.bukkit.platform.impl.BukkitItemModelComponent; 034import net.tnemc.item.bukkit.platform.impl.BukkitItemNameComponent; 035import net.tnemc.item.bukkit.platform.impl.BukkitLoreComponent; 036import net.tnemc.item.bukkit.platform.impl.BukkitMaxDamageComponent; 037import net.tnemc.item.bukkit.platform.impl.BukkitMaxStackSizeComponent; 038import net.tnemc.item.bukkit.platform.impl.BukkitModelDataComponent; 039import net.tnemc.item.bukkit.platform.impl.BukkitModelDataOldComponent; 040import net.tnemc.item.bukkit.platform.impl.BukkitProfileComponent; 041import net.tnemc.item.bukkit.platform.impl.BukkitRarityComponent; 042import net.tnemc.item.bukkit.platform.impl.BukkitRepairCostComponent; 043import net.tnemc.item.bukkit.platform.impl.BukkitTooltipStyleComponent; 044import net.tnemc.item.component.SerialComponent; 045import net.tnemc.item.component.helper.AttributeModifier; 046import net.tnemc.item.component.helper.BlockPredicate; 047import net.tnemc.item.component.helper.EquipSlot; 048import net.tnemc.item.component.helper.ExplosionData; 049import net.tnemc.item.component.helper.ItemDamage; 050import net.tnemc.item.component.helper.PatternData; 051import net.tnemc.item.component.helper.ToolRule; 052import net.tnemc.item.component.helper.effect.ComponentEffect; 053import net.tnemc.item.component.helper.effect.EffectInstance; 054import net.tnemc.item.component.impl.AttributeModifiersComponent; 055import net.tnemc.item.component.impl.BannerPatternsComponent; 056import net.tnemc.item.component.impl.BaseColorComponent; 057import net.tnemc.item.component.impl.BlocksAttacksComponent; 058import net.tnemc.item.component.impl.BreakSoundComponent; 059import net.tnemc.item.component.impl.BucketEntityDataComponent; 060import net.tnemc.item.component.impl.BundleComponent; 061import net.tnemc.item.component.impl.CanBreakComponent; 062import net.tnemc.item.component.impl.CanPlaceOnComponent; 063import net.tnemc.item.component.impl.ConsumableComponent; 064import net.tnemc.item.component.impl.ContainerComponent; 065import net.tnemc.item.component.impl.CustomNameComponent; 066import net.tnemc.item.component.impl.DamageComponent; 067import net.tnemc.item.component.impl.DamageResistantComponent; 068import net.tnemc.item.component.impl.DeathProtectionComponent; 069import net.tnemc.item.component.impl.DyedColorComponent; 070import net.tnemc.item.component.impl.EnchantableComponent; 071import net.tnemc.item.component.impl.EnchantmentGlintOverrideComponent; 072import net.tnemc.item.component.impl.EnchantmentsComponent; 073import net.tnemc.item.component.impl.EntityVariantComponent; 074import net.tnemc.item.component.impl.EquipComponent; 075import net.tnemc.item.component.impl.FireworkExplosionComponent; 076import net.tnemc.item.component.impl.FireworksComponent; 077import net.tnemc.item.component.impl.FoodComponent; 078import net.tnemc.item.component.impl.GliderComponent; 079import net.tnemc.item.component.impl.HideAdditionalTooltipComponent; 080import net.tnemc.item.component.impl.HideTooltipComponent; 081import net.tnemc.item.component.impl.InstrumentComponent; 082import net.tnemc.item.component.impl.IntangibleProjectileComponent; 083import net.tnemc.item.component.impl.ItemModelComponent; 084import net.tnemc.item.component.impl.ItemNameComponent; 085import net.tnemc.item.component.impl.JukeBoxComponent; 086import net.tnemc.item.component.impl.LodestoneTrackerComponent; 087import net.tnemc.item.component.impl.LoreComponent; 088import net.tnemc.item.component.impl.MapColorComponent; 089import net.tnemc.item.component.impl.MapIDComponent; 090import net.tnemc.item.component.impl.MaxDamageComponent; 091import net.tnemc.item.component.impl.MaxStackSizeComponent; 092import net.tnemc.item.component.impl.ModelDataComponent; 093import net.tnemc.item.component.impl.ModelDataOldComponent; 094import net.tnemc.item.component.impl.NoteBlockSoundComponent; 095import net.tnemc.item.component.impl.OminousBottleAmplifierComponent; 096import net.tnemc.item.component.impl.PotDecorationsComponent; 097import net.tnemc.item.component.impl.PotionContentsComponent; 098import net.tnemc.item.component.impl.PotionDurationScaleComponent; 099import net.tnemc.item.component.impl.ProvidesBannerPatternsComponent; 100import net.tnemc.item.component.impl.ProvidesTrimMaterialComponent; 101import net.tnemc.item.component.impl.RarityComponent; 102import net.tnemc.item.component.impl.RecipesComponent; 103import net.tnemc.item.component.impl.RepairCostComponent; 104import net.tnemc.item.component.impl.RepairableComponent; 105import net.tnemc.item.component.impl.StoredEnchantmentsComponent; 106import net.tnemc.item.component.impl.SuspiciousStewEffectsComponent; 107import net.tnemc.item.component.impl.ToolComponent; 108import net.tnemc.item.component.impl.TooltipDisplayComponent; 109import net.tnemc.item.component.impl.TooltipStyleComponent; 110import net.tnemc.item.component.impl.TrimComponent; 111import net.tnemc.item.component.impl.UnbreakableComponent; 112import net.tnemc.item.component.impl.UseCooldownComponent; 113import net.tnemc.item.component.impl.WeaponComponent; 114import net.tnemc.item.component.impl.WritableBookContentComponent; 115import net.tnemc.item.component.impl.WrittenBookContentComponent; 116import net.tnemc.item.persistent.PersistentDataHolder; 117import net.tnemc.item.providers.ItemProvider; 118import net.tnemc.item.providers.SkullProfile; 119import org.bukkit.Material; 120import org.bukkit.NamespacedKey; 121import org.bukkit.Registry; 122import org.bukkit.inventory.ItemFlag; 123import org.bukkit.inventory.ItemStack; 124import org.bukkit.inventory.meta.ItemMeta; 125import org.json.simple.JSONObject; 126import org.json.simple.parser.ParseException; 127 128import java.util.ArrayList; 129import java.util.HashMap; 130import java.util.List; 131import java.util.Map; 132 133/** 134 * BukkitItemStack 135 * 136 * @author creatorfromhell 137 * @since 0.2.0.0 138 */ 139public class BukkitItemStack implements AbstractItemStack<ItemStack> { 140 141 private final Map<String, SerialComponent<AbstractItemStack<ItemStack>, ItemStack>> components = new HashMap<>(); 142 143 private final List<String> flags = new ArrayList<>(); 144 145 private final PersistentDataHolder holder = new PersistentDataHolder(); 146 147 private int slot = 0; 148 private String material; 149 private int amount = 1; 150 private boolean debug = false; 151 152 //item providers 153 private String itemProvider = BukkitItemPlatform.instance().defaultProviderIdentifier(); 154 private String providerItemID = material; 155 156 //our locale stack 157 private boolean dirty = false; 158 private ItemStack localeStack; 159 160 /** 161 * Creates a new item stack with the specified material and amount. 162 * 163 * @param material The material of the item. 164 * @param amount The number of items in the stack. 165 * 166 * @return A new item stack instance. 167 */ 168 @Override 169 public BukkitItemStack of(final String material, final int amount) { 170 171 this.material = material; 172 this.amount = amount; 173 174 this.dirty = true; 175 176 Material materialInstance = null; 177 178 try { 179 final NamespacedKey key = NamespacedKey.fromString(material); 180 if(key != null) { 181 182 System.out.println("Key is not null"); 183 184 materialInstance = Registry.MATERIAL.get(key); 185 } 186 } catch(final NoSuchMethodError ignore) { 187 materialInstance = Material.matchMaterial(material); 188 } 189 190 if(materialInstance == null) { 191 192 System.out.println("Material is null"); 193 194 return this; 195 } 196 197 this.localeStack = new ItemStack(materialInstance, amount); 198 199 //final ItemMeta meta = localeStack.getItemMeta(); 200 201 //TODO: Move default components and default values to the SerialComponent object somehow 202 //Maybe through isDefault and applyDefault methods 203 /*try { 204 205 System.out.println("Checking some values"); 206 System.out.println("Item Translation: " + materialInstance.getItemTranslationKey()); 207 if(meta != null) { 208 System.out.println("Has model: " + meta.hasItemModel()); 209 if(meta.hasLore()) { 210 System.out.println("Model: " + meta.getItemModel()); 211 } 212 } 213 214 if(meta != null && meta.hasRarity()) { 215 applyComponent(new BukkitRarityComponent(BukkitItemPlatform.instance().converter().convert(meta.getRarity(), String.class))); 216 } 217 } catch(final NoSuchMethodError ignore) { 218 } 219 220 try { 221 222 if(meta != null && meta.hasItemName()) { 223 System.out.println("Has item name: " + meta.getItemName()); 224 applyComponent(new BukkitItemNameComponent(LegacyComponentSerializer.legacySection().deserialize(meta.getItemName()))); 225 } 226 } catch(final NoSuchMethodError ignore) { 227 }*/ 228 229 //Apply our default components. 230 //applyComponent(new BukkitMaxStackSizeComponent(materialInstance.getMaxStackSize())); 231 //applyComponent(new BukkitEnchantmentsComponent()); 232 //applyComponent(new BukkitLoreComponent()); 233 //applyComponent(new BukkitRepairCostComponent()); 234 //applyComponent(new BukkitAttributeModifiersComponent()); 235 //applyComponent(new BukkitItemNameComponent()); 236 237 //TODO: Replace with custom solution? or would this be the best solution for the defaults? 238 // custom is kinda overcomplicated but what is the performance hand off of new stack -> serialized, 239 // alternatively we have to do this anyways for the locale cache? 240 return of(new ItemStack(materialInstance, amount)); 241 } 242 243 /** 244 * Creates a new item stack from a locale-specific object. 245 * 246 * @param locale The locale-specific representation. 247 * 248 * @return A new item stack instance. 249 */ 250 @Override 251 public BukkitItemStack of(final ItemStack locale) { 252 253 this.localeStack = locale; 254 255 try { 256 257 final NamespacedKey key = locale.getType().getKeyOrNull(); 258 if(key != null) { 259 260 System.out.println("Key is not null"); 261 262 material = key.toString(); 263 } 264 } catch(final NoSuchMethodError ignore) { 265 material = locale.getType().getKey().toString(); 266 } 267 268 this.amount = locale.getAmount(); 269 final ItemMeta meta = locale.getItemMeta(); 270 if(meta != null) { 271 for(final ItemFlag flag : meta.getItemFlags()) { 272 273 this.flags.add(flag.name()); 274 } 275 } 276 277 return BukkitItemPlatform.instance().serializer(this.localeStack, this); 278 } 279 280 /** 281 * Creates a new item stack from a JSON representation. 282 * 283 * @param json The JSON object containing item stack data. 284 * 285 * @return A new item stack instance. 286 * 287 * @throws ParseException If the JSON structure is invalid. 288 */ 289 @Override 290 public BukkitItemStack of(final JSONObject json) throws ParseException { 291 292 293 return this; 294 } 295 296 /** 297 * Sets the item flags. 298 * 299 * @param flags A list of flags to apply to the item. 300 * 301 * @return The updated item stack instance. 302 */ 303 @Override 304 public BukkitItemStack flags(final List<String> flags) { 305 306 this.flags.addAll(flags); 307 this.dirty = true; 308 return this; 309 } 310 311 /** 312 * Sets the lore (descriptive text) of the item stack. 313 * 314 * @param lore A list of components representing the lore. 315 * 316 * @return The updated item stack instance. 317 */ 318 @Override 319 public BukkitItemStack loreComponent(final List<Component> lore) { 320 321 applyComponent(new BukkitLoreComponent(lore)); 322 323 return this; 324 } 325 326 /** 327 * Adds an enchantment to the item stack. 328 * 329 * @param enchantment The enchantment name. 330 * @param level The level of the enchantment. 331 * 332 * @return The updated item stack instance. 333 */ 334 @Override 335 public BukkitItemStack enchant(final String enchantment, final int level) { 336 337 applyComponent(new BukkitEnchantmentsComponent(new HashMap<>(){{ 338 put(enchantment, level); 339 }})); 340 return this; 341 } 342 343 /** 344 * Adds multiple enchantments to the item stack. 345 * 346 * @param enchantments A map of enchantment names and levels. 347 * 348 * @return The updated item stack instance. 349 */ 350 @Override 351 public BukkitItemStack enchant(final Map<String, Integer> enchantments) { 352 353 applyComponent(new BukkitEnchantmentsComponent(enchantments)); 354 return this; 355 } 356 357 /** 358 * Adds enchantments to the item stack by name. 359 * 360 * @param enchantments A list of enchantment names. 361 * 362 * @return The updated item stack instance. 363 */ 364 @Override 365 public BukkitItemStack enchant(final List<String> enchantments) { 366 367 final Map<String, Integer> enchants = new HashMap<>(); 368 for(final String enchantment : enchantments) { 369 enchants.put(enchantment, 1); 370 } 371 applyComponent(new BukkitEnchantmentsComponent(enchants)); 372 return this; 373 } 374 375 /** 376 * Returns the material of the item stack. 377 * 378 * @return The material of the item stack. 379 */ 380 @Override 381 public String material() { 382 383 return material; 384 } 385 386 /** 387 * Sets the material of the item stack. 388 * 389 * @param material The material name. 390 * 391 * @return The updated item stack instance. 392 */ 393 @Override 394 public BukkitItemStack material(final String material) { 395 396 this.material = material; 397 this.dirty = true; 398 return this; 399 } 400 401 /** 402 * The quantity of the item stack. 403 * 404 * @return the quantity of the item stack. 405 */ 406 @Override 407 public int amount() { 408 409 return amount; 410 } 411 412 /** 413 * Sets the quantity of the item stack. 414 * 415 * @param amount The number of items in the stack. 416 * 417 * @return The updated item stack instance. 418 */ 419 @Override 420 public BukkitItemStack amount(final int amount) { 421 422 this.amount = amount; 423 this.dirty = true; 424 return this; 425 } 426 427 /** 428 * Represents the inventory slot of the item stack. 429 * 430 * @return the inventory slot of the item stack. 431 */ 432 @Override 433 public int slot() { 434 435 return slot; 436 } 437 438 /** 439 * Sets the inventory slot of the item stack. 440 * 441 * @param slot The slot index. 442 * 443 * @return The updated item stack instance. 444 */ 445 @Override 446 public BukkitItemStack slot(final int slot) { 447 448 this.slot = slot; 449 this.dirty = true; 450 return this; 451 } 452 453 /** 454 * Enables or disables debug mode for the item stack. 455 * 456 * @param debug True to enable, false to disable. 457 * 458 * @return The updated item stack instance. 459 */ 460 @Override 461 public BukkitItemStack debug(final boolean debug) { 462 463 this.debug = debug; 464 return this; 465 } 466 467 public ItemStack cacheLocale() { 468 469 return this.localeStack; 470 } 471 472 public void updateCache(final ItemStack localeStack) { 473 474 this.localeStack = localeStack; 475 } 476 477 /** 478 * Replaces the persistent data holder for the item stack. 479 * 480 * @param newHolder The new persistent data holder. 481 * @param replaceOld True to replace existing data, false to merge. 482 * 483 * @return The updated item stack instance. 484 * 485 * @since 0.2.0.0 486 */ 487 @Override 488 public BukkitItemStack applyPersistentHolder(final PersistentDataHolder newHolder, final boolean replaceOld) { 489 490 if(replaceOld) { 491 this.holder.getData().clear(); 492 } 493 494 this.holder.getData().putAll(newHolder.getData()); 495 this.dirty = true; 496 return this; 497 } 498 499 /** 500 * Retrieves the item flags. 501 * 502 * @return A list of flags applied to the item. 503 */ 504 @Override 505 public List<String> flags() { 506 507 return this.flags; 508 } 509 510 /** 511 * Retrieves the components applied to the item stack. 512 * 513 * @return A map of component types and their serialized representations. 514 * 515 * @since 0.2.0.0 516 */ 517 @Override 518 public Map<String, SerialComponent<AbstractItemStack<ItemStack>, ItemStack>> components() { 519 520 return components; 521 } 522 523 /** 524 * Retrieves the persistent data holder for the item stack. 525 * 526 * @return The persistent data holder. 527 * 528 * @since 0.2.0.0 529 */ 530 @Override 531 public PersistentDataHolder persistentHolder() { 532 533 return holder; 534 } 535 536 /** 537 * Resets the dirty flag, indicating that the object's state has been synchronized with the 538 * database. 539 */ 540 @Override 541 public void resetDirty() { 542 this.dirty = false; 543 } 544 545 /** 546 * Marks the item stack as dirty, indicating changes have been made. 547 */ 548 @Override 549 public void markDirty() { 550 551 this.dirty = true; 552 } 553 554 /** 555 * Checks whether the object is dirty or has unsaved changes. 556 * 557 * @return true if the object is dirty, false otherwise 558 */ 559 @Override 560 public boolean isDirty() { 561 562 return this.dirty; 563 } 564 565 /** 566 * This method returns a String representing the item provider. 567 * 568 * @return the item provider as a String 569 * 570 * @see ItemProvider 571 */ 572 @Override 573 public String itemProvider() { 574 575 return this.itemProvider; 576 } 577 578 /** 579 * Sets the item provider to be used for retrieving items. 580 * 581 * @param itemProvider the string representing the item provider to be set 582 */ 583 @Override 584 public BukkitItemStack setItemProvider(final String itemProvider) { 585 this.itemProvider = itemProvider; 586 this.dirty = true; 587 return this; 588 } 589 590 /** 591 * Retrieves the provider item ID associated with the current object. 592 * 593 * @return The provider item ID of the object. 594 */ 595 @Override 596 public String providerItemID() { 597 598 return this.providerItemID; 599 } 600 601 /** 602 * Sets the provider's item ID for the current item. 603 * 604 * @param providerItemID the unique ID assigned by the provider for the item 605 */ 606 @Override 607 public BukkitItemStack setProviderItemID(final String providerItemID) { 608 609 this.providerItemID = providerItemID; 610 this.dirty = true; 611 return this; 612 } 613 614 /** 615 * This method is used to return an ItemProvider object. 616 * 617 * @return ItemProvider object representing the item provider. 618 */ 619 @Override 620 public ItemProvider<ItemStack> provider() { 621 622 return BukkitItemPlatform.instance().provider(itemProvider); 623 } 624 625 /** 626 * Converts the object to a JSONObject representation. 627 * 628 * @return A JSONObject representing the object data. 629 */ 630 @Override 631 public JSONObject toJSON() { 632 633 return null; 634 } 635 636 @Override 637 public BukkitItemStack clone() { 638 final BukkitItemStack copy = new BukkitItemStack(); 639 640 //Basics 641 copy.material = this.material; 642 copy.amount = this.amount; 643 copy.slot = this.slot; 644 copy.debug = this.debug; 645 646 //Flags 647 copy.flags.addAll(this.flags); 648 649 //Components 650 for(final Map.Entry<String, SerialComponent<AbstractItemStack<ItemStack>, ItemStack>> entry : this.components.entrySet()) { 651 652 //TODO: clone components 653 //final SerialComponent<AbstractItemStack<ItemStack>, ItemStack> clonedComponent = entry.getValue().cloneComponent(); 654 //copy.components.put(entry.getKey(), clonedComponent); 655 } 656 657 //PersistentData 658 final PersistentDataHolder clonedHolder = new PersistentDataHolder(); 659 clonedHolder.getData().putAll(this.holder.getData()); 660 copy.applyPersistentHolder(clonedHolder, true); 661 662 //Item Provider 663 copy.itemProvider = this.itemProvider; 664 copy.providerItemID = this.providerItemID; 665 666 //Mark the clone as dirty 667 copy.dirty = true; 668 669 return copy; 670 } 671 672 /** 673 * Updates the attribute modifiers of the item stack. 674 * 675 * @param modifiers a list of attribute modifiers 676 * @param showInTooltip whether to display the modifiers in the tooltip 677 * 678 * @return the updated BukkitItemStack instance 679 * 680 * @see AttributeModifiersComponent 681 * @since 0.2.0.0 682 */ 683 @Override 684 public BukkitItemStack attributeModifiers(final List<AttributeModifier> modifiers, final boolean showInTooltip) { 685 686 return this; 687 } 688 689 /** 690 * Updates the banner patterns of the item stack. 691 * 692 * @param patterns a list of pattern data 693 * 694 * @return the updated BukkitItemStack instance 695 * 696 * @see BannerPatternsComponent 697 * @since 0.2.0.0 698 */ 699 @Override 700 public BukkitItemStack bannerPatterns(final List<PatternData> patterns) { 701 702 return this; 703 } 704 705 /** 706 * Updates the base color of the item stack. 707 * 708 * @param color the new base color 709 * 710 * @return the updated BukkitItemStack instance 711 * 712 * @see BaseColorComponent 713 * @since 0.2.0.0 714 */ 715 @Override 716 public BukkitItemStack baseColor(final String color) { 717 718 return this; 719 } 720 721 /** 722 * Blocks attacks with the specified damage type using this item. 723 * 724 * @param damage the type of damage to block attacks from 725 * 726 * @return an AbstractItemStack object representing the item after blocking attacks 727 * 728 * @see BlocksAttacksComponent 729 * @since 0.2.0.0 730 */ 731 @Override 732 public AbstractItemStack<ItemStack> blocksAttacks(final ItemDamage damage) { 733 734 return this; 735 } 736 737 /** 738 * Set the break sound for this item stack. 739 * 740 * @param sound the sound to be played when the item is broken 741 * 742 * @return the updated item stack object 743 * 744 * @see BreakSoundComponent 745 * @since 0.2.0.0 746 */ 747 @Override 748 public AbstractItemStack<ItemStack> breakSound(final String sound) { 749 750 return this; 751 } 752 753 /** 754 * Updates the bucket entity data of the item stack. 755 * 756 * @param noAI whether the entity has AI disabled 757 * @param silent whether the entity is silent 758 * @param noGravity whether the entity is affected by gravity 759 * @param glowing whether the entity is glowing 760 * @param invulnerable whether the entity is invulnerable 761 * @param health the health of the entity 762 * @param age the age of the entity 763 * @param variant the variant of the entity 764 * @param huntingCooldown the hunting cooldown of the entity 765 * @param bucketVariantTag the variant tag of the bucket 766 * @param type the type of the entity 767 * 768 * @return the updated BukkitItemStack instance 769 * 770 * @see BucketEntityDataComponent 771 * @since 0.2.0.0 772 */ 773 @Override 774 public BukkitItemStack bucketEntityData(final boolean noAI, final boolean silent, final boolean noGravity, final boolean glowing, final boolean invulnerable, final float health, final int age, final int variant, final long huntingCooldown, final int bucketVariantTag, final String type) { 775 776 return this; 777 } 778 779 /** 780 * Bundles a collection of {@link AbstractItemStack} instances into a single collection. 781 * 782 * @param items A {@link Map} containing integer keys and {@link AbstractItemStack} values to be 783 * bundled. 784 * 785 * @return An {@link AbstractItemStack} instance that represents the bundled items. 786 * 787 * @see BundleComponent 788 * @since 0.2.0.0 789 */ 790 @Override 791 public BukkitItemStack bundle(final Map<Integer, AbstractItemStack<ItemStack>> items) { 792 793 applyComponent(new BukkitBundleComponent(items)); 794 this.dirty = true; 795 return this; 796 } 797 798 /** 799 * Updates the blocks that the item stack can break. 800 * 801 * @param predicates a list of block predicates 802 * 803 * @return the updated BukkitItemStack instance 804 * 805 * @see CanBreakComponent 806 * @since 0.2.0.0 807 */ 808 @Override 809 public BukkitItemStack canBreak(final List<BlockPredicate> predicates) { 810 811 return this; 812 } 813 814 /** 815 * Updates the blocks that the item stack can be placed on. 816 * 817 * @param predicates a list of block predicates 818 * 819 * @return the updated BukkitItemStack instance 820 * 821 * @see CanPlaceOnComponent 822 * @since 0.2.0.0 823 */ 824 @Override 825 public BukkitItemStack canPlaceOn(final List<BlockPredicate> predicates) { 826 827 return this; 828 } 829 830 /** 831 * Updates the consumable properties of the item stack. 832 * 833 * @param consumeSeconds the time it takes to consume the item 834 * @param animation the animation to display when consuming 835 * @param sound the sound to play when consuming 836 * @param hasConsumeParticles whether to show consume particles 837 * @param effects a list of effects applied on consumption 838 * 839 * @return the updated BukkitItemStack instance 840 * 841 * @see ConsumableComponent 842 * @since 0.2.0.0 843 */ 844 @Override 845 public BukkitItemStack consumable(final float consumeSeconds, final String animation, final String sound, final boolean hasConsumeParticles, final List<ComponentEffect> effects) { 846 847 return this; 848 } 849 850 /** 851 * Constructs a container with the given map of items. 852 * 853 * @param items a map of items where the key is the position of the item in the container and the 854 * value is the item 855 * 856 * @return an AbstractItemStack container with the specified items 857 * 858 * @see ContainerComponent 859 * @since 0.2.0.0 860 */ 861 @Override 862 public BukkitItemStack container(final Map<Integer, AbstractItemStack<ItemStack>> items) { 863 864 applyComponent(new BukkitContainerComponent(items)); 865 this.dirty = true; 866 return this; 867 } 868 869 /** 870 * Updates the custom name of the item stack. 871 * 872 * @param customName the custom name to set 873 * 874 * @return the updated BukkitItemStack instance 875 * 876 * @see CustomNameComponent 877 * @since 0.2.0.0 878 */ 879 @Override 880 public BukkitItemStack customName(final Component customName) { 881 882 applyComponent(new BukkitCustomNameComponent(customName)); 883 this.dirty = true; 884 return this; 885 } 886 887 /** 888 * Updates the damage of the item stack. 889 * 890 * @param damage the damage value to set 891 * 892 * @return the updated BukkitItemStack instance 893 * 894 * @see DamageComponent 895 * @since 0.2.0.0 896 */ 897 @Override 898 public BukkitItemStack damage(final int damage) { 899 900 applyComponent(new BukkitDamageComponent(damage)); 901 this.dirty = true; 902 return this; 903 } 904 905 /** 906 * Updates the damage-resistant types of the item stack. 907 * 908 * @param types a list of damage-resistant types 909 * 910 * @return the updated BukkitItemStack instance 911 * 912 * @see DamageResistantComponent 913 * @since 0.2.0.0 914 */ 915 @Override 916 public BukkitItemStack damageResistant(final List<String> types) { 917 918 return this; 919 } 920 921 /** 922 * Updates the death protection effects of the item stack. 923 * 924 * @param deathEffects a list of death protection effects 925 * 926 * @return the updated BukkitItemStack instance 927 * 928 * @see DeathProtectionComponent 929 * @since 0.2.0.0 930 */ 931 @Override 932 public BukkitItemStack deathProtection(final List<ComponentEffect> deathEffects) { 933 934 return this; 935 } 936 937 /** 938 * Updates the dyed color of the item stack. 939 * 940 * @param rgb the RGB color value to set 941 * 942 * @return the updated BukkitItemStack instance 943 * 944 * @see DyedColorComponent 945 * @since 0.2.0.0 946 */ 947 @Override 948 public BukkitItemStack dyedColor(final int rgb) { 949 950 applyComponent(new BukkitDyedColorComponent(rgb)); 951 this.dirty = true; 952 return this; 953 } 954 955 /** 956 * Updates the enchantability of the item stack. 957 * 958 * @param value the enchantability value to set 959 * 960 * @return the updated BukkitItemStack instance 961 * 962 * @see EnchantableComponent 963 * @since 0.2.0.0 964 */ 965 @Override 966 public BukkitItemStack enchantable(final int value) { 967 968 applyComponent(new BukkitEnchantableComponent(value)); 969 return this; 970 } 971 972 /** 973 * Updates the enchantment glint override of the item stack. 974 * 975 * @param glintOverride whether the enchantment glint should be overridden 976 * 977 * @return the updated BukkitItemStack instance 978 * 979 * @see EnchantmentGlintOverrideComponent 980 * @since 0.2.0.0 981 */ 982 @Override 983 public BukkitItemStack enchantmentGlintOverride(final boolean glintOverride) { 984 return this; 985 } 986 987 /** 988 * Updates the enchantments of the item stack. 989 * 990 * @param levels a map of enchantments and their levels 991 * 992 * @return the updated BukkitItemStack instance 993 * 994 * @see EnchantmentsComponent 995 * @since 0.2.0.0 996 */ 997 @Override 998 public BukkitItemStack enchantments(final Map<String, Integer> levels) { 999 1000 applyComponent(new BukkitEnchantmentsComponent(levels)); 1001 this.dirty = true; 1002 return this; 1003 } 1004 1005 /** 1006 * Generates an AbstractItemStack based on the given entity and variant. 1007 * 1008 * @param entity the entity name to create the stack for 1009 * @param variant the variant of the entity 1010 * 1011 * @return an AbstractItemStack representing the entity with the specified variant 1012 * 1013 * @see EntityVariantComponent 1014 * @since 0.2.0.0 1015 */ 1016 @Override 1017 public AbstractItemStack<ItemStack> entityVariant(final String entity, final String variant) { 1018 1019 return this; 1020 } 1021 1022 /** 1023 * Equips an item with specified parameters. 1024 * 1025 * @param cameraKey the key identifying the camera 1026 * @param equipSound the key identifying the equip sound 1027 * @param modelKey the key identifying the model 1028 * @param slot the slot in which the item should be equipped 1029 * @param damageOnHurt flag indicating if damage should be taken on hurt 1030 * @param dispensable flag indicating if the item is dispensable 1031 * @param swappable flag indicating if the item is swappable 1032 * @param equipOnInteract flag indicating if the item should be equipped on interact 1033 * @param entities a list of entities to be equipped 1034 * 1035 * @return an BukkitItemStack object representing the equipped item 1036 * 1037 * @see EquipComponent 1038 * @since 0.2.0.0 1039 */ 1040 @Override 1041 public BukkitItemStack equip(final String cameraKey, final String equipSound, final String modelKey, 1042 final EquipSlot slot, final boolean damageOnHurt, final boolean dispensable, 1043 final boolean swappable, final boolean equipOnInteract, final List<String> entities) { 1044 1045 return this; 1046 } 1047 1048 /** 1049 * Updates the firework explosion properties of the item stack. 1050 * 1051 * @param explosion the explosion data to set 1052 * 1053 * @return the updated BukkitItemStack instance 1054 * 1055 * @see FireworkExplosionComponent 1056 * @since 0.2.0.0 1057 */ 1058 @Override 1059 public BukkitItemStack fireworkExplosion(final ExplosionData explosion) { 1060 1061 return this; 1062 } 1063 1064 /** 1065 * Updates the fireworks properties of the item stack. 1066 * 1067 * @param flightDuration the flight duration of the fireworks 1068 * @param explosions a list of explosion data 1069 * 1070 * @return the updated BukkitItemStack instance 1071 * 1072 * @see FireworksComponent 1073 * @since 0.2.0.0 1074 */ 1075 @Override 1076 public BukkitItemStack fireworks(final byte flightDuration, final List<ExplosionData> explosions) { 1077 1078 return this; 1079 } 1080 1081 /** 1082 * Updates the food properties of the item stack. 1083 * 1084 * @param noHunger whether the item causes no hunger 1085 * @param saturation the saturation value 1086 * @param nutrition the nutrition value 1087 * 1088 * @return the updated BukkitItemStack instance 1089 * 1090 * @see FoodComponent 1091 * @since 0.2.0.0 1092 */ 1093 @Override 1094 public BukkitItemStack food(final boolean noHunger, final float saturation, final int nutrition) { 1095 1096 return this; 1097 } 1098 1099 /** 1100 * Updates the item stack to enable glider functionality. 1101 * 1102 * @return the updated BukkitItemStack instance 1103 * 1104 * @see GliderComponent 1105 * @since 0.2.0.0 1106 */ 1107 @Override 1108 public BukkitItemStack gliderTag() { 1109 1110 return this; 1111 } 1112 1113 /** 1114 * Updates the item stack to hide additional tooltip. 1115 * 1116 * @return the updated BukkitItemStack instance 1117 * 1118 * @see HideAdditionalTooltipComponent 1119 * @since 0.2.0.0 1120 */ 1121 @Override 1122 public BukkitItemStack hideAdditionalTooltipTag() { 1123 1124 return this; 1125 } 1126 1127 /** 1128 * Updates the item stack to hide its tooltip. 1129 * 1130 * @return the updated BukkitItemStack instance 1131 * 1132 * @see HideTooltipComponent 1133 * @since 0.2.0.0 1134 */ 1135 @Override 1136 public BukkitItemStack hideTooltipTag() { 1137 1138 return this; 1139 } 1140 1141 /** 1142 * Updates the instrument properties of the item stack. 1143 * 1144 * @param soundEvent the sound event identifier 1145 * @param useDuration the duration of the sound in ticks 1146 * @param range the range of the sound 1147 * 1148 * @return the updated BukkitItemStack instance 1149 * 1150 * @see InstrumentComponent 1151 * @since 0.2.0.0 1152 */ 1153 @Override 1154 public BukkitItemStack instrument(final String soundEvent, final int useDuration, final int range) { 1155 1156 return this; 1157 } 1158 1159 /** 1160 * Updates the item stack as an intangible projectile. 1161 * 1162 * @return the updated BukkitItemStack instance 1163 * 1164 * @see IntangibleProjectileComponent 1165 * @since 0.2.0.0 1166 */ 1167 @Override 1168 public BukkitItemStack intangibleProjectileTag() { 1169 1170 return this; 1171 } 1172 1173 /** 1174 * Updates the model properties of the item stack. 1175 * 1176 * @param model the model identifier 1177 * 1178 * @return the updated BukkitItemStack instance 1179 * 1180 * @see ItemModelComponent 1181 * @since 0.2.0.0 1182 */ 1183 @Override 1184 public BukkitItemStack itemModel(final String model) { 1185 1186 applyComponent(new BukkitItemModelComponent(model)); 1187 this.dirty = true; 1188 return this; 1189 } 1190 1191 /** 1192 * Updates the name of the item stack. 1193 * 1194 * @param itemName the name of the item 1195 * 1196 * @return the updated BukkitItemStack instance 1197 * 1198 * @see ItemNameComponent 1199 * @since 0.2.0.0 1200 */ 1201 @Override 1202 public BukkitItemStack itemName(final Component itemName) { 1203 1204 applyComponent(new BukkitItemNameComponent(itemName)); 1205 this.dirty = true; 1206 return this; 1207 } 1208 1209 /** 1210 * Updates the jukebox properties of the item stack. 1211 * 1212 * @param song the song identifier 1213 * @param showInTooltip whether to display the song in the tooltip 1214 * 1215 * @return the updated BukkitItemStack instance 1216 * 1217 * @see JukeBoxComponent 1218 * @since 0.2.0.0 1219 */ 1220 @Override 1221 public BukkitItemStack jukebox(final String song, final boolean showInTooltip) { 1222 1223 return this; 1224 } 1225 1226 /** 1227 * Updates the lodestone tracker properties of the item stack. 1228 * 1229 * @param target the target identifier 1230 * @param pos the position array 1231 * @param dimension the dimension identifier 1232 * @param tracked whether the lodestone is tracked 1233 * 1234 * @return the updated BukkitItemStack instance 1235 * 1236 * @see LodestoneTrackerComponent 1237 * @since 0.2.0.0 1238 */ 1239 @Override 1240 public BukkitItemStack lodestoneTracker(final String target, final int[] pos, final String dimension, final boolean tracked) { 1241 1242 return this; 1243 } 1244 1245 /** 1246 * Updates the lore of the item stack. 1247 * 1248 * @param lore a list of lore strings 1249 * 1250 * @return the updated BukkitItemStack instance 1251 * 1252 * @see LoreComponent 1253 * @since 0.2.0.0 1254 */ 1255 @Override 1256 public BukkitItemStack lore(final List<Component> lore) { 1257 1258 applyComponent(new BukkitLoreComponent(lore)); 1259 this.dirty = true; 1260 return this; 1261 } 1262 1263 /** 1264 * Updates the map color of the item stack. 1265 * 1266 * @param mapColor the map color value 1267 * 1268 * @return the updated BukkitItemStack instance 1269 * 1270 * @see MapColorComponent 1271 * @since 0.2.0.0 1272 */ 1273 @Override 1274 public BukkitItemStack mapColor(final int mapColor) { 1275 1276 return this; 1277 } 1278 1279 /** 1280 * Updates the map ID of the item stack. 1281 * 1282 * @param mapId the map ID value 1283 * 1284 * @return the updated BukkitItemStack instance 1285 * 1286 * @see MapIDComponent 1287 * @since 0.2.0.0 1288 */ 1289 @Override 1290 public BukkitItemStack mapId(final int mapId) { 1291 1292 return this; 1293 } 1294 1295 /** 1296 * Updates the maximum damage of the item stack. 1297 * 1298 * @param maxDamage the maximum damage value 1299 * 1300 * @return the updated BukkitItemStack instance 1301 * 1302 * @see MaxDamageComponent 1303 * @since 0.2.0.0 1304 */ 1305 @Override 1306 public BukkitItemStack maxDamage(final int maxDamage) { 1307 1308 applyComponent(new BukkitMaxDamageComponent(maxDamage)); 1309 return this; 1310 } 1311 1312 /** 1313 * Updates the maximum stack size of the item stack. 1314 * 1315 * @param maxStackSize the maximum stack size value 1316 * 1317 * @return the updated BukkitItemStack instance 1318 * 1319 * @see MaxStackSizeComponent 1320 * @since 0.2.0.0 1321 */ 1322 @Override 1323 public BukkitItemStack maxStackSize(final int maxStackSize) { 1324 1325 applyComponent(new BukkitMaxStackSizeComponent(maxStackSize)); 1326 return this; 1327 } 1328 1329 /** 1330 * Updates the model data of the item stack. 1331 * 1332 * @param colours a list of color strings 1333 * @param floats a list of float values 1334 * @param flags a list of boolean flags 1335 * @param strings a list of string identifiers 1336 * 1337 * @return the updated BukkitItemStack instance 1338 * 1339 * @see ModelDataComponent 1340 * @since 0.2.0.0 1341 */ 1342 @Override 1343 public BukkitItemStack modelData(final List<String> colours, final List<Float> floats, final List<Boolean> flags, final List<String> strings) { 1344 1345 applyComponent(new BukkitModelDataComponent(colours, floats, flags, strings)); 1346 this.dirty = true; 1347 return this; 1348 } 1349 1350 /** 1351 * Retrieves the model data for a custom item stack. 1352 * 1353 * @param customModelData the custom model data to retrieve 1354 * 1355 * @return an AbstractItemStack with the specified custom model data 1356 * 1357 * @see ModelDataOldComponent 1358 * @since 0.2.0.0 1359 * @deprecated Since MC 1.21.3 Use {@link ItemModelComponent} and {@link ModelDataComponent}. 1360 */ 1361 @Override 1362 public AbstractItemStack<ItemStack> modelDataOld(final int customModelData) { 1363 1364 applyComponent(new BukkitModelDataOldComponent(customModelData)); 1365 this.dirty = true; 1366 return this; 1367 } 1368 1369 /** 1370 * Updates the note block sound of the item stack. 1371 * 1372 * @param soundId the identifier of the sound 1373 * 1374 * @return the updated BukkitItemStack instance 1375 * 1376 * @see NoteBlockSoundComponent 1377 * @since 0.2.0.0 1378 */ 1379 @Override 1380 public BukkitItemStack noteBlockSound(final String soundId) { 1381 1382 return this; 1383 } 1384 1385 /** 1386 * Updates the ominous bottle amplifier of the item stack. 1387 * 1388 * @param amplifier the amplifier value 1389 * 1390 * @return the updated BukkitItemStack instance 1391 * 1392 * @see OminousBottleAmplifierComponent 1393 * @since 0.2.0.0 1394 */ 1395 @Override 1396 public BukkitItemStack ominousBottleAmplifier(final int amplifier) { 1397 1398 return this; 1399 } 1400 1401 /** 1402 * Updates the pot decorations of the item stack. 1403 * 1404 * @param decorations a list of decorations 1405 * 1406 * @return the updated BukkitItemStack instance 1407 * 1408 * @see PotDecorationsComponent 1409 * @since 0.2.0.0 1410 */ 1411 @Override 1412 public BukkitItemStack potDecorations(final List<String> decorations) { 1413 1414 return this; 1415 } 1416 1417 /** 1418 * Updates the potion contents of the item stack. 1419 * 1420 * @param potionId the ID of the potion 1421 * @param customColor the custom color of the potion 1422 * @param customName the custom name of the potion 1423 * @param effects a list of effect instances 1424 * 1425 * @return the updated BukkitItemStack instance 1426 * 1427 * @see PotionContentsComponent 1428 * @since 0.2.0.0 1429 */ 1430 @Override 1431 public BukkitItemStack potionContents(final String potionId, final int customColor, final String customName, final List<EffectInstance> effects) { 1432 1433 return this; 1434 } 1435 1436 /** 1437 * Sets the duration of a potion effect for the item stack. Since MC Snapshot 25w02a. 1438 * 1439 * @param potionDuration the duration of the potion effect in seconds 1440 * 1441 * @return the modified BukkitItemStack object with the updated potion duration 1442 * 1443 * @see PotionDurationScaleComponent 1444 * @since 0.2.0.0 1445 */ 1446 @Override 1447 public BukkitItemStack potionDuration(final float potionDuration) { 1448 1449 return this; 1450 } 1451 1452 /** 1453 * Profiles the given SkullProfile to the BukkitItemStack object. 1454 * 1455 * @param profile the SkullProfile to be assigned 1456 * 1457 * @return an BukkitItemStack object with the provided profile 1458 */ 1459 @Override 1460 public BukkitItemStack profile(final SkullProfile profile) { 1461 1462 applyComponent(new BukkitProfileComponent(profile)); 1463 this.dirty = true; 1464 return this; 1465 } 1466 1467 /** 1468 * Retrieve an AbstractItemStack object that provides a specific pattern identified by the 1469 * patternTag. 1470 * 1471 * @param patternTag The unique identifier of the pattern to be provided. 1472 * 1473 * @return An AbstractItemStack object that provides the specified pattern. 1474 * 1475 * @see ProvidesBannerPatternsComponent 1476 * @since 0.2.0.0 1477 */ 1478 @Override 1479 public AbstractItemStack<ItemStack> providesPattern(final String patternTag) { 1480 1481 return this; 1482 } 1483 1484 /** 1485 * Applies the specified trim material 1486 * 1487 * @param material the trim material 1488 * 1489 * @return an AbstractItemStack object representing the trimmed material 1490 * 1491 * @see ProvidesTrimMaterialComponent 1492 * @since 0.2.0.0 1493 */ 1494 @Override 1495 public AbstractItemStack<ItemStack> providesTrim(final String material) { 1496 1497 return this; 1498 } 1499 1500 /** 1501 * Updates the rarity of the item stack. 1502 * 1503 * @param rarity the rarity value 1504 * 1505 * @return the updated BukkitItemStack instance 1506 * 1507 * @see RarityComponent 1508 * @since 0.2.0.0 1509 */ 1510 @Override 1511 public BukkitItemStack rarity(final String rarity) { 1512 1513 return this; 1514 } 1515 1516 /** 1517 * Updates the recipes of the item stack. 1518 * 1519 * @param recipes a list of recipe identifiers 1520 * 1521 * @return the updated BukkitItemStack instance 1522 * 1523 * @see RecipesComponent 1524 * @since 0.2.0.0 1525 */ 1526 @Override 1527 public BukkitItemStack recipes(final List<String> recipes) { 1528 1529 return this; 1530 } 1531 1532 /** 1533 * Updates the repairable items of the item stack. 1534 * 1535 * @param repairItems a list of repair item identifiers 1536 * 1537 * @return the updated BukkitItemStack instance 1538 * 1539 * @see RepairableComponent 1540 * @since 0.2.0.0 1541 */ 1542 @Override 1543 public BukkitItemStack repairable(final List<String> repairItems) { 1544 1545 return this; 1546 } 1547 1548 /** 1549 * Updates the repair cost of the item stack. 1550 * 1551 * @param repairCost the repair cost value 1552 * 1553 * @return the updated BukkitItemStack instance 1554 * 1555 * @see RepairCostComponent 1556 * @since 0.2.0.0 1557 */ 1558 @Override 1559 public BukkitItemStack repairCost(final int repairCost) { 1560 1561 return this; 1562 } 1563 1564 /** 1565 * Updates the stored enchantments of the item stack. 1566 * 1567 * @param enchantments a map of enchantment names to their levels 1568 * 1569 * @return the updated BukkitItemStack instance 1570 * 1571 * @see StoredEnchantmentsComponent 1572 * @since 0.2.0.0 1573 */ 1574 @Override 1575 public BukkitItemStack storedEnchantments(final Map<String, Integer> enchantments) { 1576 1577 return this; 1578 } 1579 1580 /** 1581 * Applies the given effects to the suspicious stew item. 1582 * 1583 * @param effects a list of EffectInstance objects representing the effects to be applied to the 1584 * suspicious stew 1585 * 1586 * @return an AbstractItemStack representing the suspicious stew with the applied effects 1587 * 1588 * @see SuspiciousStewEffectsComponent 1589 * @since 0.2.0.0 1590 */ 1591 @Override 1592 public AbstractItemStack<ItemStack> suspiciousStewEffects(final List<EffectInstance> effects) { 1593 1594 return this; 1595 } 1596 1597 /** 1598 * Applies the given effects to a suspicious stew item. 1599 * 1600 * @param effects an array of EffectInstance objects representing the effects to apply to the 1601 * suspicious stew 1602 * 1603 * @return an AbstractItemStack representing the suspicious stew item with the applied effects 1604 * 1605 * @see SuspiciousStewEffectsComponent 1606 * @since 0.2.0.0 1607 */ 1608 @Override 1609 public AbstractItemStack<ItemStack> suspiciousStewEffects(final EffectInstance... effects) { 1610 1611 return this; 1612 } 1613 1614 /** 1615 * Constructs a new tool item with the specified characteristics. 1616 * 1617 * @param defaultSpeed the default speed of the tool 1618 * @param blockDamage the damage inflicted by the tool to blocks 1619 * @param canDestroyBlocksCreative if the tool can destroy blocks in creative mode 1620 * @param rules a list of rules that define the behavior of the tool 1621 * 1622 * @return an BukkitItemStack instance representing the created tool 1623 * 1624 * @see ToolComponent 1625 * @since 0.2.0.0 1626 */ 1627 @Override 1628 public BukkitItemStack tool(final float defaultSpeed, final int blockDamage, final boolean canDestroyBlocksCreative, final List<ToolRule> rules) { 1629 1630 return this; 1631 } 1632 1633 /** 1634 * Displays tooltip for the item stack with an option to hide certain components. 1635 * 1636 * @param hideTooltip Flag to hide the tooltip 1637 * @param hiddenComponents Array of components to hide in the tooltip 1638 * 1639 * @return An AbstractItemStack object with the tooltip displayed 1640 * 1641 * @see TooltipDisplayComponent 1642 * @since 0.2.0.0 1643 */ 1644 @Override 1645 public AbstractItemStack<ItemStack> tooltipDisplay(final boolean hideTooltip, final String... hiddenComponents) { 1646 1647 return this; 1648 } 1649 1650 /** 1651 * Updates the tooltip style of the item stack. 1652 * 1653 * @param style the style to apply to the tooltip 1654 * 1655 * @return the updated BukkitItemStack instance 1656 * 1657 * @see TooltipStyleComponent 1658 * @since 0.2.0.0 1659 */ 1660 @Override 1661 public BukkitItemStack tooltipStyle(final String style) { 1662 1663 applyComponent(new BukkitTooltipStyleComponent(style)); 1664 return this; 1665 } 1666 1667 /** 1668 * Updates the trim properties of the item stack. 1669 * 1670 * @param pattern the trim pattern 1671 * @param material the trim material 1672 * @param showInTooltip whether to display the trim in the tooltip 1673 * 1674 * @return the updated BukkitItemStack instance 1675 * 1676 * @see TrimComponent 1677 * @since 0.2.0.0 1678 */ 1679 @Override 1680 public BukkitItemStack trim(final String pattern, final String material, final boolean showInTooltip) { 1681 1682 return this; 1683 } 1684 1685 /** 1686 * Updates the unbreakable property of the item stack. 1687 * 1688 * @param showInTooltip whether to display the unbreakable property in the tooltip 1689 * 1690 * @return the updated BukkitItemStack instance 1691 * 1692 * @see UnbreakableComponent 1693 * @since 0.2.0.0 1694 */ 1695 @Override 1696 public BukkitItemStack unbreakable(final boolean showInTooltip) { 1697 1698 return this; 1699 } 1700 1701 /** 1702 * Updates the use cooldown properties of the item stack. 1703 * 1704 * @param cooldownGroup the cooldown group identifier 1705 * @param seconds the cooldown duration in seconds 1706 * 1707 * @return the updated BukkitItemStack instance 1708 * 1709 * @see UseCooldownComponent 1710 * @since 0.2.0.0 1711 */ 1712 @Override 1713 public BukkitItemStack useCooldown(final String cooldownGroup, final float seconds) { 1714 1715 return this; 1716 } 1717 1718 /** 1719 * Represents a weapon item that can be used for combat. Since MC Snapshot 25w02a. 1720 * 1721 * @param damagePerAttack The amount of damage this weapon inflicts per attack 1722 * @param canDisableBlocking Whether this weapon can disable blocking when used 1723 * 1724 * @see WeaponComponent 1725 * @since 0.2.0.0 1726 */ 1727 @Override 1728 public BukkitItemStack weapon(final int damagePerAttack, final boolean canDisableBlocking) { 1729 1730 return this; 1731 } 1732 1733 /** 1734 * Updates the writable book content of the item stack. 1735 * 1736 * @param pages the pages to include in the writable book 1737 * 1738 * @return the updated BukkitItemStack instance 1739 * 1740 * @see WritableBookContentComponent 1741 * @since 0.2.0.0 1742 */ 1743 @Override 1744 public BukkitItemStack writableBookContent(final List<String> pages) { 1745 1746 return this; 1747 } 1748 1749 /** 1750 * Updates the written book content of the item stack. 1751 * 1752 * @param title the title of the book 1753 * @param author the author of the book 1754 * @param generation the generation of the book 1755 * @param resolved whether the book is resolved 1756 * @param pages the pages to include in the book 1757 * 1758 * @return the updated BukkitItemStack instance 1759 * 1760 * @see WrittenBookContentComponent 1761 * @since 0.2.0.0 1762 */ 1763 @Override 1764 public BukkitItemStack writtenBookContent(final String title, final String author, final int generation, final boolean resolved, final List<String> pages) { 1765 1766 return this; 1767 } 1768}