UNPKG

@grakkit-types/itemsadder

Version:
1,191 lines (1,188 loc) 91.1 kB
declare module 'dev.lone.itemsadder.api.Events.PlayerEmoteEndEvent' { import { Enum } from 'java.lang'; export class Cause extends Enum<Cause> { static readonly STOP: Cause; static readonly FINISHED: Cause; static valueOf(name: string): Cause; static values(): Cause[]; } } declare module 'dev.lone.itemsadder.api' { import { Runnable, UnsupportedOperationException } from 'java.lang'; import { Set, HashMap, List, UUID } from 'java.util'; import { BlockFace, Block } from 'org.bukkit.block'; import { FileConfiguration } from 'org.bukkit.configuration.file'; import { Listener } from 'org.bukkit.event'; import { Consumer } from 'org.bukkit.util'; import { BlockData } from 'org.bukkit.block.data'; import { MountBone, Bone } from 'dev.lone.itemsadder.api.CustomEntity'; import { ItemStack } from 'org.bukkit.inventory'; import { NamespacedKey, Color, Material, Location } from 'org.bukkit'; import { EntityType, LivingEntity, Entity, Player } from 'org.bukkit.entity'; /** * Class representing a custom block in ItemsAdder. */ export class CustomBlock extends CustomStack { /** * Returns a list of all the registered blocks identifiers in the format `namespace:id` * @return a list of Namespaces and IDs in the format `namespace:id` */ static getNamespacedIdsInRegistry(): Set<string>; /** * Returns true if the registry contains a block with the specified namespaced id in the format `namespace:id` * @param namespacedId Namespace and ID in the format `namespace:id` * @return true if it contains the namespaced id, otherwise false */ static isInRegistry(namespacedId: string): boolean; /** * Gets a CustomBlock instance through the provided namespace and ID. * This may return null if the provided namespace and ID are invalid. * * @param namespacedID Namespace and ID in the format `namespace:id` * @return Possibly-null CustomBlock instance. */ static getInstance(namespacedID: string): CustomBlock | null; /** * Gets a CustomBlock instance through the provided Bukkit ItemStack. * This may return null if the provided Bukkit ItemStack is not associated with any CustomBlock. * * @param itemStack The Bukkit ItemStack to get the CustomBlock instance from. * @return Possibly-null CustomBlock instance. */ static byItemStack(itemStack: ItemStack): CustomBlock | null; /** * Places a CustomBlock provided through the namespace and ID at the provided location and returns the CustomBlock * instance for it. * This may return null if the provided namespace and ID are invalid. * * @param namespacedId Namespace and ID in the format `namespace:id` * @param location The location to place the CustomBlock at. * @return Possibly-null CustomBlock instance. */ static place(namespacedId: string, location: Location): CustomBlock | null; /** * Places a CustomBlock through the provided location and returns a CustomBlock instance for it. * * @param location The location to place the CustomBlock at. * @return CustomBlock instance from the location. */ place(location: Location): CustomBlock; /** * Gets a CustomBlock instance through the provided Bukkit Block. * This may return null if the provided Block is not associated with a CustomBlock. * * @param block The Bukkit Block to get the CustomBlock from. * @return Possibly-null CustomBlock instance. */ static byAlreadyPlaced(block: Block): CustomBlock | null; /** * Returns whether removing this CustomBlock was successful or not. * A removal is successful if the Block associated with this CustomBlock exists. * * @return true if the CustomBlock could be removed, otherwise false. */ remove(): boolean; /** * Play the block break particles and sound for this custom block. * @return true if the effect was played successfully because the bukkitBlock is a custom block, otherwise false. */ playBreakEffect(): boolean; /** * Play the block break particles and sound for this custom block. * @param bukkitBlock the location of which block you want to play break effect of. * @return true if the effect was played successfully because the bukkitBlock is a custom block, otherwise false. */ static playBreakEffect(bukkitBlock: Block): boolean; /** * Play the block break sound for this custom block. * @return true if the sound was played successfully because the bukkitBlock is a custom block, otherwise false. */ playBreakSound(): boolean; /** * Play the block break sound for this custom block. * @param bukkitBlock the location of which block you want to play break sound of. * @return true if the effect was played successfully because the bukkitBlock is a custom block, otherwise false. */ static playBreakSound(bukkitBlock: Block): boolean; /** * Play the block break particles for this custom block. * @return true if the effect was played successfully because the bukkitBlock is a custom block, otherwise false. */ playBreakParticles(): boolean; /** * Play the block break particles for this custom block. * @param bukkitBlock the location of which block you want to play break particles of. * @return true if the effect was played successfully because the bukkitBlock is a custom block, otherwise false. */ static playBreakParticles(bukkitBlock: Block): boolean; /** * Play the block place particles for this custom block. * @return true if the effect was played successfully because the bukkitBlock is a custom block, otherwise false. */ playPlaceSound(): boolean; /** * Play the block place particles for this custom block. * @param bukkitBlock the location of which block you want to play place particles of. * @return true if the effect was played successfully because the bukkitBlock is a custom block, otherwise false. */ static playPlaceSound(bukkitBlock: Block): boolean; /** * Returns whether removing the CustomBlock at the provided location was successful or not. * A removal is successful if the Block at the provided location is an actual CustomBlock. * * @param location The location to remove the CustomBlock from. * @return true if the CustomBlock could be removed, otherwise false. */ static remove(location: Location): boolean; /** * Generates and returns BlockData associated with this CustomBlock. * * @return BlockData associated with the CustomBlock. * @deprecated This method name is misleading. * Use {@link CustomBlock#getBaseBlockData()} instead. */ generateBlockData(): BlockData | null; /** * Gets the base BlockData for this CustomBlock. * It doesn't get the current placed block BlockData but the BlockData used to show the custom block in-game. * * Warning: TILE CustomBlocks (Spawners) will return null. For now there is no way to obtain this data with this API. * * @return the base BlockData for this CustomBlock. */ getBaseBlockData(): BlockData | null; /** * Gets the base BlockData for this CustomBlock. * It doesn't get the current placed block BlockData but the BlockData used to show the custom block in-game. * * Warning: TILE CustomBlocks (Spawners) will return null. For now there is no way to obtain this data with this API. * * @param namespacedID the Namespace and ID in the format `namespace:id` of the block to get base BlockData of. * @return the base BlockData for this CustomBlock. */ static getBaseBlockData(namespacedID: string): BlockData | null; /** * Gets the Bukkit Block associated with this CustomBlock. * * @return Bukkit Block associated with the CustomBlock. */ getBlock(): Block; /** * Returns whether this CustomBlock is placed in the world. * * @return true if the CustomBlock was placed in the world, otherwise false. */ isPlaced(): boolean; /** * Returns a list of ItemStack instances to drop as loot for this CustomBlock. * * @param includeSelfBlock If the CustomBlock itself should be included in the list. * @return List containing ItemStack instances for the loot. */ getLoot(includeSelfBlock: boolean): ItemStack[]; /** * Returns a list of ItemStack instances to drop as loot for this CustomBlock. * * @return List containing ItemStack instances for the loot. */ getLoot(): ItemStack[]; /** * Returns a list of ItemStack instances to drop as loot for this CustomBlock. * * @param tool The Item required to get the loot for the CustomBlock. * @param includeSelfBlock If the CustomBlock itself should be included in the list. * @return List containing ItemStack instances for the loot. */ getLoot(tool: ItemStack | null, includeSelfBlock: boolean): ItemStack[]; /** * Returns a list of ItemStack instances to drop as loot for this CustomBlock. * * @param bukkitBlock The Bukkit Block to get the loots from. * @param tool The Item required to get the loot for the CustomBlock. * @param includeSelfBlock If the CustomBlock itself should be included in the list. * @return List containing ItemStack instances for the loot. */ static getLoot(bukkitBlock: Block, tool: ItemStack | null, includeSelfBlock: boolean): ItemStack[]; /** * Returns the original light level of this CustomBlock. * * @return Integer representing the original light level of the CustomBlock. */ getOriginalLightLevel(): number; /** * Sets the current light level for this CustomBlock. * * @param level The light level to set for this CustomBlock. */ setCurrentLightLevel(currentLightLevel: number); } /** * Allows the creation and retrieval of cutom Item Stacks. */ export class CustomStack { /** * Returns a list of all the registered items identifiers in the format `namespace:id` * @return a list of Namespaces and IDs in the format `namespace:id` */ static getNamespacedIdsInRegistry(): Set<string>; /** * Returns true if the registry contains an item with the specified namespaced id in the format `namespace:id` * @param namespacedId Namespace and ID in the format `namespace:id` * @return true if it contains the namespaced id, otherwise false */ static isInRegistry(namespacedId: string): boolean; /** * Returns null if the provided {@link ItemStack} is not a custom item created with ItemsAdder. * * @param itemStack the Bukkit ItemStack to get the custom Item Stack from. * @return Possibly-null CustomStack instance. */ static byItemStack(itemStack: ItemStack): CustomStack | null; /** * Gets a clone of the custom stack declared in ItemsAdder registry. * May return null if the provided namespace and id don't belong to a registered custom Item. * * You can give this to a player and do whatever you want without overwriting the original item. * * @param namespacedID The ID in the format `namespace:id` to get the CustomStack-copy from. * @return Possibly-null copy of a CustomStack instance. */ static getInstance(namespacedID: string): CustomStack | null; /** * Gets the Bukkit ItemStack associated with this CustomStack instance. * * @return Bukkit ItemStack used for this CustomStack. */ getItemStack(): ItemStack; /** * Gets the namespace used for this CustomStack instance. * * @return String representing the namespace of the CustomStack. */ getNamespace(): string; /** * Gets the id used for this CustomStack instance. * * @return String representing the id of the CustomStack. */ getId(): string; /** * Gets the namespace and id of this CustomStack instance in the format `namespace:id` * * @return String representing namespace and id of the CustomStack. */ getNamespacedID(): string; /** * Gets the path towards the model used for this CustomStack. * * @return String representing the path to the CustomStack's model. */ getModelPath(): string; /** * Gets the path towards the configuration file of this CustomStack. * * @return String representing the path towards the CustomStack's configuration. */ getConfigPath(): string; /** * Gets a {@link FileConfiguration} instance for this CustomStack. * * @return FileConfiguration for the CustomStack. */ getConfig(): FileConfiguration; /** * Gets the permission associated with this CustomStack. * * @return Possibly-null String representing the permission for this CustomStack. */ getPermission(): string | null; /** * Returns whether this CustomStack instance has a permission associated with it. * * @return true if a permission was set for this CustomStack, otherwise false. */ hasPermission(): boolean; /** * Returns whether the namespace and id of the provided CustomStack match the one of this CustomStack. * * @param other the CustomStack to check the namespace and id against. * @return true if namespace and id match, otherwise false. */ matchNamespacedID(other: CustomStack): boolean; /** * Returns whether this CustomStack has a auto-generated model. * * @return true if the CustomStack has a auto-generated model, otherwise false. */ hasAutoGeneratedModel(): boolean; /** * Gets a list of Textures of this CustomStack. * * @return list containing Strings representing the CustomStack's textures. */ getTextures(): string[]; /** * Returns if this CustomStack blocks all enchantings. * * @return true if it blocks all enchantings, otherwise false. */ isBlockAllEnchants(): boolean; /** * Returns whether this CustomStack has a usages attribute applied. * * @return true if the CustomStack has a usage attribute applied, otherwise false. */ hasUsagesAttribute(): boolean; /** * Sets the amount of usages for this CustomStack to the provided integer. * * @param amount the amount of usages to set for this CustomStack. */ setUsages(usages: number); /** * Reduces the amount of usages from this CustomStack by the provided interger. * * @param amount the amount of usages to remove from this CustomStack. */ reduceUsages(amount: number): void; /** * Gets the amount of usages for this CustomStack. * * @return int representing the amount of usages remaining. */ getUsages(): number; /** * Returns whether this CustomStack has a custom durability applied. * * @return true if the CustomStack has custom durability applied, otherwise false. */ hasCustomDurability(): boolean; /** * Gets the current amount of durability of this CustomStack. * * @return int representing the current durability of the CustomStack. */ getDurability(): number; /** * Sets the custom durability of this CustomStack to the provided integer. * * @param durability The durability to set for this CustomStack. */ setDurability(durability: number); /** * Sets the custom max durability of this CustomStack to the provided integer. * * @param maxDurability The max durability to set for this CustomStack. */ setMaxDurability(maxDurability: number); /** * Gets the maximum custom durability of this CustomStack. * * @return Integer representing the total custom durability of the CustomStack. */ getMaxDurability(): number; /** * Sets the different attributes for this CustomStack. * * A full list of available attributes can be found on the * Minecraft Gamepedia Wiki. * You do not have to provide the `generic.` prefix for the attribute! * * Not all attributes are available on all Minecraft versions! * * Example * * item.setAttributeModifier("attack_damage", "mainhand", 10d); * * * @param attributeModifier The attribute to modify. Does not need the `generic.` prefix. * @param slotStr The slot to apply it to. Can be mainhand, offhand, head, chest, legs or feet. * @param value The value to set for the attribute. */ setAttributeModifier(attributeModifier: string, slotStr: string, value: number): void; /** * Sets the displayed name of this CustomStack. * * @param displayName The display name to set for this CustomStack. */ setDisplayName(displayName: string); /** * Gets the displayed name of this CustomStack. * * @return String representing the display name of the CustomStack. */ getDisplayName(): string; /** * Gets the damage value of the main hand for this CustomStack. * * @return Double representing the damage for the main hand. */ getDamageMainhand(): number; /** * Use this if you change attack damage of the item (via enchant or attribute modifier) * * @param slot The slot to apply the String to. Can be mainhand, offhand, head, chest, legs or feet. */ updateAttackDamageLore(slot: string): void; /** * Use this if you change attack speed of the item * * @param slot The slot to apply the String to. Can be mainhand, offhand, head, chest, legs or feet. */ updateAttackSpeedLore(slot: string): void; /** * Returns if this CustomStack is actually a Block. * * @return true if the CustomStack is a block, otherwise false. */ isBlock(): boolean; /** * Tries to drop the CustomStack at the provided location. * * @param loc The location to drop the CustomStack at. * @return true if the CustomStack was dropped, otherwise false. */ drop(loc: Location): boolean; } /** * Class representing a CustomFurniture of ItemsAdder. * This class extends the {@link CustomStack} class. */ export class CustomFurniture extends CustomStack { /** * Gets a CustomFurniture instance from the provided Armor stand. * This may return null if the Armor stand is not part of a furniture. * * @param entity The Entity to get the CustomFurniture from. * @return Possibly-null instance of CustomFurniture */ static byAlreadySpawned(entity: Entity): CustomFurniture | null; /** * Gets a CustomFurniture instance from the provided Block. * This may return null if the Block is not part of a furniture hit-box. * * @param block The Block to get the CustomFurniture from. * @return Possibly-null instance of CustomFurniture */ static byAlreadySpawned(block: Block): CustomFurniture | null; /** * Spawns an Armor stand with the furniture of the provided namespace and ID at the provided location and * returns a CustomFurniture instance for it. * * No Barrier block will be spawned if the CustomFurniture is solid! * * @param namespacedId Namespace and ID of the CustomFurniture in the format `namespace:id` * @param location The Location to spawn the Armor stand with the furniture at. * @return Possibly-null CustomFurniture instance. */ static spawnPreciseNonSolid(namespacedId: string, location: Location): CustomFurniture | null; /** * Spawns an Armor stand with the furniture of the provided namespace and ID at the provided Block location and * returns a CustomFurniture instance for it. * This may return null if the provided namespace and ID are invalid. * * No Barrier block will be spawned if the CustomFurniture is solid! * * @param namespacedId Namespace and ID of the CustomFurniture in the format `namespace:id` * @param blockLocation The Block to spawn the Armor stand with the furniture at. * @return Possibly-null CustomFurniture instance. */ static spawn(namespacedId: string, blockLocation: Block): CustomFurniture | null; /** * Removes this CustomFurniture and the Armor stand associated with it from the world. * * @param dropItem if an item should be dropped. */ remove(dropItem: boolean): void; /** * Removes this CustomFurniture and the Armor stand associated with it from the world. * * @param entity the Entity to remove with the CustomFurniture. * @param dropItem if an item should be dropped. */ static remove(entity: Entity, dropItem: boolean): void; /** * Teleports the Armor stand associated with this CustomFurniture to the target Bukkit Entity. * This will also remove any Barrier blocks from its original position, if present. * * @param destinationEntity the Bukkit Entity to teleport towards. */ teleport(destinationEntity: Entity): void; /** * Teleports the Armor stand associated with this CustomFurniture to the provided location. * This will also remove any Barrier blocks from its original position, if present. * * @param location the location to teleport towards. */ teleport(location: Location): void; /** * Replace the model of this furniture with the model of another furniture. * * @param newFurnitureNamespacedId the namespace and ID of the new furniture model. */ replaceFurniture(newFurnitureNamespacedId: string): void; /** * Replace the model of this furniture with the model of another furniture. * * @param newFurnitureNamespacedId the namespace and ID of the new furniture model. * @param color the new color of this furniture. Will apply only to naturally colorable items. */ replaceFurniture(newFurnitureNamespacedId: string, color: Color): void; /** * Replace color of this furniture. Will apply only to naturally colorable items. * * @param color the new color of this furniture. Will apply only to naturally colorable items. */ setColor(color: Color); /** * Returns the original light level of this CustomFurniture. * * @return Integer representing the original light level of the CustomFurniture. */ getOriginalLightLevel(): number; /** * Sets the current light level for this CustomFurniture. * * @param level The light level to set for this CustomFurniture. */ setCurrentLightLevel(currentLightLevel: number); /** * Gets the Armor stand associated with this CustomFurniture. * This may return null if the Armor stand is not yet spawned in the world. * * @return Possibly-null Bukkit Entity instance. * @deprecated use {@link CustomFurniture#getEntity()} instead. */ getArmorstand(): Entity | null; /** * Gets the Armor stand associated with this CustomFurniture. * This may return null if the Armor stand is not yet spawned in the world. * * @return Possibly-null Bukkit Entity instance. */ getEntity(): Entity | null; } export class ItemsAdder { /** * Please listen to {@link dev.lone.itemsadder.api.Events.ItemsAdderLoadDataEvent} event instead. */ static areItemsLoaded(): boolean; /** * Please use {@link CustomStack#byItemStack(ItemStack)} `!= null` instead. */ static isCustomItem(itemStack: ItemStack): boolean; /** * Please use {@link CustomStack#getInstance(String)} `!= null` instead. */ static isCustomItem(customItemName: string): boolean; /** * Please use {@link CustomStack#getInstance(String)} instead. */ static getCustomItem(namespacedId: string): ItemStack; /** * Please use {@link CustomBlock#place(Location)} instead. */ static placeCustomBlock(location: Location, itemStack: ItemStack): void; /** * Please use {@link CustomBlock} instead. */ static removeCustomBlock(location: Location): void; /** * Please don't use this method anymore, it's not reliable as blocks are not only mushrooms. * * Get a custom block based on the {@link BlockFace} values. * * @param material * @param blockFaces * @return */ static getCustomBlockByFaces(material: Material, blockFaces: HashMap<BlockFace, boolean>): ItemStack; /** * Please use {@link CustomBlock} instead. */ static isCustomBlock(block: Block): boolean; /** * Please use {@link CustomBlock} instead. */ static getCustomBlockLoot(block: Block, includeSelfBlock: boolean): ItemStack[]; /** * Please use {@link CustomBlock} instead. */ static getCustomBlockLoot(block: Block): ItemStack[]; /** * Please use {@link CustomBlock} instead. */ static getCustomBlockLoot(block: Block, tool: ItemStack, includeSelfBlock: boolean): ItemStack[]; /** * Please use {@link CustomCrop} instead. */ static placeCustomCrop(location: Location, seed: ItemStack): void; /** * Please use {@link CustomCrop} instead. */ static isCustomCrop(block: Block): boolean; /** * Please use {@link CustomCrop} instead. */ static getCustomSeedNameFromCrop(block: Block): string; /** * Please use {@link CustomBlock} instead. * * Gets a CustomBlock instance through the provided Bukkit Block. * This may return null if the provided Block is not associated with a CustomBlock. * * @param block The Bukkit Block to get the CustomBlock from. * @return Possibly-null CustomBlock instance. */ static getCustomBlock(block: Block): ItemStack; /** * Please use {@link CustomStack} instead. * * Returns whether the namespace and id of the provided CustomStack match the one of this CustomStack. * * @param itemStack The CustomStack to check the namespace and id against. * @param customItemName The CustomStack ID in the format `namespace:id` to check the item namespaced ID against. * @return true if namespace and id match, otherwise false. */ static matchCustomItemName(itemStack: ItemStack, customItemName: string): boolean; /** * Please use {@link CustomFurniture} instead. * * Check if a Bukkit {@link Entity} is a custom furniture. * * @param entity The {@link Bukkit} entity. * @return true if it's a custom entity, false if not. */ static isFurniture(entity: Entity): boolean; /** * Please use {@link CustomStack} instead. * * Gets the namespace and id of this CustomStack instance in the format `namespace:id` * * @param itemStack Custom item. * @return String representing namespace and id of the custom item. */ static getCustomItemName(itemStack: ItemStack): string; /** * Please use {@link CustomStack} instead. * * Get custom usages of a custom item. (Usages is a special property of this plugin. It's not a Vanilla attribute) * * @param itemStack Custom item. * @return Custom durability of a custom item. */ static getCustomItemUsages(itemStack: ItemStack): number; /** * Please use {@link CustomStack} instead. * * Set the custom durability of a custom item. * * @param item Custom item. * @param durability Durability to set. * @return The modified ItemStack. */ static setCustomItemDurability(item: ItemStack, durability: number): ItemStack; /** * Please use {@link CustomStack} instead. * * Set the custom durability of a custom item. * * @param item Custom item. * @param maxDurability Max durability to set. * @return The modified ItemStack. */ static setCustomItemMaxDurability(item: ItemStack, maxDurability: number): ItemStack; /** * Please use {@link CustomStack} instead. * * Get the custom durability of a custom item. * * @param itemStack Custom item. * @return Custom durability of a custom item. */ static getCustomItemDurability(itemStack: ItemStack): number; /** * Please use {@link CustomStack} instead. * * Get the custom max durability of a custom item. * * @param itemStack Custom item. * @return Custom max durability of a custom item. */ static getCustomItemMaxDurability(itemStack: ItemStack): number; /** * Get list of custom blocks IDs in the format `namespace:id` which contains the `searchStr` keyword. * * @param searchStr Keyword to search for. * @return Complete list of custom blocks IDs in the format `namespace:id`. */ static getNamespacedBlocksNamesInConfig(searchStr: string): string[]; /** * Get complete list of custom blocks IDs in the format `namespace:id`. * * @return Complete list of custom blocks IDs in the format `namespace:id`. */ static getNamespacedBlocksNamesInConfig(): string[]; /** * Please use {@link CustomStack} instead. * * Get the Bukkit {@link BlockData} * * @param customBlock The ItemStack of the custom block you want to get Bukkit {@link BlockData} of. * @param lightweight Unused property. * @return Bukkit {@link BlockData} */ static getCustomBlockBlockData(customBlock: ItemStack, lightweight: boolean): BlockData; /** * Play totem animation. * Warning: Make sure to delay it using a bukkit runnable (1 tick should be ok) * if you call this after you close an inventory or sometimes animation won't show. * * @param player The player to play the anomation towards. * @param namespacedId The ID in the format `namespace:id` to get the totem animation from. * @return true if successful, false when provided ID was invalid. */ static playTotemAnimation(player: Player, namespacedId: string): boolean; /** * Place a custom liquid in the specified location. * * @param namespacedID The ID in the format `namespace:id` of the liquid you want to place. * @param location Location of where you want to place the liquid */ static setLiquid(namespacedID: string, location: Location): void; /** * Get the name of the liquid in this location. * * @param location Location you want to check. * @return null if no custom liquid is available in the location. */ static getLiquidName(location: Location): string | null; /** * Applies the Resource pack set for ItemsAdder to the provided player. * * @param player The player to apply the resource pack to. */ static applyResourcepack(player: Player): void; /** * Returns all the registered items. * * @return null if ItemsAdder is not loaded completely, be sure to listen to ItemsAdderLoadDataEvent */ static getAllItems(): CustomStack[]; /** * Returns all the registered items by a specific namespace. * * @return null if ItemsAdder is not loaded completely, be sure to listen to ItemsAdderLoadDataEvent */ static getAllItems(namespace: string): CustomStack[]; /** * Returns all the registered items which use a specific Bukkit Material. * * @return null if ItemsAdder is not loaded completely, be sure to listen to ItemsAdderLoadDataEvent */ static getAllItems(material: Material): CustomStack[]; /** * Check if a custom recipe is registered by ItemsAdder. * @param namespacedKey the recipe namespaced key. * @return true if it's an ItemsAdder recipe, false if not. */ static isCustomRecipe(namespacedKey: NamespacedKey): boolean; /** * Check if a custom recipe is registered by ItemsAdder. * @param namespacedKey the recipe Namespace and ID in the format `namespace:id`. * @return true if it's an ItemsAdder recipe, false if not. */ static isCustomRecipe(namespacedKey: string): boolean; /** * Retrieve the resourcepack direct download URL. * * @param appendHash append the hash to the URL or not. * @return returns the URL if is available, null if the resourcepack is still generating or the plugin still loading. */ static getPackUrl(appendHash: boolean): string | null; } /** * Class representing a custom mob in ItemsAdder */ export class CustomMob { /** * Spawns a CustomMob and returns the created CustomMob instance, or null if Namespace and ID are invalid. * * @param namespacedId Namespace and ID in the format `namespace:id` to get the CustomMob from. * @param location the Location to spawn the CustomMob at. * @return Possibly-null CustomMob instance. */ static spawn(namespacedId: string, location: Location): CustomMob | null; /** * Gets a CustomMob instance through a Bukkit Entity. * This returns null if the provided Entity doesn't belong to a CustomMob. // TODO: Check if that is correct * * @param entity The Bukkit Entity to get the CustomMob from. * @return Possibly-null CustomMob instance. */ static byAlreadySpawned(entity: Entity): CustomMob | null; /** * Gets the Bukkit Entity associated with this CustomMob. * * @return The Bukkit Entity associated with the CustomMob. */ getEntity(): Entity; /** * Gets the Bukkit EntityType associated with this CustomMob. * * @return The Bukkit EntityType associated with the CustomMob. */ getType(): EntityType; /** * Gets the Namespace and ID in the format `namespace:id` for this CustomMob. * * @return String representing the namespace and ID of the CustomMob. */ getNamespacedID(): string; /** * Gets the Namespace for this CustomMob. * * @return String representing the namespace of the CustomMob. */ getNamespace(): string; /** * Gets the name of this CustomMob. * * @return String representing the name of the CustomMob. */ getName(): string; /** * Gets the ID of this CustomMob. * * @return String representing the ID of the CustomMob. */ getId(): string; } export class CustomPlayer extends CustomEntity { getPlayerName(): string; playAnimation(emoteName: string): boolean; stopAnimation(): void; /** * Spawns a custom player entity * @param playerSkin can be a player name, a mineskin.org url and a signed texture string. * @param location the location where you want to spawn the entity * @return the entity wrapper */ static spawn(playerSkin: string, location: Location): CustomPlayer; static byAlreadySpawned(entity: Entity): CustomPlayer | null; static playEmote(player: Player, emoteName: string): void; static stopEmote(player: Player): void; /** * Spawns a CustomEntity and returns the created CustomEntity instance, or null if Namespace and ID are invalid. * * @param namespacedId Namespace and ID in the format `namespace:id` to get the CustomEntity from. * @param location the Location to spawn the CustomEntity at. * @param frustumCulling if this entity needs to be frozen if not visible by the player. * @return Possibly-null CustomEntity instance. */ static spawn(namespacedId: string, location: Location, frustumCulling: boolean): CustomEntity | null; /** * Spawns a CustomEntity and returns the created CustomEntity instance, or null if Namespace and ID are invalid. * * @param namespacedId Namespace and ID in the format `namespace:id` to get the CustomEntity from. * @param location the Location to spawn the CustomEntity at. * @param viewers the list of players which can see this entity. * @param frustumCulling if this entity needs to be frozen if not visible by the player. * @param function a function which is executed when the base entity is going to be spawned, executed at the same time of * the Spigot API function: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/RegionAccessor.html#spawn%28org.bukkit.Location%2Cjava.lang.Class%2Cboolean%2Corg.bukkit.util.Consumer%29= * @return Possibly-null CustomEntity instance. */ static spawn(namespacedId: string, location: Location, viewers: Player[], frustumCulling: boolean, func: Consumer<LivingEntity> | null): CustomEntity | null; /** * Spawns a CustomEntity and returns the created CustomEntity instance, or null if Namespace and ID are invalid. * * @param namespacedId Namespace and ID in the format `namespace:id` to get the CustomEntity from. * @param location the Location to spawn the CustomEntity at. * @param frustumCulling if this entity needs to be frozen if not visible by the player. * @param noBase specify if this custom entity doesn't have a Bukkit real entity as base. * @param noHitbox specify if this custom entity bones have the armorstands hitboxes or not. * @return Possibly-null CustomEntity instance. */ static spawn(namespacedId: string, location: Location, frustumCulling: boolean, noBase: boolean, noHitbox: boolean): CustomEntity | null; /** * Spawns a CustomEntity and returns the created CustomEntity instance, or null if Namespace and ID are invalid. * * @param namespacedId Namespace and ID in the format `namespace:id` to get the CustomEntity from. * @param location the Location to spawn the CustomEntity at. * @param viewers the list of players which can see this entity. * @param frustumCulling if this entity needs to be frozen if not visible by the player. * @param noBase specify if this custom entity doesn't have a Bukkit real entity as base. * @param noHitbox specify if this custom entity bones have the armorstands hitboxes or not. * @param function a function which is executed when the base entity is going to be spawned, executed at the same time of * the Spigot API function: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/RegionAccessor.html#spawn%28org.bukkit.Location%2Cjava.lang.Class%2Cboolean%2Corg.bukkit.util.Consumer%29= * @return Possibly-null CustomEntity instance. */ static spawn(namespacedId: string, location: Location, viewers: Player[], frustumCulling: boolean, noBase: boolean, noHitbox: boolean, func: Consumer<LivingEntity> | null): CustomEntity | null; /** * Plays an animation and executes an action after it's finished * @param name the animation name * @param callback the action to be executed after the animation is finished * @return true if the animation was played, otherwise false */ playAnimation(name: string, callback: Runnable | null): boolean; } export class CustomFire extends CustomStack { static getInstance(namespacedID: string): CustomFire | null; static byItemStack(itemStack: ItemStack): CustomFire | null; /** * Places a CustomFire at the provided location and return the CustomFire instance for it. * May return null if the Namespace and ID are invalid. * * @param namespacedId Namespace and ID in the format `namespace:id` * @param location The location to place the CustomFire at. * @return Possibly-null CustomFire instance. */ static place(namespacedId: string, location: Location): CustomFire | null; /** * Gets a CustomFire instance through the provided block. * This may return null if the provided block is not a CustomFire. * * @param block The block to get a CustomFire instance from. * @return Possibly-null CustomFire instance. */ static byAlreadyPlaced(block: Block): CustomFire | null; /** * Returns whether removing the CustomFire at the provided location was successful or not. * A removal is successful if the Block at the provided location is an actual CustomFire. * * @param location The location to remove the CustomFire from. * @return true if the CustomFire could be removed, otherwise false. */ static remove(location: Location): boolean; /** * Gets the current age of this CustomFire. * * @return Integer representing the current age of the CustomFire. */ static getAge(block: Block): number; /** * Sets the age of this CustomFire to the provided one. * * @param age the age to set for this CustomFire. */ static setAge(block: Block, age: number): void; getLocation(): Location | null; isPlaced(): boolean; place(location: Location): CustomFire; remove(): boolean; getAge(): number; setAge(age: number); } export class Examples extends Listener { } /** * The {@link NotActuallyItemsAdderException} is thrown whenever someone seems to * invoke an API method without actually having ItemsAdder installed. * * Remember, this is just a "mock", not the actual ItemsAdder project. * * @author TheBusyBiscuit */ export class NotActuallyItemsAdderException extends UnsupportedOperationException { /** * This creates a new {@link NotActuallyItemsAdderException}. * Use the actual {@link Plugin} to test your features, not this. */ constructor(); } /** * Class representing a custom entity in ItemsAdder */ export class CustomEntity { /** * Returns a list of all the registered entities identifiers in the format `namespace:id` * @return a list of Namespaces and IDs in the format `namespace:id` */ static getNamespacedIdsInRegistry(): Set<string>; /** * Returns true if the registry contains an entity with the specified namespaced id in the format `namespace:id` * @param namespacedId Namespace and ID in the format `namespace:id` * @return true if it contains the namespaced id, otherwise false */ static isInRegistry(namespacedId: string): boolean; /** * Spawns a CustomEntity and returns the created CustomEntity instance, or null if Namespace and ID are invalid. * * @param namespacedId Namespace and ID in the format `namespace:id` to get the CustomEntity from. * @param location the Location to spawn the CustomEntity at. * @return Possibly-null CustomEntity instance. */ static spawn(namespacedId: string, location: Location): CustomEntity | null; /** * Spawns a CustomEntity and returns the created CustomEntity instance, or null if Namespace and ID are invalid. * * @param namespacedId Namespace and ID in the format `namespace:id` to get the CustomEntity from. * @param location the Location to spawn the CustomEntity at. * @param frustumCulling if this entity needs to be frozen if not visible by the player. * @return Possibly-null CustomEntity instance. */ static spawn(namespacedId: string, location: Location, frustumCulling: boolean): CustomEntity | null; /** * Spawns a CustomEntity and returns the created CustomEntity instance, or null if Namespace and ID are invalid. * * @param namespacedId Namespace and ID in the format `namespace:id` to get the CustomEntity from. * @param location the Location to spawn the CustomEntity at. * @param viewers the list of players which can see this entity. * @param frustumCulling if this entity needs to be frozen if not visible by the player. * @param function a function which is executed when the base entity is going to be spawned, executed at the same time of * the Spigot API function: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/RegionAccessor.html#spawn%28org.bukkit.Location%2Cjava.lang.Class%2Cboolean%2Corg.bukkit.util.Consumer%29= * @return Possibly-null CustomEntity instance. */ static spawn(namespacedId: string, location: Location, viewers: Player[], frustumCulling: boolean, func: Consumer<LivingEntity> | null): CustomEntity | null; /** * Spawns a CustomEntity and returns the created CustomEntity instance, or null if Namespace and ID are invalid. * * @param namespacedId Namespace and ID in the format `namespace:id` to get the CustomEntity from. * @param location the Location to spawn the CustomEntity at. * @param frustumCulling if this entity needs to be frozen if not visible by the player. * @param noBase specify if this custom entity doesn't have a Bukkit real entity as base. * @param noHitbox specify if this custom entity bones have the armorstands hitboxes or not. * @return Possibly-null CustomEntity instance. */ static spawn(namespacedId: string, location: Location, frustumCulling: boolean, noBase: boolean, noHitbox: boolean): CustomEntity | null; /** * Spawns a CustomEntity and returns the created CustomEntity instance, or null if Namespace and ID are invalid. * * @param namespacedId Namespace and ID in the format `namespace:id` to get the CustomEntity from. * @param location the Location to spawn the CustomEntity at. * @param viewers the list of players which can see this entity. * @param frustumCulling if this entity needs to be frozen if not visible by the player. * @param noBase specify if this custom entity doesn't have a Bukkit real entity as base. * @param noHitbox specify if this custom entity bones have the armorstands hitboxes or not. * @param function a function which is executed when the base entity is going to be spawned, executed at the same time of * the Spigot API function: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/RegionAccessor.html#spawn%28org.bukkit.Location%2Cjava.lang.Class%2Cboolean%2Corg.bukkit.util.Consumer%29= * @return Possibly-null CustomEntity instance. */ static spawn(namespacedId: string, location: Location, viewers: Player[], frustumCulling: boolean, noBase: boolean, noHitbox: boolean, func: Consumer<LivingEntity> | null): CustomEntity | null; /** * Spawns a CustomEntity and returns the created CustomEntity instance, or null if Namespace and ID are invalid. * * @param namespacedId Namespace and ID in the format `namespace:id` to get the CustomEntity from. * @param bukkitEntity the Bukkit entity you want to convert. * @return Possibly-null CustomEntity instance. */ static convert(namespacedId: string, bukkitEntity: LivingEntity): CustomEntity | null; /** * Spawns a CustomEntity and returns the created CustomEntity instance, or null if Namespace and ID are invalid. * * @param namespacedId Namespace and ID in the format `namespace:id` to get the CustomEntity from. * @param bukkitEntity the Bukkit entity you want to convert. * @param frustumCulling if this entity needs to be frozen if not visible by the player. * @return Possibly-null CustomEntity instance. */ static convert(namespacedId: string, bukkitEntity: LivingEntity, frustumCulling: boolean): CustomEntity | null; /** * Spawns a CustomEntity and returns the created CustomEntity instance, or null if Namespace and ID are invalid. * * @param namespacedId Namespace and ID in the format `namespace:id` to get the CustomEntity from. * @param bukkitEntity the Bukkit entity you want to convert. * @param frustumCulling if this entity needs to be frozen if not visible by the player. * @param noHitbox specify if this custom entity bones have the armorstands hitboxes or not. * @param canBaseEntityBeDestroyed if the base Bukkit entity can be destroyed if the custom entities dies/is removed. * @param hideBaseEntity if the base Bukkit entity must be hidden on the client or not. * @return Possibly-null CustomEntity instance. */ static convert(namespacedId: string, bukkitEntity: LivingEntity, frustumCulling: boolean, noHitbox: boolean, canBaseEntityBeDestroyed: boolean, hideBaseEntity: boolean): CustomEntity | null; /** * Spawns a CustomEntity and returns the created CustomEntity instance, or null if Namespace and ID are invalid. * * @param namespacedId Namespace and ID in the format `namespace:id` to get the CustomEntity from. * @param bukkitEntity the Bukkit entity you want to convert. * @param viewers the list of players which can see this entity. * @param frustumCulling if this entity needs to be frozen if not visible by the player. * @return Possibly-null CustomEntity instance. */ static convert(namespacedId: string, bukkitEntity: LivingEntity, viewers: Player[], frustumCulling: boolean): CustomEntity | null; /** * Gets a CustomEntity instance through a Bukkit Entity. * This returns null if the provided Entity doesn't belong to a CustomEntity. * * @param entity The Bukkit Entity to get the CustomEntity from. * @return Possibly-null CustomEntity instance. */ static byAlreadySpawned(entity: Entity): CustomEntity | null; static isCustomEntity(entity: Entity): boolean; static isCustomEntity(uuid: UUID): boolean; /** * Gets the Bukkit Entity associated with this CustomEntity. * * @return The Bukkit Entity associated with the CustomEntity. */ getEntity(): Entity; /** * Gets the Bukkit EntityType associated with this CustomEntity. * * @return The Bukkit EntityType associated with the CustomEntity. */ getType(): EntityType; getLocation(): Location; teleport(location: Location): void; /** * Gets the Namespace and ID in the format `namespace:id` for this CustomEntity. * * @return String representing the namespace and ID of the CustomEntity. */ getNamespacedID(): string; /** * Gets the Namespace for this CustomEntity. * * @return String representing the namespace of the CustomEntity. */ getNamespace(): string; /** * Gets the ID of this CustomEntity. * * @return String representing the ID of the CustomEntity. */ getId(): string; /** * Sends respawn packets to the specified player * @param player the player to send packets to */ respawn(player: Player): void; addViewer(player: Player): void; removeViewer(player: Player): void; setFrustumCulling(cull: boolean): void; getFrustumCulling(): boolean; /** * Plays an animation and executes an action after it's finished * @param name the animation name * @param callback the action to be executed after the animation is finished * @return true if the animation was played, otherwise false */ playAnimation(name: string, callback: Runnable | null): boolean; /** * Plays an animation * @param name the animation name * @return true if the animation was played, otherwise false */ playAnimation(name: string): boolean; /** * Stops the currently playing animation */ stopAnimation(): void; isPlayingAnimation(name: string): boolean; /** * Check if a custom entity model has an animation registered by its name * @param entityNamespacedId the custom entity identifier in the format `namespace:id` * @param animationName the animation name * @return true if the animation exists, otherwise false */ static hasAnimation(entityNamespacedId: string, animationName: string): boolean; /** * Check if this custom entity model has an animation registered * @param name the animation name * @return true if the animation exists, otherwise false */ hasAnimation(name: string): boolean; /** * Get all custom entity model animations registered by its name * @param entityNamespacedId the custom entity identifier in the format `namespace:id` * @return a list of the animations registered for a custom entity */ static getAnimationsNames(entityNamespacedId: string): string[];