@scriptcraft/types
Version:
ScriptCraft types
1,323 lines (1,216 loc) • 562 kB
TypeScript
declare const echo: (player: Player, msg: string) => void
declare const java: JavaAPI
declare const org: any
declare const __plugin: Plugin
declare const __dirname: string
declare const __filename: string
declare const refresh: () => void
declare const __require: (filename: string) => any
declare const require: (filename: string, options?: { cache?: boolean }) => any
declare const console: { log: (msg: string) => void }
declare const isJavaObject: (obj: any) => boolean
declare const config: any
declare const scload: (file: any) => any
declare const self: Player
declare const Java: Java
declare const setTimeout: (callbackFn, delay: any) => number
declare const setInterval: (callbackFn, delay: any) => number
declare const clearTimeout: (handle: number) => void
declare const clearInterval: (handle: number) => void
declare const engineUUID: string
interface Java {
type(type: 'org.bukkit.block.BlockFace'): BlockFaces
type(type: 'org.bukkit.boss.BarColor'): BarColors
type(type: 'org.bukkit.boss.BarFlag'): BarFlags
type(type: 'org.bukkit.boss.BarStyle'): BarStyles
type(type: 'org.bukkit.event.inventory.InventoryType'): InventoryTypes
type(type: string): any
type(type: 'org.bukkit.configuration.MemoryConfiguration'): MemoryConfigurationConstructor
type(type: 'java.util.stream'): StreamStatic
from: (JavaScriptItem: any) => any
}
interface JavaAPI {
util: {
stream: {
Collectors: Collectors
}
},
io: {
File: FileConstructor,
FileReader: any,
BufferedReader: any
},
lang: {
System: {
getenv: (key: string) => string | null
}
},
org: any
}
interface Collection<T> {
contains(o: any): boolean
isEmpty(): boolean
size(): number
stream(): Stream<T>
toArray(): T[]
}
interface List<T> {
stream(): Stream<T>
length: number
readonly [n: number]: T
}
interface JavaSet<T> {
isEmpty(): boolean
size(): number
toArray(): T[]
}
interface Stream<T> {
allMatch(predicate: (e:T) => boolean): boolean
anyMatch(predicate: (e:T) => boolean): boolean
collect<S>(collector: Collector<T, S>): S
distinct(): Stream<T>
filter(predicate: (e:T) => boolean): Stream<T>
toArray(): T[]
sort(): Stream<T>
}
interface StreamStatic {
concat<T>(a: Stream<T>, b: Stream<T>): Stream<T>
new<T>(): Stream<T>
}
interface Collector<T, S> {
}
interface Collectors {
toList<T>(): Collector<T, List<T>>
}
interface TabExecutor extends TabCompleter, CommandExecutor {
}
type Configuration = any
type MemorySection = any
type ConfigurationSection = any
type MemoryConfigurationOptions= any
type FileConfigurationOptions = any
interface MemoryConfigurationConstructor {
new(): MemoryConfiguration
new(defaults: Configuration): MemoryConfiguration
}
interface MemoryConfiguration extends MemorySection, Configuration {
/** */
defaults: Configuration
/** */
// options: MemoryConfigurationOptions
/** Sets the default value in the root at the given path as provided. */
addDefault(path: string, value: Object): void
/** Sets the default values of the given paths as provided. */
addDefaults(defaults: Map<string, Object>): void
/** Sets the default values of the given paths as provided. */
addDefaults(defaults: Configuration): void
/** Gets the source Configuration for this configuration. */
getDefaults(): Configuration
/** Gets the parent ConfigurationSection that directly containsthis ConfigurationSection. */
getParent(): ConfigurationSection
/** Gets the ConfigurationOptions for this Configuration. */
options(): MemoryConfigurationOptions
/** Sets the source of all default values for this Configuration. */
setDefaults(defaults: Configuration): void
}
interface Java{
type(type: 'org.bukkit.configuration.file.FileConfiguration'): FileConfigurationConstructor
}
interface FileConfigurationConstructor {
new(): FileConfiguration
new(defaults: Configuration): FileConfiguration
}
interface FileConfiguration extends MemoryConfiguration {
/** Compiles the header for this FileConfiguration and returns theresult. */
buildHeader(): string
/** Loads this FileConfiguration from the specified location. */
load(file: File): void
/** Loads this FileConfiguration from the specified reader. */
load(reader: Reader): void
/** Loads this FileConfiguration from the specified location. */
load(file: string): void
/** Loads this FileConfiguration from the specified string, asopposed to from file. */
loadFromString(contents: string): void
/** Gets the ConfigurationOptions for this Configuration. */
options(): FileConfigurationOptions
/** Saves this FileConfiguration to the specified location. */
save(file: File): void
/** Saves this FileConfiguration to the specified location. */
save(file: string): void
/** Saves this FileConfiguration to a string, and returns it. */
saveToString(): string
}
interface Plugin extends TabExecutor {
/** Gets a FileConfiguration for this plugin, read through"config.yml" */
getConfig(): FileConfiguration
/** Returns the folder that the plugin data's files are located in. */
getDataFolder(): File
/** Gets a ChunkGenerator for use in a default world, as specifiedin the server configuration */
getDefaultWorldGenerator(worldName: string, id: string): ChunkGenerator
/** Returns the plugin.yaml file containing the details for this plugin */
getDescription(): PluginDescriptionFile
/** Returns the plugin logger associated with this server's logger. */
getLogger(): Logger
/** Returns the name of the plugin. */
getName(): string
/** Gets the associated PluginLoader responsible for this plugin */
getPluginLoader(): PluginLoader
/** Gets an embedded resource in this plugin */
getResource(filename: string): InputStream
/** Returns the Server instance currently running this plugin */
getServer(): Server
server: Server
/** Returns a value indicating whether or not this plugin is currentlyenabled */
isEnabled(): boolean
/** Simple boolean if we can still nag to the logs about things */
isNaggable(): boolean
/** Called when this plugin is disabled */
onDisable(): void
/** Called when this plugin is enabled */
onEnable(): void
/** Called after a plugin is loaded but before it has been enabled. */
onLoad(): void
/** Discards any data in getConfig() and reloads from disk. */
reloadConfig(): void
/** Saves the FileConfiguration retrievable by getConfig(). */
saveConfig(): void
/** Saves the raw contents of the default config.yml file to the locationretrievable by getConfig(). */
saveDefaultConfig(): void
/** Saves the raw contents of any resource embedded with a plugin's .jarfile assuming it can be found using getResource(String). */
saveResource(resourcePath: string, replace: boolean): void
/** Set naggable state */
setNaggable(canNag: boolean): void
}
interface BlockFace {
/** Gets the normal vector corresponding to this block face.
*/
getDirection(): Vector
/** Get the amount of X-coordinates to modify to get the represented block
*/
getModX(): number
/** Get the amount of Y-coordinates to modify to get the represented block
*/
getModY(): number
/** Get the amount of Z-coordinates to modify to get the represented block
*/
getModZ(): number
getOppositeFace(): BlockFace
}
interface BarFlag {}
interface BarFlags {
/** Creates fog around the world.
*/
CREATE_FOG: BarFlag
/** Darkens the sky like during fighting a wither.
*/
DARKEN_SKY: BarFlag
/**Tells the client to play the Ender Dragon boss music. */
PLAY_BOSS_MUSIC: BarFlag
}
interface Java{
type(type: 'org.bukkit.boss.BarColor'): BarColors
}
interface BarColors {
/** */
BLUE: BarColor
/** */
GREEN: BarColor
/** */
PINK: BarColor
/** */
PURPLE: BarColor
/** */
RED: BarColor
/** */
WHITE: BarColor
/** */
YELLOW: BarColor
}
interface BarColor {
/** Returns the enum constant of this type with the specified name. */
valueOf(name: string): BarColor
/** Returns an array containing the constants of this enum type, inthe order they are declared. */
values(): BarColor[]
}
interface Java{
type(type: 'org.bukkit.boss.BarStyle'): BarStyles
}
interface BarStyles {
/** Splits the boss bar into 10 segments */
SEGMENTED_10: BarStyle
/** Splits the boss bar into 12 segments */
SEGMENTED_12: BarStyle
/** Splits the boss bar into 20 segments */
SEGMENTED_20: BarStyle
/** Splits the boss bar into 6 segments */
SEGMENTED_6: BarStyle
/** Makes the boss bar solid (no segments) */
SOLID: BarStyle
}
interface BarStyle {
/** Returns the enum constant of this type with the specified name. */
valueOf(name: string): BarStyle
/** Returns an array containing the constants of this enum type, inthe order they are declared. */
values(): BarStyle[]
}
interface BlockFaces {
DOWN: BlockFace
EAST: BlockFace
EAST_NORTH_EAST: BlockFace
EAST_SOUTH_EAST: BlockFace
NORTH: BlockFace
NORTH_EAST: BlockFace
NORTH_NORTH_EAST: BlockFace
NORTH_NORTH_WEST: BlockFace
NORTH_WEST: BlockFace
SELF: BlockFace
SOUTH: BlockFace
SOUTH_EAST: BlockFace
SOUTH_SOUTH_EAST: BlockFace
SOUTH_SOUTH_WEST: BlockFace
SOUTH_WEST: BlockFace
UP: BlockFace
WEST: BlockFace
WEST_NORTH_WEST: BlockFace
WEST_SOUTH_WEST: BlockFace
}
interface InventoryTypes {
/** An anvil inventory, with 2 CRAFTING slots and 1 RESULT slot
*/
ANVIL: InventoryType
/** A barrel box inventory, with 27 slots of type CONTAINER.
*/
BARREL: InventoryType
/** A beacon inventory, with 1 CRAFTING slot
*/
BEACON: InventoryType
/** A blast furnace inventory, with a RESULT slot, a CRAFTING slot, and a FUEL slot.
*/
BLAST_FURNACE: InventoryType
/** A brewing stand inventory, with one FUEL slot and four CRAFTING slots.
*/
BREWING: InventoryType
/** Cartography inventory with 2 CRAFTING slots, and 1 RESULT slot.
*/
CARTOGRAPHY: InventoryType
/** A chest inventory, with 0, 9, 18, 27, 36, 45, or 54 slots of type CONTAINER.
*/
CHEST: InventoryType
/** A player's crafting inventory, with 4 CRAFTING slots and a RESULT slot.
*/
CRAFTING: InventoryType
/** The creative mode inventory, with only 9 QUICKBAR slots and nothing else.
*/
CREATIVE: InventoryType
/** A dispenser inventory, with 9 slots of type CONTAINER.
*/
DISPENSER: InventoryType
/** A dropper inventory, with 9 slots of type CONTAINER.
*/
DROPPER: InventoryType
/** An enchantment table inventory, with two CRAFTING slots and three enchanting buttons.
*/
ENCHANTING: InventoryType
/** The ender chest inventory, with 27 slots.
*/
ENDER_CHEST: InventoryType
/** A furnace inventory, with a RESULT slot, a CRAFTING slot, and a FUEL slot.
*/
FURNACE: InventoryType
/** Grindstone inventory with 2 CRAFTING slots, and 1 RESULT slot.
*/
GRINDSTONE: InventoryType
/** A hopper inventory, with 5 slots of type CONTAINER.
*/
HOPPER: InventoryType
/** A lectern inventory, with 1 BOOK slot.
*/
LECTERN: InventoryType
/** Loom inventory, with 3 CRAFTING slots, and 1 RESULT slot.
*/
LOOM: InventoryType
/** The merchant inventory, with 2 CRAFTING slots, and 1 RESULT slot.
*/
MERCHANT: InventoryType
/** A player's inventory, with 9 QUICKBAR slots, 27 CONTAINER slots, 4 ARMOR slots and 1 offhand slot.
*/
PLAYER: InventoryType
/** A shulker box inventory, with 27 slots of type CONTAINER.
*/
SHULKER_BOX: InventoryType
/** A smoker inventory, with a RESULT slot, a CRAFTING slot, and a FUEL slot.
*/
SMOKER: InventoryType
/** Stonecutter inventory with 1 CRAFTING slot, and 1 RESULT slot.
*/
STONECUTTER: InventoryType
/** A workbench inventory, with 9 CRAFTING slots and a RESULT slot.
*/
WORKBENCH: InventoryType
}
interface InventoryType {
/** */
getDefaultSize(): number
/** */
getDefaultTitle(): string
/** Denotes that this InventoryType can be created via the normalBukkit.createInventory(org.bukkit.inventory.InventoryHolder, org.bukkit.event.inventory.InventoryType) methods. */
isCreatable(): boolean
/** Returns the enum constant of this type with the specified name. */
valueOf(name: string): InventoryType
/** Returns an array containing the constants of this enum type, inthe order they are declared. */
values(): InventoryType[]
}
interface Array<T> {
includes(searchElement: T, fromIndex?: number): boolean
}
// declare interface events {
// playerJoin: (event) => void
// playerCommandPreprocess: (evt) => void
// serverCommand: (event) => void
// playerQuit: (event) => void
// playerInteract: (event) => void
// entityDamageByEntity: (event) => void
// entityDamage: (event) => void
// projectileHit: (event) => void
// entitySpawn: (event) => void
// playerRespawn: (event) => void
// }
type NashornScriptEngine = any
/**
* As yet untyped
*/
type Statistic = any
type Particle = any
type Advancement = any
type Effect = any
type SoundCategory = any
type Sound = any
type Instrument = any
type Note = any
type DyeColor = any
type MapView = any
type WeatherType = any
type BlockData = any
type InetSocketAddress = any
type AdvancementProgress = any
type BlockVector = any
interface PotionMeta extends ItemMeta {
/** Adds a custom potion effect to this potion. */
addCustomEffect(effect: PotionEffect, overwrite: boolean): boolean
/** Removes all custom potion effects from this potion. */
clearCustomEffects(): boolean
/** */
clone(): PotionMeta
/** Returns the potion data about the base potion */
getBasePotionData(): PotionData
/** Gets the potion color that is set. */
getColor(): Color
/** Gets an immutable list containing all custom potion effects applied tothis potion. */
getCustomEffects(): PotionEffect[]
/** Checks for existence of a potion color. */
hasColor(): boolean
/** Checks for a specific custom potion effect type on this potion. */
hasCustomEffect(type: PotionEffectType): boolean
/** Checks for the presence of custom potion effects. */
hasCustomEffects(): boolean
/** Removes a custom potion effect from this potion. */
removeCustomEffect(type: PotionEffectType): boolean
/** Sets the underlying potion data */
setBasePotionData(data: PotionData): void
/** Sets the potion color. */
setColor(color: Color): void
/** Deprecated. use PotionType(org.bukkit.potion.PotionEffectType, boolean, boolean) */
setMainEffect(type: PotionEffectType): boolean
}
interface Java{
type(type: 'org.bukkit.inventory.ItemStack'): ItemStackConstructor
}
interface ItemStackConstructor {
new(): ItemStack
new(stack: ItemStack): ItemStack
new(type: Material): ItemStack
new(type: Material, amount: number): ItemStack
new(type: Material, amount: number, damage: number): ItemStack
new(type: Material, amount: number, damage: number, data: number): ItemStack
}
interface ItemStack extends Object, Cloneable<ItemStack> {
/** Adds the specified Enchantment to this item stack. */
addEnchantment(ench: Enchantment, level: number): void
/** Adds the specified enchantments to this item stack. */
addEnchantments(enchantments: Map<Enchantment, number>): void
/** Adds the specified Enchantment to this item stack. */
addUnsafeEnchantment(ench: Enchantment, level: number): void
/** Adds the specified enchantments to this item stack in an unsafe manner. */
addUnsafeEnchantments(enchantments: Map<Enchantment, number>): void
/** */
clone(): ItemStack
/** Checks if this ItemStack contains the given Enchantment */
containsEnchantment(ench: Enchantment): boolean
/** Required method for configuration serialization */
deserialize(args: Map<string, Object>): ItemStack
/** */
equals(obj: Object): boolean
/** Gets the amount of items in this stack */
getAmount(): number
/** Gets the MaterialData for this stack of items */
getData(): MaterialData
/** Deprecated. see setDurability(short) */
getDurability(): number
/** Gets the level of the specified enchantment on this item stack */
getEnchantmentLevel(ench: Enchantment): number
/** Gets a map containing all enchantments and their levels on this item. */
getEnchantments(): Map<Enchantment, number>
/** Get a copy of this ItemStack's ItemMeta. */
getItemMeta(): ItemMeta
/** Get the maximum stacksize for the material hold in this ItemStack. */
getMaxStackSize(): number
/** Gets the type of this item */
getType(): Material
/** */
hashCode(): number
/** Checks to see if any meta data has been defined. */
hasItemMeta(): boolean
/** This method is the same as equals, but does not consider stack size(amount). */
isSimilar(stack: ItemStack): boolean
/** Removes the specified Enchantment if it exists on thisItemStack */
removeEnchantment(ench: Enchantment): number
/** Creates a Map representation of this class. */
serialize(): Map<string, Object>
/** Sets the amount of items in this stack */
setAmount(amount: number): void
/** Sets the MaterialData for this stack of items */
setData(data: MaterialData): void
/** Deprecated. durability is now part of ItemMeta. To avoid confusion andmisuse, getItemMeta(), setItemMeta(ItemMeta) andDamageable.setDamage(int) should be used instead. This is becauseany call to this method will be overwritten by subsequent setting ofItemMeta which was created before this call. */
setDurability(durability: number): void
/** Set the ItemMeta of this ItemStack. */
setItemMeta(itemMeta: ItemMeta): boolean
/** Sets the type of this item */
setType(type: Material): void
/** */
toString(): string
}
interface MetadataValue {
/** Attempts to convert the value of this metadata item into a boolean. */
asBoolean(): boolean
/** Attempts to convert the value of this metadata item into a byte. */
asByte(): number
/** Attempts to convert the value of this metadata item into a double. */
asDouble(): number
/** Attempts to convert the value of this metadata item into a float. */
asFloat(): number
/** Attempts to convert the value of this metadata item into an int. */
asInt(): number
/** Attempts to convert the value of this metadata item into a long. */
asLong(): number
/** Attempts to convert the value of this metadata item into a short. */
asShort(): number
/** Attempts to convert the value of this metadata item into a string. */
asString(): number
/** Returns the Plugin that created this metadata item. */
getOwningPlugin(): Plugin
/** Invalidates this metadata item, forcing it to recompute when nextaccessed. */
invalidate(): void
/** Fetches the value of this metadata item. */
value(): Object
}
interface Metadatable {
/** Returns a list of previously set metadata values from the implementingobject's metadata store. */
getMetadata(metadataKey: number): List<MetadataValue>
/** Tests to see whether the implementing object contains the givenmetadata value in its metadata store. */
hasMetadata(metadataKey: number): boolean
/** Removes the given metadata value from the implementing object'smetadata store. */
removeMetadata(metadataKey: number, owningPlugin: Plugin): void
/** Sets a metadata value in the implementing object's metadata store. */
setMetadata(metadataKey: number, newMetadataValue: MetadataValue): void
}
type Permission = any
type PermissionRemovedExecutor = any
type PermissionAttachmentInfo = any
interface PermissionAttachment {
/** Gets the Permissible that this is attached to */
getPermissible(): Permissible
/** Gets a copy of all set permissions and values contained within thisattachment. */
getPermissions(): Map<String, Boolean>
/** Gets the plugin responsible for this attachment */
getPlugin(): Plugin
/** Gets the class that was previously set to be called when thisattachment was removed from a Permissible. */
getRemovalCallback(): PermissionRemovedExecutor
/** Removes this attachment from its registered Permissible */
remove(): boolean
/** Sets a permission to the given value, by its fully qualified name */
setPermission(name: number, value: boolean): void
/** Sets a permission to the given value */
setPermission(perm: Permission, value: boolean): void
/** Sets an object to be called for when this attachment is removed from aPermissible. */
setRemovalCallback(ex: PermissionRemovedExecutor): void
/** Removes the specified permission from this attachment. */
unsetPermission(name: number): void
/** Removes the specified permission from this attachment. */
unsetPermission(perm: Permission): void
}
interface ServerOperator {
/** Checks if this object is a server operator */
isOp(): boolean
/** Sets the operator status of this object */
setOp(value: boolean): void
}
interface Permissible extends ServerOperator {
/** Adds a new empty PermissionAttachment to this object */
addAttachment(plugin: Plugin): PermissionAttachment
/** Temporarily adds a new empty PermissionAttachment to thisobject */
addAttachment(plugin: Plugin, ticks: number): PermissionAttachment
/** Adds a new PermissionAttachment with a single permission byname and value */
addAttachment(
plugin: Plugin,
name: string,
value: boolean
): PermissionAttachment
/** Temporarily adds a new PermissionAttachment with a singlepermission by name and value */
addAttachment(
plugin: Plugin,
name: string,
value: boolean,
ticks: number
): PermissionAttachment
/** Gets a set containing all of the permissions currently in effect bythis object */
getEffectivePermissions(): JavaSet<PermissionAttachmentInfo>
/** Gets the value of the specified permission, if set. */
hasPermission(name: string): boolean
/** Gets the value of the specified permission, if set. */
hasPermission(perm: Permission): boolean
/** Checks if this object contains an override for the specifiedpermission, by fully qualified name */
isPermissionSet(name: string): boolean
/** Checks if this object contains an override for the specified Permission */
isPermissionSet(perm: Permission): boolean
/** Recalculates the permissions for this object, if the attachments havechanged values. */
recalculatePermissions(): void
/** Removes the given PermissionAttachment from this object */
removeAttachment(attachment: PermissionAttachment): void
}
interface PluginMessageRecipient {
/** Gets a set containing all the Plugin Channels that this client islistening on. */
getListeningPluginChannels(): string[]
/** Sends this recipient a Plugin Message on the specified outgoingchannel. */
sendPluginMessage(source: Plugin, channel: string, message: number[]): void
}
interface Recipe {
/** Get the result of this recipe. */
getResult(): ItemStack
}
interface Java{
type(type: 'org.bukkit.NamespacedKey'): NamespacedKeyConstructor
}
interface NamespacedKeyConstructor {
new(namespace: string, key: string): NamespacedKey
new(plugin: Plugin, key: string): NamespacedKey
}
interface NamespacedKey extends Object {
/** The namespace representing all keys generated by Bukkit for backwardscompatibility measures.*/
BUKKIT: string
/** The namespace representing all inbuilt keys.*/
MINECRAFT: string
/** */
equals(obj: Object): boolean
/** */
getKey(): string
/** */
getNamespace(): string
/** */
hashCode(): number
/** Get a key in the Minecraft namespace. */
minecraft(key: string): NamespacedKey
/** Deprecated. should never be used by plugins, for internal use only!! */
randomKey(): NamespacedKey
/** */
toString(): string
}
interface Keyed {
/** Return the namespaced identifier for this object. */
getKey(): NamespacedKey
}
interface KeyedBossBar extends BossBar, Keyed {}
interface InventoryHolder {
/** Get the object's inventory. */
getInventory(): Inventory
}
interface Iterable<T> {
forEach(consumer: (item: T) => void): void
}
interface JIterator<T> {
hasNext(): boolean
next(): T
remove()
}
interface Inventory extends Iterable<ItemStack> {
/** Stores the given ItemStacks in the inventory. */
addItem(...items: ItemStack[]): { [key: number]: ItemStack }
/** Finds all slots in the inventory containing any ItemStacks with thegiven ItemStack. */
all(item: ItemStack): { [key: number]: ItemStack }
/** Returns a HashMap with all slots and ItemStacks in the inventory withthe given Material. */
all(material: Material): { [key: number]: ItemStack }
/** Clears out the whole Inventory. */
clear(): void
/** Clears out a particular slot in the index. */
clear(index: number): void
/** Checks if the inventory contains any ItemStacks matching the givenItemStack. */
contains(item: ItemStack): boolean
/** Checks if the inventory contains at least the minimum amount specifiedof exactly matching ItemStacks. */
contains(item: ItemStack, amount: number): boolean
/** Checks if the inventory contains any ItemStacks with the givenmaterial. */
contains(material: Material): boolean
/** Checks if the inventory contains any ItemStacks with the givenmaterial, adding to at least the minimum amount specified. */
contains(material: Material, amount: number): boolean
/** Checks if the inventory contains ItemStacks matching the givenItemStack whose amounts sum to at least the minimum amount specified. */
containsAtLeast(item: ItemStack, amount: number): boolean
/** Returns the first slot in the inventory containing an ItemStack withthe given stack. */
first(item: ItemStack): number
/** Finds the first slot in the inventory containing an ItemStack with thegiven material */
first(material: Material): number
/** Returns the first empty Slot. */
firstEmpty(): number
/** Returns all ItemStacks from the inventory */
getContents(): ItemStack[]
/** Gets the block or entity belonging to the open inventory */
getHolder(): InventoryHolder
/** Returns the ItemStack found in the slot at the given index */
getItem(index: number): ItemStack
/** Get the location of the block or entity which corresponds to this inventory. */
getLocation(): Location
/** Returns the maximum stack size for an ItemStack in this inventory. */
getMaxStackSize(): number
/** Returns the size of the inventory */
getSize(): number
/** Return the contents from the section of the inventory where items canreasonably be expected to be stored. */
getStorageContents(): ItemStack[]
/** Returns what type of inventory this is. */
getType(): InventoryType
/** Gets a list of players viewing the inventory. */
getViewers(): HumanEntity[]
/** Removes all stacks in the inventory matching the given stack. */
remove(item: ItemStack): void
/** Removes all stacks in the inventory matching the given material. */
remove(material: Material): void
/** Removes the given ItemStacks from the inventory. */
removeItem(...items: ItemStack[]): { [key: number]: ItemStack }
/** Completely replaces the inventory's contents. */
setContents(items: ItemStack[]): void
/** Stores the ItemStack at the given index of the inventory. */
setItem(index: number, item: ItemStack): void
/** This method allows you to change the maximum stack size for aninventory. */
setMaxStackSize(size: number): void
/** Put the given ItemStacks into the storage slots */
setStorageContents(items: ItemStack[]): void
}
interface Java {
type(type: 'org.bukkit.inventory.EquipmentSlot'): EquipmentSlot
}
interface EquipmentSlots {
/** */
CHEST: EquipmentSlot
/** */
FEET: EquipmentSlot
/** */
HAND: EquipmentSlot
/** */
HEAD: EquipmentSlot
/** */
LEGS: EquipmentSlot
/** */
OFF_HAND: EquipmentSlot
}
interface EquipmentSlot {
/** Returns the enum constant of this type with the specified name. */
valueOf(name: string): EquipmentSlot
/** Returns an array containing the constants of this enum type, inthe order they are declared. */
values(): EquipmentSlot[]
}
interface UUID {
toString(): string
equals(uuid: UUID): boolean
}
interface AttributeModifier {
/** */
deserialize(args: { [index: string]: Object }): AttributeModifier
/** */
equals(other: Object): boolean
/** Get the amount by which this modifier will apply its AttributeModifier.Operation. */
getAmount(): number
/** Get the name of this modifier. */
getName(): string
/** Get the operation this modifier will apply. */
getOperation(): any // AttributeModifier.Operation
/** Get the EquipmentSlot this AttributeModifier is active on,or null if this modifier is applicable for any slot. */
getSlot(): EquipmentSlot
/** Get the unique ID for this modifier. */
getUniqueId(): UUID
/** */
hashCode(): number
/** Creates a Map representation of this class. */
serialize(): { [index: string]: Object }
/** */
toString(): string
}
interface AttributeInstance {
/** Add a modifier to this instance. */
addModifier(modifier: AttributeModifier): void
/** The attribute pertaining to this instance. */
getAttribute(): Attribute
/** Base value of this instance before modifiers are applied. */
getBaseValue(): number
/** Gets the default value of the Attribute attached to this instance. */
getDefaultValue(): number
/** Get all modifiers present on this instance. */
getModifiers(): Collection<AttributeModifier>
/** Get the value of this instance after all associated modifiers have beenapplied. */
getValue(): number
/** Remove a modifier from this instance. */
removeModifier(modifier: AttributeModifier): void
/** Set the base value of this instance. */
setBaseValue(value: number): void
}
interface Attributable {
/** Gets the specified attribute instance from the object. */
getAttribute(attribute: Attribute): AttributeInstance
}
interface Java {
type(type: 'org.bukkit.GameMode'): GameModes
}
interface GameModes {
/** Adventure mode cannot break blocks without the correct tools. */
ADVENTURE: GameMode
/** Creative mode may fly, build instantly, become invulnerable and createfree items. */
CREATIVE: GameMode
/** Spectator mode cannot interact with the world in anyway and isinvisible to normal players. */
SPECTATOR: GameMode
/** Survival mode is the "normal" gameplay type, with no special features. */
SURVIVAL: GameMode
}
interface GameMode {
/** Deprecated. Magic value */
getByValue(value: number): GameMode
/** Deprecated. Magic value */
getValue(): number
/** Returns the enum constant of this type with the specified name. */
valueOf(name: string): GameMode
/** Returns an array containing the constants of this enum type, in the order they are declared. */
values(): GameMode[]
}
interface PlayerInventory extends Inventory {
/** Get all ItemStacks from the armor slots */
getArmorContents(): ItemStack[]
/** Return the ItemStack from the boots slot */
getBoots(): ItemStack
/** Return the ItemStack from the chestplate slot */
getChestplate(): ItemStack
/** Get all additional ItemStacks stored in this inventory. */
getExtraContents(): ItemStack[]
/** Get the slot number of the currently held item */
getHeldItemSlot(): number
/** Return the ItemStack from the helmet slot */
getHelmet(): ItemStack
/** Gets the block or entity belonging to the open inventory */
getHolder(): HumanEntity
/** Deprecated. players can duel wield now use the methods for thespecific hand instead */
getItemInHand(): ItemStack
/** Gets a copy of the item the player is currently holdingin their main hand. */
getItemInMainHand(): ItemStack
/** Gets a copy of the item the player is currently holdingin their off hand. */
getItemInOffHand(): ItemStack
/** Return the ItemStack from the leg slot */
getLeggings(): ItemStack
/** Put the given ItemStacks into the armor slots */
setArmorContents(items: ItemStack[]): void
/** Put the given ItemStack into the boots slot. */
setBoots(boots: ItemStack): void
/** Put the given ItemStack into the chestplate slot. */
setChestplate(chestplate: ItemStack): void
/** Put the given ItemStacks into the extra slotsSee getExtraContents() for an explanation of extra slots. */
setExtraContents(items: ItemStack[]): void
/** Set the slot number of the currently held item. */
setHeldItemSlot(slot: number): void
/** Put the given ItemStack into the helmet slot. */
setHelmet(helmet: ItemStack): void
/** Stores the ItemStack at the given index of the inventory. */
setItem(index: number, item: ItemStack): void
/** Deprecated. players can duel wield now use the methods for thespecific hand instead */
setItemInHand(stack: ItemStack): void
/** Sets the item the player is holding in their main hand. */
setItemInMainHand(item: ItemStack): void
/** Sets the item the player is holding in their off hand. */
setItemInOffHand(item: ItemStack): void
/** Put the given ItemStack into the leg slot. */
setLeggings(leggings: ItemStack): void
}
interface Java {
type(
type: 'org.bukkit.event.inventory.InventoryType.SlotType'
): InventoryTypeSlotTypes
}
interface InventoryTypeSlotTypes {
/** An armour slot in the player's inventory. */
ARMOR: InventoryTypeSlotType
/** A regular slot in the container or the player's inventory; anythingnot covered by the other enum values. */
CONTAINER: InventoryTypeSlotType
/** A slot in the crafting matrix, or an 'input' slot. */
CRAFTING: InventoryTypeSlotType
/** The fuel slot in a furnace inventory, or the ingredient slot in abrewing stand inventory. */
FUEL: InventoryTypeSlotType
/** A pseudo-slot representing the area outside the inventory window. */
OUTSIDE: InventoryTypeSlotType
/** A slot in the bottom row or quickbar. */
QUICKBAR: InventoryTypeSlotType
/** A result slot in a furnace or crafting inventory. */
RESULT: InventoryTypeSlotType
}
interface InventoryTypeSlotType {
/** Returns the enum constant of this type with the specified name. */
valueOf(name: string): InventoryTypeSlotType
/** Returns an array containing the constants of this enum type, inthe order they are declared. */
values(): InventoryTypeSlotType[]
}
interface InventoryView {
/** Closes the inventory view. */
close(): void
/** Converts a raw slot ID into its local slot ID into whichever of the twoinventories the slot points to. */
convertSlot(rawSlot: number): number
/** Check the total number of slots in this view, combining the upper andlower inventories. */
countSlots(): number
/** Get the lower inventory involved in this transaction. */
getBottomInventory(): Inventory
/** Get the item on the cursor of one of the viewing players. */
getCursor(): ItemStack
/** Gets the inventory corresponding to the given raw slot ID. */
getInventory(rawSlot: number): Inventory
/** Gets one item in this inventory view by its raw slot ID. */
getItem(slot: number): ItemStack
/** Get the player viewing. */
getPlayer(): HumanEntity
/** Determine the type of the slot by its raw slot ID. */
getSlotType(slot: number): InventoryTypeSlotType
/** Get the title of this inventory window. */
getTitle(): string
/** Get the upper inventory involved in this transaction. */
getTopInventory(): Inventory
/** Determine the type of inventory involved in the transaction. */
getType(): InventoryType
/** Sets the item on the cursor of one of the viewing players. */
setCursor(item: ItemStack): void
/** Sets one item in this inventory view by its raw slot ID. */
setItem(slot: number, item: ItemStack): void
/** Sets an extra property of this inventory if supported by thatinventory, for example the state of a progress bar. */
setProperty(prop: InventoryViewProperty, value: number): boolean
}
interface Java {
type(
type: 'org.bukkit.inventory.InventoryView.Property'
): InventoryViewPropertys
}
interface InventoryViewPropertys {
/** The lectern's current open book page */
BOOK_PAGE: InventoryViewProperty
/** The progress of the down-pointing arrow in a brewing inventory. */
BREW_TIME: InventoryViewProperty
/** The progress of the flame in a furnace inventory. */
BURN_TIME: InventoryViewProperty
/** The progress of the right-pointing arrow in a furnace inventory. */
COOK_TIME: InventoryViewProperty
/** In an enchanting inventory, the top button's experience levelvalue. */
ENCHANT_BUTTON1: InventoryViewProperty
/** In an enchanting inventory, the middle button's experience levelvalue. */
ENCHANT_BUTTON2: InventoryViewProperty
/** In an enchanting inventory, the bottom button's experience levelvalue. */
ENCHANT_BUTTON3: InventoryViewProperty
/** In an enchanting inventory, the top button's enchantment's id */
ENCHANT_ID1: InventoryViewProperty
/** In an enchanting inventory, the middle button's enchantment's id */
ENCHANT_ID2: InventoryViewProperty
/** In an enchanting inventory, the bottom button's enchantment's id */
ENCHANT_ID3: InventoryViewProperty
/** In an enchanting inventory, the top button's level value. */
ENCHANT_LEVEL1: InventoryViewProperty
/** In an enchanting inventory, the middle button's level value. */
ENCHANT_LEVEL2: InventoryViewProperty
/** In an enchanting inventory, the bottom button's level value. */
ENCHANT_LEVEL3: InventoryViewProperty
/** In an enchanting inventory, the first four bits of the player's xpSeed. */
ENCHANT_XP_SEED: InventoryViewProperty
/** In an beacon inventory, the levels of the beacon */
LEVELS: InventoryViewProperty
/** In an beacon inventory, the primary potion effect */
PRIMARY_EFFECT: InventoryViewProperty
/** The repair's cost in xp levels */
REPAIR_COST: InventoryViewProperty
/** In an beacon inventory, the secondary potion effect */
SECONDARY_EFFECT: InventoryViewProperty
/** How many total ticks the current fuel should last. */
TICKS_FOR_CURRENT_FUEL: InventoryViewProperty
/** How many total ticks the current smelting should last. */
TICKS_FOR_CURRENT_SMELTING: InventoryViewProperty
}
interface InventoryViewProperty {
/** Deprecated. Magic value */
getId(): number
/** */
getType(): InventoryType
/** Returns the enum constant of this type with the specified name. */
valueOf(name: string): InventoryViewProperty
/** Returns an array containing the constants of this enum type, inthe order they are declared. */
values(): InventoryViewProperty[]
}
interface Java {
type(type: 'org.bukkit.entity.Villager.Profession'): VillagerProfession
}
interface VillagerProfessions {
/** Armorer profession. */
ARMORER: VillagerProfession
/** Butcher profession. */
BUTCHER: VillagerProfession
/** Cartographer profession. */
CARTOGRAPHER: VillagerProfession
/** Cleric profession. */
CLERIC: VillagerProfession
/** Farmer profession. */
FARMER: VillagerProfession
/** Fisherman profession. */
FISHERMAN: VillagerProfession
/** Fletcher profession. */
FLETCHER: VillagerProfession
/** Leatherworker profession. */
LEATHERWORKER: VillagerProfession
/** Librarian profession. */
LIBRARIAN: VillagerProfession
/** Mason profession. */
MASON: VillagerProfession
/** Nitwit profession. */
NITWIT: VillagerProfession
/** */
NONE: VillagerProfession
/** Sheperd profession. */
SHEPHERD: VillagerProfession
/** Toolsmith profession. */
TOOLSMITH: VillagerProfession
/** Weaponsmith profession. */
WEAPONSMITH: VillagerProfession
}
interface VillagerProfession extends Keyed {
/** Return the namespaced identifier for this object. */
getKey(): NamespacedKey
/** Returns the enum constant of this type with the specified name. */
valueOf(name: string): VillagerProfession
/** Returns an array containing the constants of this enum type, inthe order they are declared. */
values(): VillagerProfession[]
}
interface Java {
type(type: 'org.bukkit.entity.Villager.Type'): VillagerType
}
interface VillagerTypes {
/** */
DESERT: VillagerType
/** */
JUNGLE: VillagerType
/** */
PLAINS: VillagerType
/** */
SAVANNA: VillagerType
/** */
SNOW: VillagerType
/** */
SWAMP: VillagerType
/** */
TAIGA: VillagerType
}
interface VillagerType extends Keyed {
/** Return the namespaced identifier for this object. */
getKey(): NamespacedKey
/** Returns the enum constant of this type with the specified name. */
valueOf(name: string): VillagerType
/** Returns an array containing the constants of this enum type, inthe order they are declared. */
values(): VillagerType[]
}
interface Java {
type(type: 'java.util.Random'): Random
}
interface Random {}
interface LootContext {
/** Get the HumanEntity who killed the getLootedEntity(). */
getKiller(): HumanEntity
/** The Location to store where the loot will be generated. */
getLocation(): Location
/** Get the Entity that was killed. */
getLootedEntity(): Entity
/** Represents theEnchantment.LOOT_BONUS_MOBS thegetKiller() entity has on their equipped item. */
getLootingModifier(): number
/** Represents the PotionEffectType.LUCK that anentity can have. */
getLuck(): number
}
interface LootTable extends Keyed {
/** Attempt to fill an inventory with this LootTable's loot. */
fillInventory(
inventory: Inventory,
random: Random,
context: LootContext
): void
/** Returns a mutable list of loot generated by this LootTable. */
populateLoot(random: Random, context: LootContext): Collection<ItemStack>
}
interface Lootable {
/** Gets the Loot Table attached to this block or entity. */
getLootTable(): LootTable
/** Get the Loot Table's seed. */
getSeed(): number
/** Set the loot table for a container or entity. */
setLootTable(table: LootTable): void
/** Set the seed used when this Loot Table generates loot. */
setSeed(seed: number): void
}
interface Mob extends LivingEntity, Lootable {
/** Gets the current target of this Mob */
getTarget(): LivingEntity
/** Instructs this Mob to set the specified LivingEntity as its target. */
setTarget(target: LivingEntity): void
}
interface Creature extends Mob {}
interface Ageable extends Creature {
/** Return the ability to breed of the animal. */
canBreed(): boolean
/** Gets the age of this animal. */
getAge(): number
/** Gets the current agelock. */
getAgeLock(): boolean
/** Returns true if the animal is an adult. */
isAdult(): boolean
/** Sets the age of the animal to an adult */
setAdult(): void
/** Sets the age of this animal. */
setAge(age: number): void
/** Lock the age of the animal, setting this will prevent the animal frommaturing or getting ready for mating. */
setAgeLock(lock: boolean): void
/** Sets the age of the animal to a baby */
setBaby(): void
/** Set breedability of the animal, if the animal is a baby and set tobreed it will instantly grow up. */
setBreed(breed: boolean): void
}
interface NPC extends Creature {}
interface Java {
type(type: 'org.bukkit.inventory.MerchantRecipe'): MerchantRecipeConstructor
}
interface MerchantRecipeConstructor {
new (result: ItemStack, maxUses: number): MerchantRecipe
new (
result: ItemStack,
maxUses: number,
experienceReward: boolean
): MerchantRecipe
new (
result: ItemStack,
maxUses: number,
experienceReward: boolean,
villagerExperience: number,
priceMultiplier: number
): MerchantRecipe
}
interface MerchantRecipe extends Recipe {
/** */
addIngredient(item: ItemStack): void
/** */
getIngredients(): ItemStack[]
/** Get the maximum number of uses this trade has. */
getMaxUses(): number
/** Gets the additive price multiplier for the cost of this trade. */
getPriceMultiplier(): number
/** Get the result of this recipe. */
getResult(): ItemStack
/** Get the number of times this trade has been used. */
getUses(): number
/** Gets the amount of experience the villager earns from this trade. */
getVillagerExperience(): number
/** Whether to reward experience to the player for the trade. */
hasExperienceReward(): boolean
/** */
removeIngredient(index: number): void
/** Set whether to reward experience to the player for the trade. */
setExperienceReward(flag: boolean): void
/** */
setIngredients(ingredients: ItemStack[]): void
/** Set the maximum number of uses this trade has. */
setMaxUses(maxUses: number): void
/** Sets the additive price multiplier for the cost of this trade. */
setPriceMultiplier(priceMultiplier: number): void
/** Set the number of times this trade has been used. */
setUses(uses: number): void
/** Sets the amount of experience the villager earns from this trade. */
setVillagerExperience(villagerExperience: number): void
}
interface Merchant {
/** Get the recipe at a certain index of this merchant's trade list. */
getRecipe(i: number): MerchantRecipe
/** Get the number of trades this merchant currently has available. */
getRecipeCount(): number
/** Get a list of trades currently available from this merchant. */
getRecipes(): MerchantRecipe[]
/** Gets the player this merchant is trading with, or null if it is notcurrently trading. */
getTrader(): HumanEntity
/** Gets whether this merchant is currently trading. */
isTrading(): boolean
/** Set the recipe at a certain index of this merchant's trade list. */
setRecipe(i: number, recipe: MerchantRecipe): void
/** Set the list of trades currently available from this merchant. */
setRecipes(recipes: MerchantRecipe[]): void
}
interface AbstractVillager extends Ageable, NPC, InventoryHolder, Merchant {
/** Gets this villager's inventory. */
getInventory(): Inventory
}
interface Villager extends AbstractVillager {
/** Gets the current profession of this villager */
getProfession(): VillagerProfession
/** Gets the trading experience of this villager */
getVillagerExperience(): number
/** Gets the level of this villager */
getVillagerLevel(): number
/** Gets the current type of this villager */
getVillagerType(): VillagerType
/** Sets the new profession of this villager */
setProfession(profession: VillagerProfession): void
/** Sets the trading experience of this villager */
setVillagerExperience(experience: number): void
/** Sets the level of this villager */
setVillagerLevel(level: number): void
/** Sets the new type of this villager */
setVillagerType(type: VillagerType): void
/** Attempts to make this villager sleep at the given location. */
sleep(location: Location): boolean
/** Causes this villager to wake up if he's currently sleeping. */
wakeup(): void
}
interface Java {
type(type: 'org.bukkit.inventory.MainHand'): MainHands
}
interface MainHands {
/** */
LEFT: MainHand
/** */
RIGHT: MainHand
}
interface MainHand {
/** Returns the enum constant of this type with the specified name. */
valueOf(name: string): MainHand
/** Returns an array containing the constants of this enum type, inthe order they are declared. */
values(): MainHand[]
}
interface HumanEntity extends LivingEntity, InventoryHolder {
/** Force-closes the currently open inventory view for this player, if any. */
closeInventory(): void
/** Discover a recipe for this player such that it has not already beendiscovered. */
discoverRecipe(recipe: NamespacedKey): boolean
/** Discover a collection of recipes for this player such that they have notalready been discovered. */
discoverRecipes(recipes: NamespacedKey[]): number
/** Gets the location of the bed the player is currently sleeping in */
getBedLocation(): Location
/** Gets the Location where the player will spawn at their bed, null ifthey have not slept in one or their current bed spawn is invalid. */
getBedSpawnLocation(): Location
/** Get the cooldown time in ticks remaining for the specified material. */
getCooldown(material: Material): number
/** Get the player's EnderChest inventory */
getEnderChest(): Inventory
/** Get the total amount of experience required for the pla