# ScriptCraft API Reference [![MVCode](http://d14nx13ylsx7x8.cloudfront.net/comfy/cms/files/files/000/000/553/original/new-logo.png)](https://www.mvcodeclub.com) Original content by [Walter Higgins](https://github.com/walterhiggins) Additions and modifications by Aaron Powell @ [MVCode](https://www.mvcodeclub.com) NOTE: **Work in Progress -- some information may be incorrect or incomplete** ## Table of Contents * [Global Variables](#global-variables) * [server variable](#server-variable) * [self variable](#self-variable) * [events variable](#events-variable) * [Global Functions](#global-functions) * [echo function](#echo-function) * [setTimeout() function](#settimeout-function) * [clearTimeout() function](#cleartimeout-function) * [setInterval() function](#setinterval-function) * [clearInterval() function](#clearinterval-function) * [Events](#events) * [Registering Events](#registering-events) * [List of Events](#list-of-events) * [Module Loading](#module-loading) * [String Colors](#string-colors) * [Items Module](#items-module) * [Entity Module](#entity-module) * [Blocks Module](#blocks-module) * [Recipes Module](#recipes-module) * [Inventory Module](#inventory-module) * [Action Module](#action-module) * [BlockFace Module](#blockface-module) * [Bukkit Module](#bukkit-module) * [bukkit.broadcastMessage()](#bukkitbroadcastmessage) * [bukkit.dispatchCommand()](#bukkitdispatchcommand) * [Color Module](#color-module) * [DyeColor Module](#dyecolor-module) * [DamageCause Module](#damagecause-module) * [Effect Module](#effect-module) * [Enchantment Module](#enchantment-module) * [EntityTypeCheck Module](#entitytypecheck-module) * [EntityType Module](#entitytype-module) * [File Module](#file-module) * [FireworkEffect Module](#fireworkeffect-module) * [GameMode Module](#gamemode-module) * [ItemFlag Module](#itemflag-module) * [Location Module](#location-module) * [NewPotionEffect Module](#newpotioneffect-module) * [Scoreboard Module](#scoreboard-module) * [SpawnReason Module](#spawnreason-module) * [Particle Module](#particle-module) * [EquipmentSlot Module](#equipmentslot-module) * [Vector Module](#vector-module) * [Drone Module](#drone-module) * [Constructing a Drone Object](#constructing-a-drone-object) * [Drone Methods](#drone-methods) * [Utilities Module](#utilities-module) * [Utility Methods](#utility-methods) * [Using Spigot JavaDocs](#using-spigot-javadocs) ## Global Variables There are a few special javascript variables provided by ScriptCraft that can be accessed in all plugins. ### server variable The Minecraft Server object ### self variable The current player. (Note - this value should not be used in multi-threaded scripts or event-handling code - it's not thread-safe). This variable is only safe to use at the in-game prompt and should *never* be used in modules. For example you can use it here... ```javascript /js console.log(self.name) ``` ... but not in any event handling code. `self` is a temporary short-lived variable which only exists in the context of the in-game or server command prompts. ### events variable The `events` object is used to add new event handlers to Minecraft. ## Global Functions ScripCraft provides some global functions which can be used by all plugins. ### echo function The `echo()` function displays a message on the in-game screen. #### Example ```javascript /js echo( self, 'Hello World') ``` ### setTimeout() function This function mimics the [setTimeout()](http://www.w3schools.com/jsref/met_win_settimeout.asp) function used in browser-based javascript. However, the function will only accept a function reference, not a string of javascript code. Where setTimeout() in the browser returns a numeric value which can be subsequently passed to clearTimeout(), this implementation returns an object which can be subsequently passed to ScriptCraft's own clearTimeout() implementation. #### Example ```javascript // // start a storm in 5 seconds // setTimeout( function() { var world = server.worlds.get(0); world.setStorm(true); }, 5000); ``` ### clearTimeout() function A scriptcraft implementation of [clearTimeout()](http://www.w3schools.com/jsref/met_win_cleartimeout.asp). ### setInterval() function This function mimics the [setInterval()](http://www.w3schools.com/jsref/met_win_setinterval.asp) function used in browser-based javascript. However, the function will only accept a function reference, not a string of javascript code. Where setInterval() in the browser returns a numeric value which can be subsequently passed to clearInterval(), this implementation returns an object which can be subsequently passed to ScriptCraft's own clearInterval() implementation. ### clearInterval() function A scriptcraft implementation of [clearInterval()](http://www.w3schools.com/jsref/met_win_clearinterval.asp). ## Events Events are how the server tells your plugin that something has happened in the world. Bukkit defines many events, in multiple categories; e.g. player actions (player logged in, player clicked a block, player died, player respawned...), block events (block placed, block broken, block's neighbour changed...), entity events (a mob targeted you, a creeper exploded...), world-wide events (a world loaded or unloaded, a chunk loaded or unloaded), and many more. If we want our plugin to do something specific when one of these events occurs, we need to **register a callback function for that event**. This will cause the function we registered to be called by the server whenever the specified event occurs. ### Registering Events ```javascript /* This will register the function onBlockBreak() to be called whenever a BlockBreakEvent occurs, resulting in the message "You broke a block!" being sent to the player that broke a block */ var onBlockBreak = function(event) { echo(event.player, "You broke a block!"); }; events.blockBreak(onBlockBreak); ``` ### List of Events * [events.weatherChange()](#eventsweatherchange) * [events.lightningStrike()](#eventslightningstrike) * [events.thunderChange()](#eventsthunderchange) * [events.vehicleMove()](#eventsvehiclemove) * [events.vehicleDestroy()](#eventsvehicledestroy) * [events.vehicleExit()](#eventsvehicleexit) * [events.vehicleEntityCollision()](#eventsvehicleentitycollision) * [events.vehicleBlockCollision()](#eventsvehicleblockcollision) * [events.vehicleEnter()](#eventsvehicleenter) * [events.vehicleDamage()](#eventsvehicledamage) * [events.vehicleUpdate()](#eventsvehicleupdate) * [events.vehicleCreate()](#eventsvehiclecreate) * [events.enchantItem()](#eventsenchantitem) * [events.prepareItemEnchant()](#eventsprepareitemenchant) * [events.playerInteractEntity()](#eventsplayerinteractentity) * [events.playerEggThrow()](#eventsplayereggthrow) * [events.playerUnleashEntity()](#eventsplayerunleashentity) * [events.playerInventory()](#eventsplayerinventory) * [events.playerLevelChange()](#eventsplayerlevelchange) * [events.playerPortal()](#eventsplayerportal) * [events.playerItemConsume()](#eventsplayeritemconsume) * [events.playerTeleport()](#eventsplayerteleport) * [events.playerBedEnter()](#eventsplayerbedenter) * [events.playerUnregisterChannel()](#eventsplayerunregisterchannel) * [events.playerArmorStandManipulate()](#eventsplayerarmorstandmanipulate) * [events.playerChat()](#eventsplayerchat) * [events.playerShearEntity()](#eventsplayershearentity) * [events.playerItemDamage()](#eventsplayeritemdamage) * [events.asyncPlayerChat()](#eventsasyncplayerchat) * [events.playerDropItem()](#eventsplayerdropitem) * [events.playerRegisterChannel()](#eventsplayerregisterchannel) * [events.playerMove()](#eventsplayermove) * [events.playerItemBreak()](#eventsplayeritembreak) * [events.playerBucketEmpty()](#eventsplayerbucketempty) * [events.playerStatisticIncrement()](#eventsplayerstatisticincrement) * [events.playerToggleFlight()](#eventsplayertoggleflight) * [events.playerItemHeld()](#eventsplayeritemheld) * [events.playerAchievementAwarded()](#eventsplayerachievementawarded) * [events.playerToggleSneak()](#eventsplayertogglesneak) * [events.playerExpChange()](#eventsplayerexpchange) * [events.playerResourcePackStatus()](#eventsplayerresourcepackstatus) * [events.playerPreLogin()](#eventsplayerprelogin) * [events.playerJoin()](#eventsplayerjoin) * [events.playerAnimation()](#eventsplayeranimation) * [events.playerEditBook()](#eventsplayereditbook) * [events.playerPickupItem()](#eventsplayerpickupitem) * [events.playerInteractAtEntity()](#eventsplayerinteractatentity) * [events.playerChangedWorld()](#eventsplayerchangedworld) * [events.playerFish()](#eventsplayerfish) * [events.playerChatTabComplete()](#eventsplayerchattabcomplete) * [events.playerRespawn()](#eventsplayerrespawn) * [events.playerBedLeave()](#eventsplayerbedleave) * [events.asyncPlayerPreLogin()](#eventsasyncplayerprelogin) * [events.playerInteract()](#eventsplayerinteract) * [events.playerBucketFill()](#eventsplayerbucketfill) * [events.playerVelocity()](#eventsplayervelocity) * [events.playerQuit()](#eventsplayerquit) * [events.playerLogin()](#eventsplayerlogin) * [events.playerSwapHandItems()](#eventsplayerswaphanditems) * [events.playerKick()](#eventsplayerkick) * [events.playerToggleSprint()](#eventsplayertogglesprint) * [events.playerCommandPreprocess()](#eventsplayercommandpreprocess) * [events.playerGameModeChange()](#eventsplayergamemodechange) * [events.furnaceSmelt()](#eventsfurnacesmelt) * [events.prepareAnvil()](#eventsprepareanvil) * [events.inventoryDrag()](#eventsinventorydrag) * [events.craftItem()](#eventscraftitem) * [events.furnaceBurn()](#eventsfurnaceburn) * [events.inventoryOpen()](#eventsinventoryopen) * [events.inventoryPickupItem()](#eventsinventorypickupitem) * [events.inventoryMoveItem()](#eventsinventorymoveitem) * [events.inventoryClick()](#eventsinventoryclick) * [events.inventoryClose()](#eventsinventoryclose) * [events.inventoryCreative()](#eventsinventorycreative) * [events.inventory()](#eventsinventory) * [events.prepareItemCraft()](#eventsprepareitemcraft) * [events.furnaceExtract()](#eventsfurnaceextract) * [events.brew()](#eventsbrew) * [events.serverCommand()](#eventsservercommand) * [events.serverListPing()](#eventsserverlistping) * [events.serviceRegister()](#eventsserviceregister) * [events.pluginDisable()](#eventsplugindisable) * [events.remoteServerCommand()](#eventsremoteservercommand) * [events.mapInitialize()](#eventsmapinitialize) * [events.serviceUnregister()](#eventsserviceunregister) * [events.pluginEnable()](#eventspluginenable) * [events.villagerAcquireTrade()](#eventsvillageracquiretrade) * [events.playerDeath()](#eventsplayerdeath) * [events.entityCreatePortal()](#eventsentitycreateportal) * [events.entityCombust()](#eventsentitycombust) * [events.sheepDyeWool()](#eventssheepdyewool) * [events.expBottle()](#eventsexpbottle) * [events.entityTame()](#eventsentitytame) * [events.projectileLaunch()](#eventsprojectilelaunch) * [events.entityDamage()](#eventsentitydamage) * [events.itemSpawn()](#eventsitemspawn) * [events.projectileHit()](#eventsprojectilehit) * [events.foodLevelChange()](#eventsfoodlevelchange) * [events.itemDespawn()](#eventsitemdespawn) * [events.villagerReplenishTrade()](#eventsvillagerreplenishtrade) * [events.entityPortalEnter()](#eventsentityportalenter) * [events.entityPortal()](#eventsentityportal) * [events.entityTarget()](#eventsentitytarget) * [events.entityDeath()](#eventsentitydeath) * [events.entitySpawn()](#eventsentityspawn) * [events.sheepRegrowWool()](#eventssheepregrowwool) * [events.entityShootBow()](#eventsentityshootbow) * [events.creeperPower()](#eventscreeperpower) * [events.entityCombustByBlock()](#eventsentitycombustbyblock) * [events.entityBreakDoor()](#eventsentitybreakdoor) * [events.entityDamageByEntity()](#eventsentitydamagebyentity) * [events.entityUnleash()](#eventsentityunleash) * [events.entityExplode()](#eventsentityexplode) * [events.entityInteract()](#eventsentityinteract) * [events.entityToggleGlide()](#eventsentitytoggleglide) * [events.explosionPrime()](#eventsexplosionprime) * [events.horseJump()](#eventshorsejump) * [events.creatureSpawn()](#eventscreaturespawn) * [events.entityCombustByEntity()](#eventsentitycombustbyentity) * [events.entityDamageByBlock()](#eventsentitydamagebyblock) * [events.entityTargetLivingEntity()](#eventsentitytargetlivingentity) * [events.entityTeleport()](#eventsentityteleport) * [events.playerLeashEntity()](#eventsplayerleashentity) * [events.spawnerSpawn()](#eventsspawnerspawn) * [events.itemMerge()](#eventsitemmerge) * [events.slimeSplit()](#eventsslimesplit) * [events.pigZap()](#eventspigzap) * [events.fireworkExplode()](#eventsfireworkexplode) * [events.potionSplash()](#eventspotionsplash) * [events.entityChangeBlock()](#eventsentitychangeblock) * [events.entityPortalExit()](#eventsentityportalexit) * [events.entityRegainHealth()](#eventsentityregainhealth) * [events.entityBlockForm()](#eventsentityblockform) * [events.blockSpread()](#eventsblockspread) * [events.blockMultiPlace()](#eventsblockmultiplace) * [events.blockExplode()](#eventsblockexplode) * [events.notePlay()](#eventsnoteplay) * [events.cauldronLevelChange()](#eventscauldronlevelchange) * [events.blockFade()](#eventsblockfade) * [events.blockPlace()](#eventsblockplace) * [events.blockPhysics()](#eventsblockphysics) * [events.blockIgnite()](#eventsblockignite) * [events.blockBreak()](#eventsblockbreak) * [events.blockBurn()](#eventsblockburn) * [events.blockFromTo()](#eventsblockfromto) * [events.blockRedstone()](#eventsblockredstone) * [events.blockPistonRetract()](#eventsblockpistonretract) * [events.blockDispense()](#eventsblockdispense) * [events.signChange()](#eventssignchange) * [events.blockPistonExtend()](#eventsblockpistonextend) * [events.blockCanBuild()](#eventsblockcanbuild) * [events.blockGrow()](#eventsblockgrow) * [events.leavesDecay()](#eventsleavesdecay) * [events.blockExp()](#eventsblockexp) * [events.blockForm()](#eventsblockform) * [events.blockDamage()](#eventsblockdamage) * [events.hangingPlace()](#eventshangingplace) * [events.hangingBreakByEntity()](#eventshangingbreakbyentity) * [events.hangingBreak()](#eventshangingbreak) * [events.structureGrow()](#eventsstructuregrow) * [events.spawnChange()](#eventsspawnchange) * [events.worldLoad()](#eventsworldload) * [events.worldInit()](#eventsworldinit) * [events.worldUnload()](#eventsworldunload) * [events.worldSave()](#eventsworldsave) * [events.chunkUnload()](#eventschunkunload) * [events.chunkPopulate()](#eventschunkpopulate) * [events.portalCreate()](#eventsportalcreate) * [events.chunkLoad()](#eventschunkload) ### events.weatherChange() #### Parameters * callback - A function which is called whenever the [weather.WeatherChangeEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/weather/WeatherChangeEvent.html) is fired ### events.lightningStrike() #### Parameters * callback - A function which is called whenever the [weather.LightningStrikeEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/weather/LightningStrikeEvent.html) is fired ### events.thunderChange() #### Parameters * callback - A function which is called whenever the [weather.ThunderChangeEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/weather/ThunderChangeEvent.html) is fired ### events.vehicleMove() #### Parameters * callback - A function which is called whenever the [vehicle.VehicleMoveEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/vehicle/VehicleMoveEvent.html) is fired ### events.vehicleDestroy() #### Parameters * callback - A function which is called whenever the [vehicle.VehicleDestroyEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/vehicle/VehicleDestroyEvent.html) is fired ### events.vehicleExit() #### Parameters * callback - A function which is called whenever the [vehicle.VehicleExitEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/vehicle/VehicleExitEvent.html) is fired ### events.vehicleEntityCollision() #### Parameters * callback - A function which is called whenever the [vehicle.VehicleEntityCollisionEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/vehicle/VehicleEntityCollisionEvent.html) is fired ### events.vehicleBlockCollision() #### Parameters * callback - A function which is called whenever the [vehicle.VehicleBlockCollisionEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/vehicle/VehicleBlockCollisionEvent.html) is fired ### events.vehicleEnter() #### Parameters * callback - A function which is called whenever the [vehicle.VehicleEnterEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/vehicle/VehicleEnterEvent.html) is fired ### events.vehicleDamage() #### Parameters * callback - A function which is called whenever the [vehicle.VehicleDamageEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/vehicle/VehicleDamageEvent.html) is fired ### events.vehicleUpdate() #### Parameters * callback - A function which is called whenever the [vehicle.VehicleUpdateEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/vehicle/VehicleUpdateEvent.html) is fired ### events.vehicleCreate() #### Parameters * callback - A function which is called whenever the [vehicle.VehicleCreateEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/vehicle/VehicleCreateEvent.html) is fired ### events.enchantItem() #### Parameters * callback - A function which is called whenever the [enchantment.EnchantItemEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/enchantment/EnchantItemEvent.html) is fired ### events.prepareItemEnchant() #### Parameters * callback - A function which is called whenever the [enchantment.PrepareItemEnchantEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/enchantment/PrepareItemEnchantEvent.html) is fired ### events.playerInteractEntity() #### Parameters * callback - A function which is called whenever the [player.PlayerInteractEntityEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEntityEvent.html) is fired ### events.playerEggThrow() #### Parameters * callback - A function which is called whenever the [player.PlayerEggThrowEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerEggThrowEvent.html) is fired ### events.playerUnleashEntity() #### Parameters * callback - A function which is called whenever the [player.PlayerUnleashEntityEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerUnleashEntityEvent.html) is fired ### events.playerInventory() #### Parameters * callback - A function which is called whenever the [player.PlayerInventoryEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInventoryEvent.html) is fired ### events.playerLevelChange() #### Parameters * callback - A function which is called whenever the [player.PlayerLevelChangeEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerLevelChangeEvent.html) is fired ### events.playerPortal() #### Parameters * callback - A function which is called whenever the [player.PlayerPortalEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerPortalEvent.html) is fired ### events.playerItemConsume() #### Parameters * callback - A function which is called whenever the [player.PlayerItemConsumeEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerItemConsumeEvent.html) is fired ### events.playerTeleport() #### Parameters * callback - A function which is called whenever the [player.PlayerTeleportEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerTeleportEvent.html) is fired ### events.playerBedEnter() #### Parameters * callback - A function which is called whenever the [player.PlayerBedEnterEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerBedEnterEvent.html) is fired ### events.playerUnregisterChannel() #### Parameters * callback - A function which is called whenever the [player.PlayerUnregisterChannelEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerUnregisterChannelEvent.html) is fired ### events.playerArmorStandManipulate() #### Parameters * callback - A function which is called whenever the [player.PlayerArmorStandManipulateEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerArmorStandManipulateEvent.html) is fired ### events.playerChat() #### Parameters * callback - A function which is called whenever the [player.PlayerChatEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerChatEvent.html) is fired ### events.playerShearEntity() #### Parameters * callback - A function which is called whenever the [player.PlayerShearEntityEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerShearEntityEvent.html) is fired ### events.playerItemDamage() #### Parameters * callback - A function which is called whenever the [player.PlayerItemDamageEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerItemDamageEvent.html) is fired ### events.asyncPlayerChat() #### Parameters * callback - A function which is called whenever the [player.AsyncPlayerChatEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/AsyncPlayerChatEvent.html) is fired ### events.playerDropItem() #### Parameters * callback - A function which is called whenever the [player.PlayerDropItemEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerDropItemEvent.html) is fired ### events.playerRegisterChannel() #### Parameters * callback - A function which is called whenever the [player.PlayerRegisterChannelEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerRegisterChannelEvent.html) is fired ### events.playerMove() #### Parameters * callback - A function which is called whenever the [player.PlayerMoveEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerMoveEvent.html) is fired ### events.playerItemBreak() #### Parameters * callback - A function which is called whenever the [player.PlayerItemBreakEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerItemBreakEvent.html) is fired ### events.playerBucketEmpty() #### Parameters * callback - A function which is called whenever the [player.PlayerBucketEmptyEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerBucketEmptyEvent.html) is fired ### events.playerStatisticIncrement() #### Parameters * callback - A function which is called whenever the [player.PlayerStatisticIncrementEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerStatisticIncrementEvent.html) is fired ### events.playerToggleFlight() #### Parameters * callback - A function which is called whenever the [player.PlayerToggleFlightEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerToggleFlightEvent.html) is fired ### events.playerItemHeld() #### Parameters * callback - A function which is called whenever the [player.PlayerItemHeldEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerItemHeldEvent.html) is fired ### events.playerAchievementAwarded() #### Parameters * callback - A function which is called whenever the [player.PlayerAchievementAwardedEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerAchievementAwardedEvent.html) is fired ### events.playerToggleSneak() #### Parameters * callback - A function which is called whenever the [player.PlayerToggleSneakEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerToggleSneakEvent.html) is fired ### events.playerExpChange() #### Parameters * callback - A function which is called whenever the [player.PlayerExpChangeEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerExpChangeEvent.html) is fired ### events.playerResourcePackStatus() #### Parameters * callback - A function which is called whenever the [player.PlayerResourcePackStatusEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerResourcePackStatusEvent.html) is fired ### events.playerPreLogin() #### Parameters * callback - A function which is called whenever the [player.PlayerPreLoginEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerPreLoginEvent.html) is fired ### events.playerJoin() #### Parameters * callback - A function which is called whenever the [player.PlayerJoinEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerJoinEvent.html) is fired ### events.playerAnimation() #### Parameters * callback - A function which is called whenever the [player.PlayerAnimationEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerAnimationEvent.html) is fired ### events.playerEditBook() #### Parameters * callback - A function which is called whenever the [player.PlayerEditBookEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerEditBookEvent.html) is fired ### events.playerPickupItem() #### Parameters * callback - A function which is called whenever the [player.PlayerPickupItemEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerPickupItemEvent.html) is fired ### events.playerInteractAtEntity() #### Parameters * callback - A function which is called whenever the [player.PlayerInteractAtEntityEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractAtEntityEvent.html) is fired ### events.playerChangedWorld() #### Parameters * callback - A function which is called whenever the [player.PlayerChangedWorldEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerChangedWorldEvent.html) is fired ### events.playerFish() #### Parameters * callback - A function which is called whenever the [player.PlayerFishEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerFishEvent.html) is fired ### events.playerChatTabComplete() #### Parameters * callback - A function which is called whenever the [player.PlayerChatTabCompleteEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerChatTabCompleteEvent.html) is fired ### events.playerRespawn() #### Parameters * callback - A function which is called whenever the [player.PlayerRespawnEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerRespawnEvent.html) is fired ### events.playerBedLeave() #### Parameters * callback - A function which is called whenever the [player.PlayerBedLeaveEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerBedLeaveEvent.html) is fired ### events.asyncPlayerPreLogin() #### Parameters * callback - A function which is called whenever the [player.AsyncPlayerPreLoginEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/AsyncPlayerPreLoginEvent.html) is fired ### events.playerInteract() #### Parameters * callback - A function which is called whenever the [player.PlayerInteractEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html) is fired ### events.playerBucketFill() #### Parameters * callback - A function which is called whenever the [player.PlayerBucketFillEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerBucketFillEvent.html) is fired ### events.playerVelocity() #### Parameters * callback - A function which is called whenever the [player.PlayerVelocityEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerVelocityEvent.html) is fired ### events.playerQuit() #### Parameters * callback - A function which is called whenever the [player.PlayerQuitEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerQuitEvent.html) is fired ### events.playerLogin() #### Parameters * callback - A function which is called whenever the [player.PlayerLoginEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerLoginEvent.html) is fired ### events.playerSwapHandItems() #### Parameters * callback - A function which is called whenever the [player.PlayerSwapHandItemsEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerSwapHandItemsEvent.html) is fired ### events.playerKick() #### Parameters * callback - A function which is called whenever the [player.PlayerKickEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerKickEvent.html) is fired ### events.playerToggleSprint() #### Parameters * callback - A function which is called whenever the [player.PlayerToggleSprintEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerToggleSprintEvent.html) is fired ### events.playerCommandPreprocess() #### Parameters * callback - A function which is called whenever the [player.PlayerCommandPreprocessEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerCommandPreprocessEvent.html) is fired ### events.playerGameModeChange() #### Parameters * callback - A function which is called whenever the [player.PlayerGameModeChangeEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerGameModeChangeEvent.html) is fired ### events.furnaceSmelt() #### Parameters * callback - A function which is called whenever the [inventory.FurnaceSmeltEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/FurnaceSmeltEvent.html) is fired ### events.prepareAnvil() #### Parameters * callback - A function which is called whenever the [inventory.PrepareAnvilEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/PrepareAnvilEvent.html) is fired ### events.inventoryDrag() #### Parameters * callback - A function which is called whenever the [inventory.InventoryDragEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/InventoryDragEvent.html) is fired ### events.craftItem() #### Parameters * callback - A function which is called whenever the [inventory.CraftItemEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/CraftItemEvent.html) is fired ### events.furnaceBurn() #### Parameters * callback - A function which is called whenever the [inventory.FurnaceBurnEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/FurnaceBurnEvent.html) is fired ### events.inventoryOpen() #### Parameters * callback - A function which is called whenever the [inventory.InventoryOpenEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/InventoryOpenEvent.html) is fired ### events.inventoryPickupItem() #### Parameters * callback - A function which is called whenever the [inventory.InventoryPickupItemEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/InventoryPickupItemEvent.html) is fired ### events.inventoryMoveItem() #### Parameters * callback - A function which is called whenever the [inventory.InventoryMoveItemEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/InventoryMoveItemEvent.html) is fired ### events.inventoryClick() #### Parameters * callback - A function which is called whenever the [inventory.InventoryClickEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/InventoryClickEvent.html) is fired ### events.inventoryClose() #### Parameters * callback - A function which is called whenever the [inventory.InventoryCloseEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/InventoryCloseEvent.html) is fired ### events.inventoryCreative() #### Parameters * callback - A function which is called whenever the [inventory.InventoryCreativeEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/InventoryCreativeEvent.html) is fired ### events.inventory() #### Parameters * callback - A function which is called whenever the [inventory.InventoryEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/InventoryEvent.html) is fired ### events.prepareItemCraft() #### Parameters * callback - A function which is called whenever the [inventory.PrepareItemCraftEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/PrepareItemCraftEvent.html) is fired ### events.furnaceExtract() #### Parameters * callback - A function which is called whenever the [inventory.FurnaceExtractEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/FurnaceExtractEvent.html) is fired ### events.brew() #### Parameters * callback - A function which is called whenever the [inventory.BrewEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/BrewEvent.html) is fired ### events.serverCommand() #### Parameters * callback - A function which is called whenever the [server.ServerCommandEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/server/ServerCommandEvent.html) is fired ### events.serverListPing() #### Parameters * callback - A function which is called whenever the [server.ServerListPingEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/server/ServerListPingEvent.html) is fired ### events.serviceRegister() #### Parameters * callback - A function which is called whenever the [server.ServiceRegisterEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/server/ServiceRegisterEvent.html) is fired ### events.pluginDisable() #### Parameters * callback - A function which is called whenever the [server.PluginDisableEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/server/PluginDisableEvent.html) is fired ### events.remoteServerCommand() #### Parameters * callback - A function which is called whenever the [server.RemoteServerCommandEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/server/RemoteServerCommandEvent.html) is fired ### events.mapInitialize() #### Parameters * callback - A function which is called whenever the [server.MapInitializeEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/server/MapInitializeEvent.html) is fired ### events.serviceUnregister() #### Parameters * callback - A function which is called whenever the [server.ServiceUnregisterEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/server/ServiceUnregisterEvent.html) is fired ### events.pluginEnable() #### Parameters * callback - A function which is called whenever the [server.PluginEnableEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/server/PluginEnableEvent.html) is fired ### events.villagerAcquireTrade() #### Parameters * callback - A function which is called whenever the [entity.VillagerAcquireTradeEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/VillagerAcquireTradeEvent.html) is fired ### events.playerDeath() #### Parameters * callback - A function which is called whenever the [entity.PlayerDeathEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/PlayerDeathEvent.html) is fired ### events.entityCreatePortal() #### Parameters * callback - A function which is called whenever the [entity.EntityCreatePortalEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityCreatePortalEvent.html) is fired ### events.entityCombust() #### Parameters * callback - A function which is called whenever the [entity.EntityCombustEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityCombustEvent.html) is fired ### events.sheepDyeWool() #### Parameters * callback - A function which is called whenever the [entity.SheepDyeWoolEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/SheepDyeWoolEvent.html) is fired ### events.expBottle() #### Parameters * callback - A function which is called whenever the [entity.ExpBottleEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/ExpBottleEvent.html) is fired ### events.entityTame() #### Parameters * callback - A function which is called whenever the [entity.EntityTameEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityTameEvent.html) is fired ### events.projectileLaunch() #### Parameters * callback - A function which is called whenever the [entity.ProjectileLaunchEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/ProjectileLaunchEvent.html) is fired ### events.entityDamage() #### Parameters * callback - A function which is called whenever the [entity.EntityDamageEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityDamageEvent.html) is fired ### events.itemSpawn() #### Parameters * callback - A function which is called whenever the [entity.ItemSpawnEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/ItemSpawnEvent.html) is fired ### events.projectileHit() #### Parameters * callback - A function which is called whenever the [entity.ProjectileHitEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/ProjectileHitEvent.html) is fired ### events.foodLevelChange() #### Parameters * callback - A function which is called whenever the [entity.FoodLevelChangeEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/FoodLevelChangeEvent.html) is fired ### events.itemDespawn() #### Parameters * callback - A function which is called whenever the [entity.ItemDespawnEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/ItemDespawnEvent.html) is fired ### events.villagerReplenishTrade() #### Parameters * callback - A function which is called whenever the [entity.VillagerReplenishTradeEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/VillagerReplenishTradeEvent.html) is fired ### events.entityPortalEnter() #### Parameters * callback - A function which is called whenever the [entity.EntityPortalEnterEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityPortalEnterEvent.html) is fired ### events.entityPortal() #### Parameters * callback - A function which is called whenever the [entity.EntityPortalEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityPortalEvent.html) is fired ### events.entityTarget() #### Parameters * callback - A function which is called whenever the [entity.EntityTargetEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityTargetEvent.html) is fired ### events.entityDeath() #### Parameters * callback - A function which is called whenever the [entity.EntityDeathEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityDeathEvent.html) is fired ### events.entitySpawn() #### Parameters * callback - A function which is called whenever the [entity.EntitySpawnEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntitySpawnEvent.html) is fired ### events.sheepRegrowWool() #### Parameters * callback - A function which is called whenever the [entity.SheepRegrowWoolEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/SheepRegrowWoolEvent.html) is fired ### events.entityShootBow() #### Parameters * callback - A function which is called whenever the [entity.EntityShootBowEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityShootBowEvent.html) is fired ### events.creeperPower() #### Parameters * callback - A function which is called whenever the [entity.CreeperPowerEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/CreeperPowerEvent.html) is fired ### events.entityCombustByBlock() #### Parameters * callback - A function which is called whenever the [entity.EntityCombustByBlockEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityCombustByBlockEvent.html) is fired ### events.entityBreakDoor() #### Parameters * callback - A function which is called whenever the [entity.EntityBreakDoorEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityBreakDoorEvent.html) is fired ### events.entityDamageByEntity() #### Parameters * callback - A function which is called whenever the [entity.EntityDamageByEntityEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityDamageByEntityEvent.html) is fired ### events.entityUnleash() #### Parameters * callback - A function which is called whenever the [entity.EntityUnleashEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityUnleashEvent.html) is fired ### events.entityExplode() #### Parameters * callback - A function which is called whenever the [entity.EntityExplodeEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityExplodeEvent.html) is fired ### events.entityInteract() #### Parameters * callback - A function which is called whenever the [entity.EntityInteractEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityInteractEvent.html) is fired ### events.entityToggleGlide() #### Parameters * callback - A function which is called whenever the [entity.EntityToggleGlideEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityToggleGlideEvent.html) is fired ### events.explosionPrime() #### Parameters * callback - A function which is called whenever the [entity.ExplosionPrimeEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/ExplosionPrimeEvent.html) is fired ### events.horseJump() #### Parameters * callback - A function which is called whenever the [entity.HorseJumpEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/HorseJumpEvent.html) is fired ### events.creatureSpawn() #### Parameters * callback - A function which is called whenever the [entity.CreatureSpawnEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/CreatureSpawnEvent.html) is fired ### events.entityCombustByEntity() #### Parameters * callback - A function which is called whenever the [entity.EntityCombustByEntityEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityCombustByEntityEvent.html) is fired ### events.entityDamageByBlock() #### Parameters * callback - A function which is called whenever the [entity.EntityDamageByBlockEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityDamageByBlockEvent.html) is fired ### events.entityTargetLivingEntity() #### Parameters * callback - A function which is called whenever the [entity.EntityTargetLivingEntityEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityTargetLivingEntityEvent.html) is fired ### events.entityTeleport() #### Parameters * callback - A function which is called whenever the [entity.EntityTeleportEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityTeleportEvent.html) is fired ### events.playerLeashEntity() #### Parameters * callback - A function which is called whenever the [entity.PlayerLeashEntityEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/PlayerLeashEntityEvent.html) is fired ### events.spawnerSpawn() #### Parameters * callback - A function which is called whenever the [entity.SpawnerSpawnEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/SpawnerSpawnEvent.html) is fired ### events.itemMerge() #### Parameters * callback - A function which is called whenever the [entity.ItemMergeEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/ItemMergeEvent.html) is fired ### events.slimeSplit() #### Parameters * callback - A function which is called whenever the [entity.SlimeSplitEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/SlimeSplitEvent.html) is fired ### events.pigZap() #### Parameters * callback - A function which is called whenever the [entity.PigZapEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/PigZapEvent.html) is fired ### events.fireworkExplode() #### Parameters * callback - A function which is called whenever the [entity.FireworkExplodeEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/FireworkExplodeEvent.html) is fired ### events.potionSplash() #### Parameters * callback - A function which is called whenever the [entity.PotionSplashEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/PotionSplashEvent.html) is fired ### events.entityChangeBlock() #### Parameters * callback - A function which is called whenever the [entity.EntityChangeBlockEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityChangeBlockEvent.html) is fired ### events.entityPortalExit() #### Parameters * callback - A function which is called whenever the [entity.EntityPortalExitEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityPortalExitEvent.html) is fired ### events.entityRegainHealth() #### Parameters * callback - A function which is called whenever the [entity.EntityRegainHealthEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityRegainHealthEvent.html) is fired ### events.entityBlockForm() #### Parameters * callback - A function which is called whenever the [block.EntityBlockFormEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/EntityBlockFormEvent.html) is fired ### events.blockSpread() #### Parameters * callback - A function which is called whenever the [block.BlockSpreadEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/BlockSpreadEvent.html) is fired ### events.blockMultiPlace() #### Parameters * callback - A function which is called whenever the [block.BlockMultiPlaceEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/BlockMultiPlaceEvent.html) is fired ### events.blockExplode() #### Parameters * callback - A function which is called whenever the [block.BlockExplodeEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/BlockExplodeEvent.html) is fired ### events.notePlay() #### Parameters * callback - A function which is called whenever the [block.NotePlayEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/NotePlayEvent.html) is fired ### events.cauldronLevelChange() #### Parameters * callback - A function which is called whenever the [block.CauldronLevelChangeEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/CauldronLevelChangeEvent.html) is fired ### events.blockFade() #### Parameters * callback - A function which is called whenever the [block.BlockFadeEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/BlockFadeEvent.html) is fired ### events.blockPlace() #### Parameters * callback - A function which is called whenever the [block.BlockPlaceEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/BlockPlaceEvent.html) is fired ### events.blockPhysics() #### Parameters * callback - A function which is called whenever the [block.BlockPhysicsEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/BlockPhysicsEvent.html) is fired ### events.blockIgnite() #### Parameters * callback - A function which is called whenever the [block.BlockIgniteEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/BlockIgniteEvent.html) is fired ### events.blockBreak() #### Parameters * callback - A function which is called whenever the [block.BlockBreakEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/BlockBreakEvent.html) is fired ### events.blockBurn() #### Parameters * callback - A function which is called whenever the [block.BlockBurnEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/BlockBurnEvent.html) is fired ### events.blockFromTo() #### Parameters * callback - A function which is called whenever the [block.BlockFromToEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/BlockFromToEvent.html) is fired ### events.blockRedstone() #### Parameters * callback - A function which is called whenever the [block.BlockRedstoneEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/BlockRedstoneEvent.html) is fired ### events.blockPistonRetract() #### Parameters * callback - A function which is called whenever the [block.BlockPistonRetractEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/BlockPistonRetractEvent.html) is fired ### events.blockDispense() #### Parameters * callback - A function which is called whenever the [block.BlockDispenseEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/BlockDispenseEvent.html) is fired ### events.signChange() #### Parameters * callback - A function which is called whenever the [block.SignChangeEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/SignChangeEvent.html) is fired ### events.blockPistonExtend() #### Parameters * callback - A function which is called whenever the [block.BlockPistonExtendEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/BlockPistonExtendEvent.html) is fired ### events.blockCanBuild() #### Parameters * callback - A function which is called whenever the [block.BlockCanBuildEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/BlockCanBuildEvent.html) is fired ### events.blockGrow() #### Parameters * callback - A function which is called whenever the [block.BlockGrowEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/BlockGrowEvent.html) is fired ### events.leavesDecay() #### Parameters * callback - A function which is called whenever the [block.LeavesDecayEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/LeavesDecayEvent.html) is fired ### events.blockExp() #### Parameters * callback - A function which is called whenever the [block.BlockExpEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/BlockExpEvent.html) is fired ### events.blockForm() #### Parameters * callback - A function which is called whenever the [block.BlockFormEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/BlockFormEvent.html) is fired ### events.blockDamage() #### Parameters * callback - A function which is called whenever the [block.BlockDamageEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/BlockDamageEvent.html) is fired ### events.hangingPlace() #### Parameters * callback - A function which is called whenever the [hanging.HangingPlaceEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/hanging/HangingPlaceEvent.html) is fired ### events.hangingBreakByEntity() #### Parameters * callback - A function which is called whenever the [hanging.HangingBreakByEntityEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/hanging/HangingBreakByEntityEvent.html) is fired ### events.hangingBreak() #### Parameters * callback - A function which is called whenever the [hanging.HangingBreakEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/hanging/HangingBreakEvent.html) is fired ### events.structureGrow() #### Parameters * callback - A function which is called whenever the [world.StructureGrowEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/world/StructureGrowEvent.html) is fired ### events.spawnChange() #### Parameters * callback - A function which is called whenever the [world.SpawnChangeEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/world/SpawnChangeEvent.html) is fired ### events.worldLoad() #### Parameters * callback - A function which is called whenever the [world.WorldLoadEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/world/WorldLoadEvent.html) is fired ### events.worldInit() #### Parameters * callback - A function which is called whenever the [world.WorldInitEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/world/WorldInitEvent.html) is fired ### events.worldUnload() #### Parameters * callback - A function which is called whenever the [world.WorldUnloadEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/world/WorldUnloadEvent.html) is fired ### events.worldSave() #### Parameters * callback - A function which is called whenever the [world.WorldSaveEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/world/WorldSaveEvent.html) is fired ### events.chunkUnload() #### Parameters * callback - A function which is called whenever the [world.ChunkUnloadEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/world/ChunkUnloadEvent.html) is fired ### events.chunkPopulate() #### Parameters * callback - A function which is called whenever the [world.ChunkPopulateEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/world/ChunkPopulateEvent.html) is fired ### events.portalCreate() #### Parameters * callback - A function which is called whenever the [world.PortalCreateEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/world/PortalCreateEvent.html) is fired ### events.chunkLoad() #### Parameters * callback - A function which is called whenever the [world.ChunkLoadEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/world/ChunkLoadEvent.html) is fired ## Module Loading If we are writing a plugin that relies on functions provided by ScriptCraft modules, we need to load them into our plugin.js file. We can import all of the modules at once by loading `master.js` as shown: ```javascript load("scriptcraft/modules/bukkit/master.js"); ``` Adding this line to the top of a plugin file will give you access to all ScriptCraft modules. ## String Colors The display color of strings can be changed by using the string formatting methods provided by this module. ### Usage ```javascript "This text is red!".red() ``` ### Example ```javascript echo(self, "Hello Minecraft!".aqua()); ``` ![Hello Minecraft!](https://d14nx13ylsx7x8.cloudfront.net/lesson_image_blocks/assets/000/004/661/original/temp1450223230.png) ### The following string formatting methods are available: * aqua() * black() * blue() * bold() * brightgreen() * darkaqua() * darkblue() * darkgray() * darkgreen() * purple() * darkpurple() * darkred() * gold() * gray() * green() * italic() * lightpurple() * indigo() * green() * red() * pink() * yellow() * white() * strike() * random() * magic() * underline() * reset() ## Items Module The `items` module exports a factory function for each item material in Minecraft that returns an `ItemStack`. The functions take one argument, `numItems`, that determines how many of the given item will be in the returned ItemStack. `numItems` has a default value of `1`. See the [Spigot JavaDocs: Material](https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Material.html) for a list of possible item materials. ### Usage items.book(); // returns an ItemStack with one book in it items.book(2); // returns an ItemStack with two books in it Items with names that are longer than one word are written in [camelCase](https://en.wikipedia.org/wiki/CamelCase) which means the first word is lowercase and each subsquent word is capitalized, with all spaces removed. If we want an item with the type `ACACIA_FENCE_GATE` we would write `items.acaciaFenceGate()` ### Example ```javascript // adds 5 baked potatoes to the inventory of "player" inventory(player).add(items.bakedPotato(5)); player.updateInventory(); ``` ### List of item functions * acaciaDoor() * acaciaDoorItem() * acaciaFence() * acaciaFenceGate() * acaciaStairs() * activatorRail() * air() * anvil() * apple() * armorStand() * arrow() * bakedPotato() * banner() * barrier() * beacon() * bed() * bedBlock() * bedrock() * beetroot() * beetrootBlock() * beetrootSeeds() * beetrootSoup() * birchDoor() * birchDoorItem() * birchFence() * birchFenceGate() * birchWoodStairs() * blazePowder() * blazeRod() * boat() * boatAcacia() * boatBirch() * boatDarkOak() * boatJungle() * boatSpruce() * bone() * boneBlock() * book() * bookAndQuill() * bookshelf() * bow() * bowl() * bread() * brewingStand() * brewingStandItem() * brick() * brickStairs() * brownMushroom() * bucket() * burningFurnace() * cactus() * cake() * cakeBlock() * carpet() * carrot() * carrotItem() * carrotStick() * cauldron() * cauldronItem() * chainmailBoots() * chainmailChestplate() * chainmailHelmet() * chainmailLeggings() * chest() * chorusFlower() * chorusFruit() * chorusFruitPopped() * chorusPlant() * clay() * clayBall() * clayBrick() * coal() * coalBlock() * coalOre() * cobbleWall() * cobblestone() * cobblestoneStairs() * cocoa() * command() * commandChain() * commandMinecart() * commandRepeating() * compass() * cookedBeef() * cookedChicken() * cookedFish() * cookedMutton() * cookedRabbit() * cookie() * crops() * darkOakDoor() * darkOakDoorItem() * darkOakFence() * darkOakFenceGate() * darkOakStairs() * daylightDetector() * daylightDetectorInverted() * deadBush() * detectorRail() * diamond() * diamondAxe() * diamondBarding() * diamondBlock() * diamondBoots() * diamondChestplate() * diamondHelmet() * diamondHoe() * diamondLeggings() * diamondOre() * diamondPickaxe() * diamondSpade() * diamondSword() * diode() * diodeBlockOff() * diodeBlockOn() * dirt() * dispenser() * doublePlant() * doubleStep() * doubleStoneSlab2() * dragonEgg() * dragonsBreath() * dropper() * egg() * elytra() * emerald() * emeraldBlock() * emeraldOre() * emptyMap() * enchantedBook() * enchantmentTable() * endBricks() * endCrystal() * endGateway() * endRod() * enderChest() * enderPearl() * enderPortal() * enderPortalFrame() * enderStone() * expBottle() * explosiveMinecart() * eyeOfEnder() * feather() * fence() * fenceGate() * fermentedSpiderEye() * fire() * fireball() * firework() * fireworkCharge() * fishingRod() * flint() * flintAndSteel() * flowerPot() * flowerPotItem() * frostedIce() * furnace() * ghastTear() * glass() * glassBottle() * glowingRedstoneOre() * glowstone() * glowstoneDust() * goldAxe() * goldBarding() * goldBlock() * goldBoots() * goldChestplate() * goldHelmet() * goldHoe() * goldIngot() * goldLeggings() * goldNugget() * goldOre() * goldPickaxe() * goldPlate() * goldRecord() * goldSpade() * goldSword() * goldenApple() * goldenCarrot() * grass() * grassPath() * gravel() * greenRecord() * grilledPork() * hardClay() * hayBlock() * hopper() * hopperMinecart() * hugeMushroom1() * hugeMushroom2() * ice() * inkSack() * ironAxe() * ironBarding() * ironBlock() * ironBoots() * ironChestplate() * ironDoor() * ironDoorBlock() * ironFence() * ironHelmet() * ironHoe() * ironIngot() * ironLeggings() * ironOre() * ironPickaxe() * ironPlate() * ironSpade() * ironSword() * ironTrapdoor() * itemFrame() * jackOLantern() * jukebox() * jungleDoor() * jungleDoorItem() * jungleFence() * jungleFenceGate() * jungleWoodStairs() * ladder() * lapisBlock() * lapisOre() * lava() * lavaBucket() * leash() * leather() * leatherBoots() * leatherChestplate() * leatherHelmet() * leatherLeggings() * leaves() * leaves2() * lever() * lingeringPotion() * log() * log2() * longGrass() * magma() * magmaCream() * map() * melon() * melonBlock() * melonSeeds() * melonStem() * milkBucket() * minecart() * mobSpawner() * monsterEgg() * monsterEggs() * mossyCobblestone() * mushroomSoup() * mutton() * mycel() * nameTag() * netherBrick() * netherBrickItem() * netherBrickStairs() * netherFence() * netherStalk() * netherStar() * netherWartBlock() * netherWarts() * netherrack() * noteBlock() * obsidian() * packedIce() * painting() * paper() * pistonBase() * pistonExtension() * pistonMovingPiece() * pistonStickyBase() * poisonousPotato() * pork() * portal() * potato() * potatoItem() * potion() * poweredMinecart() * poweredRail() * prismarine() * prismarineCrystals() * prismarineShard() * pumpkin() * pumpkinPie() * pumpkinSeeds() * pumpkinStem() * purpurBlock() * purpurDoubleSlab() * purpurPillar() * purpurSlab() * purpurStairs() * quartz() * quartzBlock() * quartzOre() * quartzStairs() * rabbit() * rabbitFoot() * rabbitHide() * rabbitStew() * rails() * rawBeef() * rawChicken() * rawFish() * record10() * record11() * record12() * record3() * record4() * record5() * record6() * record7() * record8() * record9() * redMushroom() * redNetherBrick() * redRose() * redSandstone() * redSandstoneStairs() * redstone() * redstoneBlock() * redstoneComparator() * redstoneComparatorOff() * redstoneComparatorOn() * redstoneLampOff() * redstoneLampOn() * redstoneOre() * redstoneTorchOff() * redstoneTorchOn() * redstoneWire() * rottenFlesh() * saddle() * sand() * sandstone() * sandstoneStairs() * sapling() * seaLantern() * seeds() * shears() * shield() * sign() * signPost() * skull() * skullItem() * slimeBall() * slimeBlock() * smoothBrick() * smoothStairs() * snow() * snowBall() * snowBlock() * soil() * soulSand() * speckledMelon() * spectralArrow() * spiderEye() * splashPotion() * sponge() * spruceDoor() * spruceDoorItem() * spruceFence() * spruceFenceGate() * spruceWoodStairs() * stainedClay() * stainedGlass() * stainedGlassPane() * standingBanner() * stationaryLava() * stationaryWater() * step() * stick() * stone() * stoneAxe() * stoneButton() * stoneHoe() * stonePickaxe() * stonePlate() * stoneSlab2() * stoneSpade() * stoneSword() * storageMinecart() * string() * structureBlock() * structureVoid() * sugar() * sugarCane() * sugarCaneBlock() * sulphur() * thinGlass() * tippedArrow() * tnt() * torch() * trapDoor() * trappedChest() * tripwire() * tripwireHook() * vine() * wallBanner() * wallSign() * watch() * water() * waterBucket() * waterLily() * web() * wheat() * wood() * woodAxe() * woodButton() * woodDoor() * woodDoubleStep() * woodHoe() * woodPickaxe() * woodPlate() * woodSpade() * woodStairs() * woodStep() * woodSword() * woodenDoor() * wool() * workbench() * writtenBook() * yellowFlower() ## Entity Module The `entity` module provides easy access to all of the entity interfaces in Minecraft. Entities are any non-voxel objects that can exist in a world, including all players, monsters, projectiles, etc. For a description of the entities, click [here](https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/package-summary.html) ### Usage ```javascript entity.zombie // refers to the org.bukkit.entity.ZOMBIE interface ``` ### Example ```javascript // launches a witherSkull projectile if the player right-clicks the air while holding a bone var onPlayerInteract = function(event) { if (event.action == action.rightClickAir) { var player = event.player; if (player.itemInHand.type.equals(material.bone)) { var skull = player.launchProjectile(entity.witherSkull.class); skull.shooter = player; skull.velocity = player.location.direction.multiply(1.8); } } }; events.playerInteract(onPlayerInteract); ``` ### List of entities * ageable * ambient * animals * animalTamer * areaEffectCloud * armorStand * arrow * bat * blaze * boat * caveSpider * chicken * complexEntityPart * complexLivingEntity * cow * creature * creeper * damageable * dragonFireball * egg * enderCrystal * enderDragon * enderDragonPart * enderman * endermite * enderPearl * enderSignal * entity * experienceOrb * explosive * fallingBlock * fallingSandDeprecated * fireball * firework * fishHook * flying * ghast * giant * golem * guardian * hanging * horse * humanEntity * ironGolem * item * itemFrame * largeFireball * leashHitch * lightningStrike * lingeringPotion * livingEntity * magmaCube * minecart * monster * mushroomCow * npc * ocelot * painting * pig * pigZombie * player * polarBear * poweredMinecart * projectile * rabbit * sheep * shulker * shulkerBullet * silverfish * skeleton * slime * smallFireball * snowball * snowman * spectralArrow * spider * splashPotion * squid * storageMinecart * tameable * thrownExpBottle * thrownPotion * tippedArrow * tNTPrimed * vehicle * villager * waterMob * weather * witch * wither * witherSkull * wolf * zombie ## Blocks Module The `blocks` module provides easy access to all block types without having to use their [data values](http://minecraft.gamepedia.com/Data_values/Block_IDs). ### Usage ```javascript blocks.oak blocks.wool.green ``` ### Examples ```javascript box( blocks.oak ); // creates a single oak wood block box( blocks.sand, 3, 2, 1 ); // creates a block of sand 3 wide x 2 high x 1 long box( blocks.wool.green, 2 ); // creates a block of green wool 2 blocks wide ``` There is also convenience array `blocks.rainbow` which is an array of the 7 colors of the rainbow (or closest approximations). The blocks module is globally exported by the Drone module. ## Recipes Module The `recipes` module provides convenience functions for adding and removing recipes from the game. The `recipes.add()` function takes an object with 3 keys as a parameter: * result: ItemStack the recipe will create * ingredients: Object with key-value pairs denoting the letter that will represent each type of ingredient in the "shape" * shape: Array that defines the shape of the recipe in the crafting table. It **must be** an array of 3 strings each with 3 characters, representing the 9 spaces in the crafting table. The first element is the top row, the second the middle row, and the third is the bottom row. Use spaces to represent empty slots in the table. ### Usage ```javascript recipes.add( { result: resultItem, ingredients: {X: ingredientItem1, Y: ingedientItem2}, shape: [" Y ", "YXY", " Y "] }); ``` ### Example ```javascript // Adds a recipe that can be used to craft a custom bow // called the "Bow of Exploding" using a bow and TNT var bow = items.bow(1); var tnt = items.tnt(1); var explodeBow = items.bow(1); var explodeBowMeta = explodeBow.itemMeta; explodeBowMeta.displayName = "Bow of Exploding"; explodeBowMeta.lore = ["Excite. Very boom."]; explodeBow.itemMeta = explodeBowMeta; recipes.add( { result: explodeBow, ingredients: {B: bow, T: tnt}, shape: [" ", "TB ", " "] }); ``` ## Inventory Module This module provides functions to add items to, remove items from and check the contents of a player or NPC's inventory. ### Usage The `inventory` module is best used in conjunction with the items module. ```javascript // gives every player a cookie and a baked potato utils.players(function(player){ inventory(player) .add( items.cookie(1) ) .add( items.bakedPotato(1) ) }); // give a player 6 cookies then take away 4 of them inventory(player) .add( items.cookie(6) ) .remove ( items.cookie(4) ) // check if a player has any cookies var hasCookies = inventory(player).contains( items.cookie(1) ); ``` The inventory module exposes a single function which when passed a player or NPC will return an object with 3 methods: *NOTE: all methods expect a parameter of the type `org.bukkit.inventory.ItemStack` so use the `items` module to construct items to pass into these methods * add : Adds items to the inventory * remove : removes items from the inventory * contains : checks to see if there is the specified type and amount of item in the inventory ### Example ```javascript // When a player throws a snowball, adds a new one to their inventory var onSnowballThrow = function(event) { if (isSnowball(event.entity)) { var player = event.entity.shooter; inventory(player).add(items.snowBall(1)); } }; events.projectileLaunch(onSnowballThrow); ``` ## Action Module The `action` module can be used to reference the 5 different action types players can perform. ### Usage ```javascript action.leftClickAir // refers to org.bukkit.event.block.Action.LEFT_CLICK_AIR ``` ### Example ```javascript // Sends player a message if they right-click on a block var onPlayerInteract = function(event) { if (event.action == action.rightClickBlock) { echo(event.player, "You right-clicked on a block!") } } events.playerInteract(onPlayerInteract); ``` ### Possible actions: * leftClickAir * leftClickBlock * rightClickAir * rightClickBlock * physical <--- physical action occurs when a player steps on a pressure plate ## BlockFace Module The BlockFace module can be used to reference the different possible directions a block can be facing (for blocks like stairs and armor stands) ### Usage ```javascript blockFace.south // refers to org.bukkit.block.BlockFace.SOUTH ``` ### Example ```javascript // sets the direction bannerBlock is facing to "south" // bannerBlock is a standing banner block var bannerData = bannerBlock.state.data; bannerData.facingDirection = blockFace.south; bannerState.update(); ``` ### Possible BlockFace directions: * down * east * eastNorthEast * eastSouthEast * north * northEast * northNorthEast * northNorthWest * northWest * self * south * southEast * southSouthEast * southSouthWest * southWest * up * west * westNorthWest * westSouthWest ## Bukkit Module The `bukkit` module provides functions that are executed server-wide. The full list of functions can be found in the [Method Summary of the Bukkit Class](https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Bukkit.html) ### bukkit.broadcastMessage() The `bukkit.broadcastMessage()` function can be used to broadcast a message to all players on the server. #### Parameters * message: the message you want to send (string) #### Example ```javascript // sends the message "Welcome to the server!" to all players on the server bukkit.broadcastMessage("Welcome to the server!"); ``` ### bukkit.dispatchCommand() The `bukkit.dispatchCommand()` function can be used to execute a command as if it were sent from the server's console. NOTE: **Be careful when sending commands to the server, it will do anything you ask it to!** #### Parameters * sender: the sender of the command (CommandSender) NOTE: This will usually be the "console" referenced by `server.consoleSender` * command: the command you want to execute (string) #### Example ```javascript // executes the command "time set 0" as if we typed "/time set 0" in game as OP // or "time set 0" into the server console directly bukkit.dispatchCommand(server.consoleSender, "time set 0"); ``` ## Color Module Provides access to all possible colors in `org.bukkit.Color` NOTE: The "color" module is not to be confused with the "dyeColor" module. The "dyeColor" module is used for coloring dyes, cloth, and banners whereas the "color" module is used for coloring things like leather armor. ### Usage ```javascript color.red // references org.bukkit.Color.RED ``` ### Example ```javascript // Sets the color of a pair of leather boots to red and gives them to "player" var boots = items.leatherBoots(1); var bootsMeta = boots.itemMeta; bootsMeta.color = color.red; boots.itemMeta = bootsMeta; player.equipment.boots = boots; ``` ### List of colors: * aqua * black * blue * fuchsia * gray * green * lime * maroon * navy * olive * orange * purple * red * silver * teal * white * yellow ## DyeColor Module Provides access to all possible colors in `org.bukkit.DyeColor` NOTE: The "dyeColor" module is not to be confused with the "color" module. The "dyeColor" module is used for coloring dyes, cloth, and banners whereas the "color" module is used for coloring things like leather armor. ### Usage ```javascript dyeColor.blue // references org.bukkit.DyeColor.BLUE ``` ### Example ```javascript // sets the dyeColor of bannerBlock to blue // bannerBlock is a standing banner block var bannerState = bannerBlock.state; bannerState.baseColor = dyeColor.blue; bannerState.update(); ``` ### List of dye colors: * black * blue * brown * cyan * gray * green * lightblue * lime * magenta * orange * pink * purple * red * silver * white * yellow ## DamageCause Module Provides access to all possible causes of damage in `org.bukkit.event.entity.EntityDamageEvent.DamageCause` that could result in an EntityDamageEvent being fired. ### Usage ```javascript damageCause.fall // returns enum org.bukkit.event.entity.EntityDamageEvent.DamageCause.FALL ``` ### Example ```javascript // prevents entities from taking falling damage var onEntityDamage = function(event) { if (event.cause == damageCause.fall) { event.cancelled = true; } } events.entityDamage(onEntityDamage); ``` ### List of damage causes: * blockExplosion * Damage caused by being in the area when a block explodes. * contact * Damage caused when an entity contacts a block such as a Cactus. * custom * Custom damage. * dragonBreath * Damage caused by a dragon breathing fire. * drowning * Damage caused by running out of air while in water * entityAttack * Damage caused when an entity attacks another entity. * entityExplosion * Damage caused by being in the area when an entity, such as a Creeper, explodes. * fall * Damage caused when an entity falls a distance greater than 3 blocks * fallingBlock * Damage caused by being hit by a falling block which deals damage * fire * Damage caused by direct exposure to fire * fireTick * Damage caused due to burns caused by fire * flyIntoWall * Damage caused when an entity runs into a wall. * hotFloor * Damage caused when an entity steps on Material.MAGMA. * lava * Damage caused by direct exposure to lava * lightning * Damage caused by being struck by lightning * magic * Damage caused by being hit by a damage potion or spell * melting * Damage caused due to a snowman melting * poison * Damage caused due to an ongoing poison effect * projectile * Damage caused when attacked by a projectile. * starvation * Damage caused by starving due to having an empty hunger bar * suffocation * Damage caused by being put in a block * suicide * Damage caused by committing suicide using the command "/kill" * thorns * Damage caused in retaliation to another attack by the Thorns enchantment. * void * Damage caused by falling into the void * wither * Damage caused by Wither potion effect ## Effect Module Effects are sent to players' clients by the server and add visuals and/or sounds to the game. The `effect` module provides access to all effect enums in `org.bukkit.Effect`. [Spigot JavaDocs: Effect](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Effect.html) Use the `playEffect()` function to display the effects, as shown in the example below. ### Usage ```javascript effect.enderSignal // returns enum org.bukkit.Effect.ENDER_SIGNAL ``` ### Example ```javascript // Displays the "mobspawnerFlames" visual effect when the player moves var onPlayerMove = function(event) { var player = event.player; player.playEffect(player.location, effect.mobspawnerFlames, 5); }; events.playerMove(onPlayerMove); ``` ### List of effects: * anvilBreak * The sound played when an anvil breaks * anvilLand * The sound played when an anvil lands after falling * anvilUse * The sound played when an anvil is used * batTakeoff * Sound played by a bat taking off * blazeShoot * Sound of blaze firing. * bowFire * Sound of a bow firing. * brewingStandBrew * The sound played by brewing stands when brewing * chorusFlowerDeath * The sound played when a chorus flower dies * chorusFlowerGrow * The sound played when a chorus flower grows * click1 * A click sound. * click2 * An alternate click sound. * cloud * A puff of white smoke * colouredDust * Multicolored dust particles * crit * Critical hit particles * doorClose * Sound of a door closing. * doorToggle * Sound of a door opening. * dragonBreath * The sound/particles used by the enderdragon's breath attack. * endGatewaySpawn * The sound/particles caused by a end gateway spawning * enderSignal * An ender eye signal; a visual effect. * enderdragonGrowl * The sound of an enderdragon growling * enderdragonShoot * Sound of an enderdragon firing * endereyeLaunch * The sound played when launching an endereye * explosion * Explosion particles * explosionHuge * The biggest explosion particle effect * explosionLarge * A larger version of the explode particle * extinguish * Sound of fire being extinguished. * fenceGateClose * Sound of a door closing. * fenceGateToggle * Sound of a door opening. * fireworkShoot * The sound played when launching a firework * fireworksSpark * The spark that comes off a fireworks * flame * Fire particles * flyingGlyph * The symbols that fly towards the enchantment table * footstep * A small gray square * ghastShoot * Sound of ghast firing. * ghastShriek * Sound of ghast shrieking. * happyVillager * The particle that appears when trading with a villager * heart * The particle that appears when breading animals * instantSpell * A puff of white stars * ironDoorClose * Sound of a door closing. * ironDoorToggle * Sound of a door opening. * ironTrapdoorClose * Sound of a door closing. * ironTrapdoorToggle * Sound of a door opening. * itemBreak * The particles generated when a tool breaks. * largeSmoke * The smoke particles that appears on blazes, minecarts with furnaces and fire * lavaPop * The particles that pop out of lava * lavadrip * The lava drip particle that appears on blocks under lava * magicCrit * Blue critical hit particles * mobspawnerFlames * The flames seen on a mobspawner; a visual effect. * note * The note that appears above note blocks * particleSmoke * Smoke particles * portal * The particles shown at nether portals * portalTravel * The sound played when traveling through a portal * potionBreak * Visual effect of a splash potion breaking. * potionSwirl * Multicolored potion effect particles * potionSwirlTransparent * Multicolored potion effect particles that are slightly transparent * recordPlay * A song from a record. * slime * The particle shown when a slime jumps * smallSmoke * Small gray particles * smoke * A visual smoke effect. * snowShovel * White particles * snowballBreak * Snowball breaking * spell * A puff of white potion swirls * splash * Water particles * stepSound * Sound of a block breaking. * tileBreak * The particles generated while breaking a block. * tileDust * The particles generated while sprinting a block This particle requires a Material and data value so that the client can select the correct texture. * trapdoorClose * Sound of a trapdoor closing. * trapdoorToggle * Sound of a trapdoor opening. * villagerPlantGrow * Particles displayed when a villager grows a plant, data is the number of particles * villagerThundercloud * The particle that appears when hitting a villager * voidFog * Small gray particles * waterdrip * The water drip particle that appears on blocks under water * witchMagic * A puff of purple particles * witherBreakBlock * The sound played when a wither breaks a block * witherShoot * Sound of a wither shooting * zombieChewIronDoor * Sound of zombies chewing on iron doors. * zombieChewWoodenDoor * Sound of zombies chewing on wooden doors. * zombieConvertedVillager * The sound played when a villager is converted by a zombie * zombieDestroyDoor * Sound of zombies destroying a door. * zombieInfect * The sound played when a zombie infects a target ## Enchantment Module Provides access to all enchantments in Minecraft that can be applied to equipment. Use the `addEnchant()` function to apply the enchantment to an item's ItemMeta. [Spigot JavaDocs: ItemMeta.addEnchant()](https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/meta/ItemMeta.html#addEnchant(org.bukkit.enchantments.Enchantment,%20int,%20boolean)) ### Usage ```javascript enchantment.durability // returns the Field org.bukkit.enchantments.Enchantment.DURABILITY ``` ### Example ```javascript // adds the "durability" enchantment to the "sword" var sword = items.diamondSword(); var swordMeta = sword.itemMeta; swordMeta.addEnchant(enchantment.durability, 1, true); sword.itemMeta = swordMeta; ``` ### List of enchantments: * arrowDamage * Provides extra damage when shooting arrows from bows * arrowFire * Sets entities on fire when hit by arrows shot from a bow * arrowInfinite * Provides infinite arrows when shooting a bow * arrowKnockback * Provides a knockback when an entity is hit by an arrow from a bow * damageAll * Increases damage against all targets * damageArthropods * Increases damage against arthropod targets * damageUndead * Increases damage against undead targets * depthStrider * Increases walking speed while in water * digSpeed * Increases the rate at which you mine/dig * durability * Decreases the rate at which a tool looses durability * fireAspect * When attacking a target, has a chance to set them on fire * frostWalker * Freezes any still water adjacent to ice / frost which player is walking on * knockback * All damage to other targets will knock them back when hit * lootBonusBlocks * Provides a chance of gaining extra loot when destroying blocks * lootBonusMobs * Provides a chance of gaining extra loot when killing monsters * luck * Decreases odds of catching worthless junk * lure * Increases rate of fish biting your hook * mending * Allows mending the item using experience orbs * oxygen * Decreases the rate of air loss whilst underwater * protectionEnvironmental * Provides protection against environmental damage * protectionExplosions * Provides protection against explosive damage * protectionFall * Provides protection against fall damage * protectionFire * Provides protection against fire damage * protectionProjectile * Provides protection against projectile damage * silkTouch * Allows blocks to drop themselves instead of fragments (for example, stone instead of cobblestone) * thorns * Damages the attacker * waterWorker * Increases the speed at which a player may mine underwater ## EntityTypeCheck Module Provides a set of functions that can be used to check if an entity is of a certain type. For a list of all entity types in Minecraft, refer to [Spigot JavaDocs: EntityType](https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/EntityType.html) ### Usage ```javascript isChicken(entity) // returns "true" if "entity" is a chicken ``` ### Example ```javascript // when a projectile hits something check to see if it is an "Arrow" // if it is, create an explosion where it landed function onProjectileHit(event) { var projectile = event.entity; var world = projectile.world; if (isArrow(projectile)) { projectile.remove(); world.createExplosion(projectile.location, 5); } } events.projectileHit(onProjectileHit); ``` ## EntityType Module The entityType module provides access to all of the EntityType enums in `org.bukkit.entity.EntityType`. [Spigot JavaDocs: EntityType](https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/EntityType.html) Often used as a parameter of methods like `World.spawnEntity()` to specify the type of entity that should be spawned. [Spigot JavaDocs: World.spawnEntity()](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/World.html#spawnEntity(org.bukkit.Location,%20org.bukkit.entity.EntityType)) ### Usage ```javascript entityType.chicken // returns the enum org.bukkit.entity.EntityType.CHICKEN ``` ### Example ```javascript // spawns a "chicken" entity at the target location // when the player right-clicks on a block var world = server.worlds.get(0); var onPlayerInteract = function(event) { if (event.action == action.rightClickBlock) { var clickedBlockLoc = event.clickedBlock.location; world.spawnEntity(clickedBlockLoc, entityType.chicken); } } events.playerInteract(onPlayerInteract); ``` ## File Module The `file` module provides functions for reading and writing persistent JSON data to files so that plugins that require it can maintain their state across server restarts or reloads. ### file.load() Returns a string containing all text in the data file loaded. #### Parameters filename: string specifying the name of the file to load data from #### Usage ```javascript var rawData = file.load("data-file.json"); ``` ### file.write() Saves the desired JSON data (as a string) to a file with the specified name. #### Parameters filename: string specifying the name of the file to write data to data: stringifyed JSON data to be written to the file #### Usage ```javascript file.write("data-file.json", '{"data": []}'); ``` ### Example ```javascript exports.setWarp = function(label) { var rawData; var data; var warpLocations; try { rawData = file.load("warping-data.json"); data = JSON.parse(rawData); warpLocations = data[0].warpLocations; if (Object.keys(warpLocations).length === 0) { warpLocations = []; } } catch(err) { file.write("warping-data.json", '{"warpLocations": []}'); warpLocations = []; } if (typeof(label) != "string") { echo("Usage: /js setWarp(