diff --git a/.gitignore b/.gitignore index 749abfc1a..b6ba71782 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,8 @@ build.local.properties /src/docs/build/classes/hello.js /src/docs/build/classes/.netbeans_automatic_build /src/docs/build/classes/.netbeans_update_resources +build +nbproject +/manifest.mf +/platform.properties +CopyLibs \ No newline at end of file diff --git a/README.md b/README.md index dda0d435d..809d43fd9 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,14 @@ -# Let's begin … +# ScriptCraft - Modding Minecraft with Javascript + [![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/walterhiggins/ScriptCraft?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +ScriptCraft lets you write Minecraft Mods using Javascript - a +programming language that's relatively easy to learn and use. +ScriptCraft is a Minecraft Server plugin which means it must be used +with a Minecraft server. Once you've downloaded and installed the +Minecraft Server, then installed the ScriptCraft Plugin you can write +your own Minecraft mods using Javascript. + I created ScriptCraft to make it easier for younger programmers to create their own Minecraft Mods. Mods are written using the JavaScript programming language. Once the ScriptCraft mod is @@ -13,7 +21,7 @@ files in a directory. then [Start Here][cda]. * Watch some [demos][ytpl] of what you can do with ScriptCraft. -This is a simple mod in a file called greet.js in the scriptcraft/plugins directory … +This is a simple mod in a file called greet.js in the scriptcraft/plugins directory: ```javascript function greet( player ) { @@ -28,7 +36,7 @@ At the in-game prompt, type: /js greet(self) ``` -Anything you can do using the CanaryMod or CraftBukkit APIs in Java, +Anything you can do using the Spigot or CanaryMod APIs in Java, you can do using ScriptCraft in JavaScript. # Description @@ -36,20 +44,22 @@ you can do using ScriptCraft in JavaScript. ScriptCraft is a plugin for Minecraft Servers which lets operators, administrators and plug-in authors customize the game using JavaScript. ScriptCraft makes it easier to create your own mods. Mods -can be written in Javscript and can use the full [CanaryMod API][cm] -or [Bukkit API][bukkit]. ScriptCraft works with all of the following Minecraft Server software: +can be written in Javscript and can use the full [SpigotMC +API][spigot] or [CanaryMod API][cm]. ScriptCraft works with all of the +following Minecraft Server software: -* [CanaryMod][cm] (Recommended) -* [SpigotMC][spigot] (Bukkit-compatible) -* [GlowStone][gs] (Bukkit-compatible) +* [SpigotMC][spigot] (Recommended) +* [GlowStone][gs] +* [CanaryMod][cm] [spigot]: http://www.spigotmc.org/ [gs]: http://www.glowstone.net/ +[cm]: http://canarymod.net/ -I recommend using CanaryMod because CraftBukkit is no longer being -actively developed due to a legal dispute. The ScriptCraft mod also -lets you enter javascript commands at the in-game prompt. To bring up -the in-game prompt press the `/` key then type `js ` followed by any +I recommend using SpigotMC because both CanaryMod and CraftBukkit are +no longer being actively developed. The ScriptCraft mod also lets you +enter javascript commands at the in-game prompt. To bring up the +in-game prompt press the `/` key then type `js ` followed by any javascript statement. For example: `/js 1 + 1` will print 2. ScriptCraft also includes many objects and functions to make building @@ -63,23 +73,40 @@ Minecraft. [cottage]: https://github.com/walterhiggins/ScriptCraft/tree/master/src/main/js/plugins/drone/contrib/cottage.js [temple]: https://github.com/walterhiggins/ScriptCraft/blob/master/src/main/js/plugins/drone/contrib/temple.js [bukkit]: http://dl.bukkit.org/ -[cm]: http://canarymod.net/ # Prerequisites -* You will need to have Java version 6 or later installed on your - machine. Check the version by typing `java -version` at a command - prompt. - -* You will need to [install CanaryMod][ic] on your - machine. CanaryMod is a customized version of Minecraft Server that - makes it easy to install plugins and customize Minecraft. You can - [download the CanaryMod server here.][ic] +ScriptCraft is a Minecraft Server Mod which only works with Minecraft +for Personal computers (Windows, Mac and Linux). It does not work with +X-BOX, Playstation or WiiU versions of the game. You will need to have +Java version 7 or later installed. Check the version by typing `java +-version` at a command prompt. # Installation -If you don't want to compile from source, you can [download the -compiled plugin here][dl] and copy it to the CanaryMod plugins directory. +Before installing ScriptCraft you must first install SpigotMC which is +a special version of Minecraft Server that makes it easy to customize +the game. + +## Installing and Running SpigotMC + +Follow these steps to download and install SpigotMC. + +1. Download Spigot's [BuildTools.jar][spigotdl] +2. Save the BuildTools.jar file to a new directory called spigotmc. +3. Open a terminal (Mac and Linux) or command prompt (windows) window and type `java -jar BuildTools.jar`. This will kick off a long series of commands to "build" SpigotMC. +4. When the build is done, there will be a new file beginning with `spigot` and ending in `.jar` in the spigotmc directory. Run this file by typing `java -jar spigot-1.10.2.jar` (it might not be that exact name - you can list files in the directory by typing `dir` (Windows) or `ls` (Mac and Linux). +5. The server will start up then shut down very shortly afterwards. You'll need to edit a file called `eula.txt` - change `eula=false` to `eula=true` and save the file. +6. Run the `java -jar spigot-1.10.2.jar` command again - this time the server will start up. Shut it down by typing `stop` at the server prompt. + +## Installing ScriptCraft + +Follow these steps to download and install ScriptCraft. + +1. Download the [scriptcraft.jar][dl] plugin and save it to the `plugins` directory and restart the server by typing `java -jar spigot-1.10.2.jar`. +2. At the server prompt type `js 1 + 1` and hit enter. The result `2` should be displayed. + +Congratulations - you've just installed your Custom Minecraft Server and are ready to begin writing your first mod! # Post Install @@ -87,26 +114,43 @@ Once installed, a new scriptcraft/plugins directory is automatically created. All files in the scriptcraft/plugins directory will be automatically loaded when the server starts. *Only players who are ops can use this plugin.* You can grant a player `op` privileges by -typing 'op ' at the server console prompt or by adding the -player's username to the ops.txt file in your server directory. +typing 'op ' (replacing with your own Minecraft +user name) at the server console prompt or by adding the player's +username to the ops.txt file in your server directory. Launch the server, then launch the Minecraft client and create a new server connection. The IP address will be `localhost` . Once you've connected to your server and have entered the game, look at a -ground-level block and type … +ground-level block and type: /js up().box( blocks.wool.black, 4, 9, 1 ) … This will create a black monolith structure 4 blocks wide by 9 blocks high by 1 block long. Take a look at the src/main/javascript/drone/drone.js file to see what ScriptCraft's -drone can do. If you're interested in customizing minecraft beyond -just creating new buildings, take a look at [the homes mod][homes] for an example of how to create a more fully-featured JavaScript plugin for Minecraft. +drone can do. + +If you're interested in customizing minecraft beyond just creating new buildings, take a look at [the homes mod][homes] for an example of how to create a more fully-featured JavaScript plugin for Minecraft. + +## Your first mod - Howling blocks +Listed below is a simple mod that will make blocks 'Howl' when they're broken. + +``` javascript +// copy and paste this code to a new file named 'scriptcraft/plugins/howling-blocks.js' +var sounds = require('sounds'); +function howl(event){ + sounds.entityWolfHowl( event.block ); +} +events.blockBreak( howl ); +``` + +If you're using CanaryMod instead of SpigotMC you can [download the equivalent code](https://gist.github.com/walterhiggins/69cddd15160d803fb096). A JavaScript mod for minecraft is just a JavaScript source file (.js) located in the scriptcraft/plugins directory. All .js files in this -directory will be automatically loaded when the server starts. To get -started writing your own mod, take a look at some of the +directory will be automatically loaded when the server starts. + +To get started writing your own mod, take a look at some of the [examples][examples]. [homes]: src/main/js/plugins/homes/homes.js @@ -114,29 +158,31 @@ started writing your own mod, take a look at some of the # Additional information -Because the CanaryMod API is open, all of the CanaryMod API is accessible +Because the SpigotMC API is open, all of the SpigotMC API is accessible via javascript once the ScriptCraft plugin is loaded. There are a couple of useful Java objects exposed via javascript in the -ScriptCraft plugin … +ScriptCraft plugin: * `__plugin` – the ScriptCraft Plugin itself. This is a useful - starting point for accessing other CanaryMod objects. The `__plugin` - object is of type [net.canarymod.plugin.Plugin][api] and all - of its properties and methods are accessible. For example … `js + starting point for accessing other SpigotMC objects. The `__plugin` + object is of type [org.bukkit.plugin.Plugin][api] and all + of its properties and methods are accessible. For example: `js __plugin.name` returns the plugin's name (JavaScript is more concise than the equivalent Java code: `__plugin.getName()` ). - * `server` – The top-level net.canarymod.Server object. See the [CanaryMod API docs][cmapi] for reference. + * `server` – The top-level org.bukkit.Server object. See the [SpigotMC API docs][spigotapi] for reference. * `self` – The player/command-block or server console operator who invoked the `/js` command. Again, this is a good jumping off point for - diving into the CanaryMod API. + diving into the SpigotMC API. [dl]: http://scriptcraftjs.org/download/latest -[api]: https://ci.visualillusionsent.net/job/CanaryLib/javadoc/ +[api]: https://hub.spigotmc.org/javadocs/spigot/ [ic]: http://canarymod.net/releases +[spigotdl]: https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar [cmapi]: https://ci.visualillusionsent.net/job/CanaryLib/javadoc/ +[spigotapi]: https://hub.spigotmc.org/javadocs/spigot/ # Contributing @@ -149,9 +195,9 @@ If you would like to contribute source code and/or documentation changes please # Bukkit Configuration ## (You can ignore this if using CanaryMod) -ScriptCraft also works with Bukkit Plugin and uses the Bukkit Configuration +ScriptCraft works with Bukkit Plugin and uses the Bukkit Configuration API. On first loading, ScriptCraft will create a config.yml file in -the plugins/scriptcraft/ directory. This file looks like this … +the plugins/scriptcraft/ directory. This file looks like this: extract-js: plugins: true @@ -171,8 +217,8 @@ ScriptCraft has [its own website][website] with further information. * To get started using ScriptCraft to Learn JavaScript, read [The Young Person's Guide to Programming in Minecraft][yp]. * The ScriptCraft [API documentation][api]. * To delve deeper into creating your own minecraft mod for use by others, read [Creating a complete Minecraft Mod in JavaScript][mm]. - * Take a look at some [examples][ex] - * Buy the Official ScriptCraft Book [A Beginner's Guide to Writing Minecraft Plugins in Javascript][book] + * Take a look at some [examples][ex]. + * Buy the Official ScriptCraft Book [A Beginner's Guide to Writing Minecraft Plugins in Javascript][book]. @@ -188,14 +234,14 @@ programs and how to do the same thing in JavaScript. I highly recommend the series of [tutorials provided by CoderDojo Athenry][cda]. -Developer Chris Cacciatore has created some interesting tools using ScriptCraft … +Developer Chris Cacciatore has created some interesting tools using ScriptCraft: * [A wolf-bot][wb] - * [L-Systems (Large-scale fractal structures in Minecraft)][ls] + * [L-Systems (Large-scale fractal structures in Minecraft)][ls] # Docker -To launch a container with CanaryMod and ScriptCraft you can just do +To launch a container with SpigotMC and ScriptCraft you can just do docker run -p 25565:25565 -it tclavier/scriptcraft diff --git a/build.properties b/build.properties index d8eeaff7a..f6a95ea6f 100644 --- a/build.properties +++ b/build.properties @@ -1 +1 @@ -scriptcraft-version=3.1.10 +scriptcraft-version=3.2.1 diff --git a/build.xml b/build.xml index 2b70ee8f1..48d0e1b5c 100644 --- a/build.xml +++ b/build.xml @@ -12,7 +12,7 @@ - + @@ -89,22 +89,30 @@ err="${dist}/gen-api-error.log"> + + + + + + - + @@ -116,7 +124,7 @@ - + @@ -181,7 +189,7 @@ Walter Higgins - + diff --git a/docs/API-Reference.md b/docs/API-Reference.md index b42ec1788..fbfd45d54 100644 --- a/docs/API-Reference.md +++ b/docs/API-Reference.md @@ -50,7 +50,7 @@ Walter Higgins * [module name resolution](#module-name-resolution) * [events Module](#events-module) * [events.on() static method](#eventson-static-method) - * [Events Helper Module (canary version)](#events-helper-module-canary-version) + * [Events Helper Module (CanaryMod version)](#events-helper-module-canarymod-version) * [Usage](#usage) * [events.minecartActivate()](#eventsminecartactivate) * [events.villagerTradeUnlock()](#eventsvillagertradeunlock) @@ -171,173 +171,186 @@ Walter Higgins * [events.serverTick()](#eventsservertick) * [events.serverListPing()](#eventsserverlistping) * [events.serverShutdown()](#eventsservershutdown) - * [Events Helper Module (bukkit version)](#events-helper-module-bukkit-version) + * [Events Helper Module (SpigotMC version)](#events-helper-module-spigotmc-version) * [Usage](#usage-1) - * [events.weatherChange()](#eventsweatherchange-1) - * [events.lightningStrike()](#eventslightningstrike-1) - * [events.thunderChange()](#eventsthunderchange) - * [events.vehicleMove()](#eventsvehiclemove-1) - * [events.vehicleDestroy()](#eventsvehicledestroy-1) - * [events.vehicleExit()](#eventsvehicleexit-1) - * [events.vehicleEntityCollision()](#eventsvehicleentitycollision) - * [events.vehicleBlockCollision()](#eventsvehicleblockcollision) - * [events.vehicleEnter()](#eventsvehicleenter-1) - * [events.vehicleDamage()](#eventsvehicledamage-1) - * [events.vehicleUpdate()](#eventsvehicleupdate) - * [events.vehicleCreate()](#eventsvehiclecreate) - * [events.paintingBreak()](#eventspaintingbreak) - * [events.paintingBreakByEntity()](#eventspaintingbreakbyentity) - * [events.paintingPlace()](#eventspaintingplace) - * [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-1) - * [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.playerKick()](#eventsplayerkick) - * [events.playerToggleSprint()](#eventsplayertogglesprint) - * [events.playerCommandPreprocess()](#eventsplayercommandpreprocess) - * [events.playerGameModeChange()](#eventsplayergamemodechange) - * [events.furnaceSmelt()](#eventsfurnacesmelt) + * [events.blockFade()](#eventsblockfade) + * [events.blockFromTo()](#eventsblockfromto) + * [events.notePlay()](#eventsnoteplay) + * [events.blockPlace()](#eventsblockplace-1) + * [events.blockGrow()](#eventsblockgrow-1) + * [events.entityBlockForm()](#eventsentityblockform) + * [events.blockPistonExtend()](#eventsblockpistonextend) + * [events.blockPistonRetract()](#eventsblockpistonretract) + * [events.blockSpread()](#eventsblockspread) + * [events.blockBurn()](#eventsblockburn) + * [events.blockDamage()](#eventsblockdamage) + * [events.leavesDecay()](#eventsleavesdecay) + * [events.blockDispense()](#eventsblockdispense) + * [events.blockForm()](#eventsblockform) + * [events.blockMultiPlace()](#eventsblockmultiplace) + * [events.blockIgnite()](#eventsblockignite) + * [events.blockPhysics()](#eventsblockphysics-1) + * [events.blockRedstone()](#eventsblockredstone) + * [events.cauldronLevelChange()](#eventscauldronlevelchange) + * [events.blockCanBuild()](#eventsblockcanbuild) + * [events.signChange()](#eventssignchange-1) + * [events.blockExp()](#eventsblockexp) + * [events.blockExplode()](#eventsblockexplode) + * [events.blockBreak()](#eventsblockbreak) + * [events.prepareAnvil()](#eventsprepareanvil) + * [events.brew()](#eventsbrew) + * [events.inventoryClose()](#eventsinventoryclose) * [events.inventoryDrag()](#eventsinventorydrag) + * [events.inventoryCreative()](#eventsinventorycreative) + * [events.prepareItemCraft()](#eventsprepareitemcraft) * [events.craftItem()](#eventscraftitem) + * [events.inventoryClick()](#eventsinventoryclick) + * [events.brewingStandFuel()](#eventsbrewingstandfuel) + * [events.inventoryPickupItem()](#eventsinventorypickupitem) + * [events.furnaceExtract()](#eventsfurnaceextract) + * [events.inventory()](#eventsinventory-1) * [events.furnaceBurn()](#eventsfurnaceburn) + * [events.furnaceSmelt()](#eventsfurnacesmelt) * [events.inventoryOpen()](#eventsinventoryopen) - * [events.inventoryPickupItem()](#eventsinventorypickupitem) * [events.inventoryMoveItem()](#eventsinventorymoveitem) - * [events.inventoryClick()](#eventsinventoryclick) - * [events.inventoryClose()](#eventsinventoryclose) - * [events.inventoryCreative()](#eventsinventorycreative) - * [events.inventory()](#eventsinventory-1) - * [events.prepareItemCraft()](#eventsprepareitemcraft) - * [events.furnaceExtract()](#eventsfurnaceextract) - * [events.brew()](#eventsbrew) - * [events.serverCommand()](#eventsservercommand) - * [events.serverListPing()](#eventsserverlistping-1) - * [events.serviceRegister()](#eventsserviceregister) - * [events.pluginDisable()](#eventsplugindisable-1) - * [events.remoteServerCommand()](#eventsremoteservercommand) - * [events.mapInitialize()](#eventsmapinitialize) - * [events.serviceUnregister()](#eventsserviceunregister) - * [events.pluginEnable()](#eventspluginenable-1) - * [events.playerDeath()](#eventsplayerdeath-1) - * [events.entityCreatePortal()](#eventsentitycreateportal) + * [events.hangingPlace()](#eventshangingplace) + * [events.hangingBreak()](#eventshangingbreak) + * [events.hangingBreakByEntity()](#eventshangingbreakbyentity) + * [events.entityToggleGlide()](#eventsentitytoggleglide) + * [events.itemSpawn()](#eventsitemspawn) + * [events.spawnerSpawn()](#eventsspawnerspawn) + * [events.foodLevelChange()](#eventsfoodlevelchange) + * [events.lingeringPotionSplash()](#eventslingeringpotionsplash) + * [events.entityShootBow()](#eventsentityshootbow) + * [events.entityTargetLivingEntity()](#eventsentitytargetlivingentity) * [events.entityCombust()](#eventsentitycombust) - * [events.sheepDyeWool()](#eventssheepdyewool) + * [events.entityBreed()](#eventsentitybreed) * [events.expBottle()](#eventsexpbottle) - * [events.entityTame()](#eventsentitytame-1) + * [events.slimeSplit()](#eventsslimesplit-1) + * [events.entityDeath()](#eventsentitydeath-1) + * [events.entityAirChange()](#eventsentityairchange) * [events.projectileLaunch()](#eventsprojectilelaunch) - * [events.entityDamage()](#eventsentitydamage) - * [events.itemSpawn()](#eventsitemspawn) - * [events.projectileHit()](#eventsprojectilehit-1) - * [events.foodLevelChange()](#eventsfoodlevelchange) - * [events.itemDespawn()](#eventsitemdespawn) - * [events.entityPortalEnter()](#eventsentityportalenter) * [events.entityPortal()](#eventsentityportal) - * [events.entityTarget()](#eventsentitytarget) - * [events.entityDeath()](#eventsentitydeath-1) + * [events.horseJump()](#eventshorsejump) + * [events.fireworkExplode()](#eventsfireworkexplode-1) + * [events.entityExplode()](#eventsentityexplode) + * [events.itemMerge()](#eventsitemmerge) * [events.entitySpawn()](#eventsentityspawn-1) - * [events.sheepRegrowWool()](#eventssheepregrowwool) - * [events.entityShootBow()](#eventsentityshootbow) + * [events.projectileHit()](#eventsprojectilehit-1) + * [events.creatureSpawn()](#eventscreaturespawn) + * [events.entityPortalExit()](#eventsentityportalexit) + * [events.entityTame()](#eventsentitytame-1) + * [events.entityPortalEnter()](#eventsentityportalenter) + * [events.playerLeashEntity()](#eventsplayerleashentity) + * [events.entityDamage()](#eventsentitydamage) + * [events.pigZap()](#eventspigzap) + * [events.entityCombustByEntity()](#eventsentitycombustbyentity) + * [events.entityChangeBlock()](#eventsentitychangeblock) + * [events.areaEffectCloudApply()](#eventsareaeffectcloudapply) * [events.creeperPower()](#eventscreeperpower) + * [events.sheepDyeWool()](#eventssheepdyewool) + * [events.playerDeath()](#eventsplayerdeath-1) + * [events.villagerReplenishTrade()](#eventsvillagerreplenishtrade) * [events.entityCombustByBlock()](#eventsentitycombustbyblock) + * [events.entityResurrect()](#eventsentityresurrect) + * [events.villagerAcquireTrade()](#eventsvillageracquiretrade) + * [events.enderDragonChangePhase()](#eventsenderdragonchangephase) + * [events.entityCreatePortal()](#eventsentitycreateportal) + * [events.sheepRegrowWool()](#eventssheepregrowwool) + * [events.entityRegainHealth()](#eventsentityregainhealth) + * [events.entityInteract()](#eventsentityinteract) + * [events.potionSplash()](#eventspotionsplash) + * [events.entityTarget()](#eventsentitytarget) * [events.entityBreakDoor()](#eventsentitybreakdoor) - * [events.entityDamageByEntity()](#eventsentitydamagebyentity) * [events.entityUnleash()](#eventsentityunleash) - * [events.entityExplode()](#eventsentityexplode) - * [events.entityInteract()](#eventsentityinteract) - * [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-1) - * [events.pigZap()](#eventspigzap) - * [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.blockFade()](#eventsblockfade) - * [events.blockPlace()](#eventsblockplace-1) - * [events.blockPhysics()](#eventsblockphysics-1) - * [events.blockIgnite()](#eventsblockignite) - * [events.blockBreak()](#eventsblockbreak) - * [events.blockBurn()](#eventsblockburn) - * [events.blockFromTo()](#eventsblockfromto) - * [events.blockRedstone()](#eventsblockredstone) - * [events.blockPistonRetract()](#eventsblockpistonretract) - * [events.blockDispense()](#eventsblockdispense) - * [events.signChange()](#eventssignchange-1) - * [events.blockPistonExtend()](#eventsblockpistonextend) - * [events.blockCanBuild()](#eventsblockcanbuild) - * [events.blockGrow()](#eventsblockgrow-1) - * [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.itemDespawn()](#eventsitemdespawn) + * [events.explosionPrime()](#eventsexplosionprime) + * [events.entityDamageByEntity()](#eventsentitydamagebyentity) + * [events.portalCreate()](#eventsportalcreate-1) + * [events.worldSave()](#eventsworldsave) * [events.worldLoad()](#eventsworldload) + * [events.chunkLoad()](#eventschunkload) + * [events.chunkPopulate()](#eventschunkpopulate) + * [events.chunkUnload()](#eventschunkunload-1) + * [events.structureGrow()](#eventsstructuregrow) * [events.worldInit()](#eventsworldinit) + * [events.spawnChange()](#eventsspawnchange) * [events.worldUnload()](#eventsworldunload) - * [events.worldSave()](#eventsworldsave) - * [events.chunkUnload()](#eventschunkunload-1) - * [events.chunkPopulate()](#eventschunkpopulate) - * [events.portalCreate()](#eventsportalcreate-1) - * [events.chunkLoad()](#eventschunkload) + * [events.playerShearEntity()](#eventsplayershearentity) + * [events.playerVelocity()](#eventsplayervelocity) + * [events.playerBucketFill()](#eventsplayerbucketfill) + * [events.playerFish()](#eventsplayerfish) + * [events.playerGameModeChange()](#eventsplayergamemodechange) + * [events.playerCommandPreprocess()](#eventsplayercommandpreprocess) + * [events.playerInteract()](#eventsplayerinteract) + * [events.playerInteractAtEntity()](#eventsplayerinteractatentity) + * [events.playerPortal()](#eventsplayerportal) + * [events.playerPreLogin()](#eventsplayerprelogin) + * [events.playerMove()](#eventsplayermove-1) + * [events.playerQuit()](#eventsplayerquit) + * [events.playerToggleSneak()](#eventsplayertogglesneak) + * [events.playerPickupArrow()](#eventsplayerpickuparrow) + * [events.playerBedLeave()](#eventsplayerbedleave) + * [events.playerChangedMainHand()](#eventsplayerchangedmainhand) + * [events.playerEditBook()](#eventsplayereditbook) + * [events.playerAnimation()](#eventsplayeranimation) + * [events.playerResourcePackStatus()](#eventsplayerresourcepackstatus) + * [events.playerItemDamage()](#eventsplayeritemdamage) + * [events.playerBucketEmpty()](#eventsplayerbucketempty) + * [events.playerExpChange()](#eventsplayerexpchange) + * [events.asyncPlayerChat()](#eventsasyncplayerchat) + * [events.playerItemBreak()](#eventsplayeritembreak) + * [events.playerUnleashEntity()](#eventsplayerunleashentity) + * [events.playerRespawn()](#eventsplayerrespawn) + * [events.playerDropItem()](#eventsplayerdropitem) + * [events.playerItemHeld()](#eventsplayeritemheld) + * [events.playerTeleport()](#eventsplayerteleport) + * [events.playerInteractEntity()](#eventsplayerinteractentity) + * [events.playerEggThrow()](#eventsplayereggthrow) + * [events.playerChat()](#eventsplayerchat) + * [events.playerRegisterChannel()](#eventsplayerregisterchannel) + * [events.playerSwapHandItems()](#eventsplayerswaphanditems) + * [events.playerChangedWorld()](#eventsplayerchangedworld) + * [events.playerLevelChange()](#eventsplayerlevelchange) + * [events.playerPickupItem()](#eventsplayerpickupitem) + * [events.asyncPlayerPreLogin()](#eventsasyncplayerprelogin) + * [events.playerUnregisterChannel()](#eventsplayerunregisterchannel) + * [events.playerStatisticIncrement()](#eventsplayerstatisticincrement) + * [events.playerBedEnter()](#eventsplayerbedenter) + * [events.playerKick()](#eventsplayerkick) + * [events.playerToggleSprint()](#eventsplayertogglesprint) + * [events.playerAchievementAwarded()](#eventsplayerachievementawarded) + * [events.playerJoin()](#eventsplayerjoin) + * [events.playerToggleFlight()](#eventsplayertoggleflight) + * [events.playerArmorStandManipulate()](#eventsplayerarmorstandmanipulate) + * [events.playerLogin()](#eventsplayerlogin) + * [events.playerItemConsume()](#eventsplayeritemconsume) + * [events.playerChatTabComplete()](#eventsplayerchattabcomplete) + * [events.weatherChange()](#eventsweatherchange-1) + * [events.thunderChange()](#eventsthunderchange) + * [events.lightningStrike()](#eventslightningstrike-1) + * [events.vehicleMove()](#eventsvehiclemove-1) + * [events.vehicleDamage()](#eventsvehicledamage-1) + * [events.vehicleDestroy()](#eventsvehicledestroy-1) + * [events.vehicleUpdate()](#eventsvehicleupdate) + * [events.vehicleCreate()](#eventsvehiclecreate) + * [events.vehicleEntityCollision()](#eventsvehicleentitycollision) + * [events.vehicleBlockCollision()](#eventsvehicleblockcollision) + * [events.vehicleEnter()](#eventsvehicleenter-1) + * [events.vehicleExit()](#eventsvehicleexit-1) + * [events.prepareItemEnchant()](#eventsprepareitemenchant) + * [events.enchantItem()](#eventsenchantitem) + * [events.pluginDisable()](#eventsplugindisable-1) + * [events.serverListPing()](#eventsserverlistping-1) + * [events.serviceRegister()](#eventsserviceregister) + * [events.serverCommand()](#eventsservercommand) + * [events.remoteServerCommand()](#eventsremoteservercommand) + * [events.pluginEnable()](#eventspluginenable-1) + * [events.serviceUnregister()](#eventsserviceunregister) + * [events.tabComplete()](#eventstabcomplete) + * [events.mapInitialize()](#eventsmapinitialize) * [console global variable](#console-global-variable) * [Example](#example) * [Using string substitutions](#using-string-substitutions) @@ -401,18 +414,20 @@ Walter Higgins * [Examples](#examples) * [Fireworks Module](#fireworks-module) * [Examples](#examples-1) - * [Inventory Module](#inventory-module) - * [Usage](#usage-2) * [Classroom Plugin](#classroom-plugin) * [jsp classroom command](#jsp-classroom-command) * [classroom.allowScripting() function](#classroomallowscripting-function) + * [Inventory Module](#inventory-module) + * [Usage](#usage-2) * [Asynchronous Input Module](#asynchronous-input-module) + * [Lightning module](#lightning-module) + * [Usage](#usage-3) * [The recipes module](#the-recipes-module) * [Example](#example-1) * [Http Module](#http-module) * [http.request() function](#httprequest-function) * [sc-mqtt module](#sc-mqtt-module) - * [Usage](#usage-3) + * [Usage](#usage-4) * [Signs Module](#signs-module) * [signs.menu() function](#signsmenu-function) * [signs.getTargetedBy() function](#signsgettargetedby-function) @@ -420,9 +435,12 @@ Walter Higgins * [The slash() function](#the-slash-function) * [Sounds Module](#sounds-module) * [Usage (Bukkit) :](#usage-bukkit-) - * [Teleport Module](#teleport-module) + * [Spawn Module](#spawn-module) * [Parameters](#parameters) * [Example](#example-2) + * [Teleport Module](#teleport-module) + * [Parameters](#parameters-1) + * [Example](#example-3) * [Utilities Module](#utilities-module) * [utils.player() function](#utilsplayer-function) * [utils.world( worldName ) function](#utilsworld-worldname--function) @@ -448,22 +466,22 @@ Walter Higgins * [watcher.unwatchFile() function](#watcherunwatchfile-function) * [watcher.unwatchDir() function](#watcherunwatchdir-function) * [Example Plugin #1 - A simple extension to Minecraft.](#example-plugin-1---a-simple-extension-to-minecraft) - * [Usage:](#usage-4) - * [Example Plugin #2 - Making extensions available for all players.](#example-plugin-2---making-extensions-available-for-all-players) * [Usage:](#usage-5) - * [Example Plugin #3 - Limiting use of commands to operators only.](#example-plugin-3---limiting-use-of-commands-to-operators-only) + * [Example Plugin #2 - Making extensions available for all players.](#example-plugin-2---making-extensions-available-for-all-players) * [Usage:](#usage-6) - * [Example Plugin #4 - Using parameters in commands.](#example-plugin-4---using-parameters-in-commands) + * [Example Plugin #3 - Limiting use of commands to operators only.](#example-plugin-3---limiting-use-of-commands-to-operators-only) * [Usage:](#usage-7) - * [Example Plugin #5 - Re-use - Using your own and others modules.](#example-plugin-5---re-use---using-your-own-and-others-modules) + * [Example Plugin #4 - Using parameters in commands.](#example-plugin-4---using-parameters-in-commands) * [Usage:](#usage-8) - * [Example Plugin #6 - Re-use - Using 'utils' to get Player objects.](#example-plugin-6---re-use---using-utils-to-get-player-objects) + * [Example Plugin #5 - Re-use - Using your own and others modules.](#example-plugin-5---re-use---using-your-own-and-others-modules) * [Usage:](#usage-9) + * [Example Plugin #6 - Re-use - Using 'utils' to get Player objects.](#example-plugin-6---re-use---using-utils-to-get-player-objects) + * [Usage:](#usage-10) * [Example Plugin #7 - Listening for events, Greet players when they join the game.](#example-plugin-7---listening-for-events-greet-players-when-they-join-the-game) * [Arrows Plugin](#arrows-plugin) - * [Usage:](#usage-10) + * [Usage:](#usage-11) * [Spawn Plugin](#spawn-plugin) - * [Usage](#usage-11) + * [Usage](#usage-12) * [alias Plugin](#alias-plugin) * [Examples](#examples-2) * [Commando Plugin](#commando-plugin) @@ -477,13 +495,17 @@ Walter Higgins * [Administration options](#administration-options) * [NumberGuess mini-game:](#numberguess-mini-game) * [Description](#description-1) - * [Example](#example-3) + * [Example](#example-4) * [Cow Clicker Mini-Game](#cow-clicker-mini-game) * [How to Play](#how-to-play) * [Rules](#rules) * [Gameplay Mechanics](#gameplay-mechanics) - * [Items module](#items-module) - * [Usage](#usage-12) + * [Items module (SpigotMC version)](#items-module-spigotmc-version) + * [Usage](#usage-13) + * [Items module (CanaryMod version)](#items-module-canarymod-version) + * [Usage](#usage-14) + * [Entities module](#entities-module) + * [Usage](#usage-15) ## Modules in Scriptcraft @@ -849,11 +871,18 @@ The refresh() function can be used to only reload the ScriptCraft plugin (it's l 1. Disable the ScriptCraft plugin. 2. Unload all event listeners associated with the ScriptCraft plugin. +3. Cancel all timed tasks (created by `setInterval` & `setTimeout`) 3. Enable the ScriptCraft plugin. ... refresh() can be used during development to reload only scriptcraft javascript files. See [issue #69][issue69] for more information. +By default, if `self` is defined at runtime, it checks, whether `self` is server operator, otherwise fails with message. This behavivor can be modified using `skipOpCheck` parameter (useful, if you are doing some custom premission checks before calling this function). + +#### Parameters + + * skipOpCheck (boolean - optional) : If true, the function won't check if `self` is server operator. + [issue69]: https://github.com/walterhiggins/ScriptCraft/issues/69 ### addUnloadHandler() function @@ -1051,7 +1080,7 @@ myBlockBreakListener.unregister(); [cmEvtApi]: https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/Hook.html [cmPriority]: https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/plugin/Priority.html -## Events Helper Module (canary version) +## Events Helper Module (CanaryMod version) The Events helper module provides a suite of functions - one for each possible event. For example, the events.blockDestroy() function is just a wrapper function which calls events.on(net.canarymod.hook.player.BlockDestroyHook, callback, priority) This module is a convenience wrapper for easily adding new event handling functions in Javascript. @@ -1990,1366 +2019,1470 @@ The crucial difference is that the events module now has functions for each of t #### Parameters - * callback - A function which is called whenever the [system.PluginEnableHook event](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/system/PluginEnableHook.html) is fired + * callback - A function which is called whenever the [system.PluginEnableHook event](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/system/PluginEnableHook.html) is fired + + * priority - optional - see events.on() for more information. + +### events.serverTick() + +#### Parameters + + * callback - A function which is called whenever the [system.ServerTickHook event](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/system/ServerTickHook.html) is fired + + * priority - optional - see events.on() for more information. + +### events.serverListPing() + +#### Parameters + + * callback - A function which is called whenever the [system.ServerListPingHook event](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/system/ServerListPingHook.html) is fired + + * priority - optional - see events.on() for more information. + +### events.serverShutdown() + +#### Parameters + + * callback - A function which is called whenever the [system.ServerShutdownHook event](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/system/ServerShutdownHook.html) is fired + + * priority - optional - see events.on() for more information. + +## Events Helper Module (SpigotMC version) +The Events helper module provides a suite of functions - one for each possible event. +For example, the events.blockBreak() function is just a wrapper function which calls events.on(org.bukkit.event.block.BlockBreakEvent, callback, priority) +This module is a convenience wrapper for easily adding new event handling functions in Javascript. +At the in-game or server-console prompt, players/admins can type `events.` and use TAB completion +to choose from any of the approx. 160 different event types to listen to. + +### Usage + + events.blockBreak( function( event ) { + echo( event.player, 'You broke a block!'); + }); + +The crucial difference is that the events module now has functions for each of the built-in events. The functions are accessible via TAB-completion so will help beginning programmers to explore the events at the server console window. + +### 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 + + * priority - optional - see events.on() for more information. + +### 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 + + * priority - optional - see events.on() for more information. + +### 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 + + * priority - optional - see events.on() for more information. + +### 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 + + * priority - optional - see events.on() for more information. + +### 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 + + * priority - optional - see events.on() for more information. + +### 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 + + * priority - optional - see events.on() for more information. + +### 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 + + * priority - optional - see events.on() for more information. + +### 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 + + * priority - optional - see events.on() for more information. + +### 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 * priority - optional - see events.on() for more information. -### events.serverTick() +### events.blockBurn() #### Parameters - * callback - A function which is called whenever the [system.ServerTickHook event](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/system/ServerTickHook.html) is fired + * 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 * priority - optional - see events.on() for more information. -### events.serverListPing() +### events.blockDamage() #### Parameters - * callback - A function which is called whenever the [system.ServerListPingHook event](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/system/ServerListPingHook.html) is fired + * 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 * priority - optional - see events.on() for more information. -### events.serverShutdown() +### events.leavesDecay() #### Parameters - * callback - A function which is called whenever the [system.ServerShutdownHook event](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/system/ServerShutdownHook.html) is fired + * 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 * priority - optional - see events.on() for more information. -## Events Helper Module (bukkit version) -The Events helper module provides a suite of functions - one for each possible event. -For example, the events.blockBreak() function is just a wrapper function which calls events.on(org.bukkit.event.block.BlockBreakEvent, callback, priority) -This module is a convenience wrapper for easily adding new event handling functions in Javascript. -At the in-game or server-console prompt, players/admins can type `events.` and use TAB completion -to choose from any of the approx. 160 different event types to listen to. +### events.blockDispense() -### Usage +#### Parameters - events.blockBreak( function( event ) { - echo( event.player, 'You broke a block!'); - }); + * 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 -The crucial difference is that the events module now has functions for each of the built-in events. The functions are accessible via TAB-completion so will help beginning programmers to explore the events at the server console window. + * priority - optional - see events.on() for more information. -### events.weatherChange() +### events.blockForm() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.lightningStrike() +### events.blockMultiPlace() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.thunderChange() +### events.blockIgnite() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.vehicleMove() +### events.blockPhysics() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.vehicleDestroy() +### events.blockRedstone() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.vehicleExit() +### events.cauldronLevelChange() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.vehicleEntityCollision() +### events.blockCanBuild() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.vehicleBlockCollision() +### events.signChange() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.vehicleEnter() +### events.blockExp() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.vehicleDamage() +### events.blockExplode() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.vehicleUpdate() +### events.blockBreak() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.vehicleCreate() +### events.prepareAnvil() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.paintingBreak() +### events.brew() #### Parameters - * callback - A function which is called whenever the [painting.PaintingBreakEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/painting/PaintingBreakEvent.html) is fired + * 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 * priority - optional - see events.on() for more information. -### events.paintingBreakByEntity() +### events.inventoryClose() #### Parameters - * callback - A function which is called whenever the [painting.PaintingBreakByEntityEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/painting/PaintingBreakByEntityEvent.html) is fired + * 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 * priority - optional - see events.on() for more information. -### events.paintingPlace() +### events.inventoryDrag() #### Parameters - * callback - A function which is called whenever the [painting.PaintingPlaceEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/painting/PaintingPlaceEvent.html) is fired + * 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 * priority - optional - see events.on() for more information. -### events.enchantItem() +### events.inventoryCreative() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.prepareItemEnchant() +### events.prepareItemCraft() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerInteractEntity() +### events.craftItem() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerEggThrow() +### events.inventoryClick() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerUnleashEntity() +### events.brewingStandFuel() #### 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 + * callback - A function which is called whenever the [inventory.BrewingStandFuelEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/BrewingStandFuelEvent.html) is fired * priority - optional - see events.on() for more information. -### events.playerInventory() +### events.inventoryPickupItem() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerLevelChange() +### events.furnaceExtract() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerPortal() +### events.inventory() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerItemConsume() +### events.furnaceBurn() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerTeleport() +### events.furnaceSmelt() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerBedEnter() +### events.inventoryOpen() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerUnregisterChannel() +### events.inventoryMoveItem() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerArmorStandManipulate() +### events.hangingPlace() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerChat() +### events.hangingBreak() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerShearEntity() +### events.hangingBreakByEntity() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerItemDamage() +### events.entityToggleGlide() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.asyncPlayerChat() +### events.itemSpawn() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerDropItem() +### events.spawnerSpawn() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerRegisterChannel() +### events.foodLevelChange() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerMove() +### events.lingeringPotionSplash() #### 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 + * callback - A function which is called whenever the [entity.LingeringPotionSplashEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/LingeringPotionSplashEvent.html) is fired * priority - optional - see events.on() for more information. -### events.playerItemBreak() +### events.entityShootBow() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerBucketEmpty() +### events.entityTargetLivingEntity() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerStatisticIncrement() +### events.entityCombust() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerToggleFlight() +### events.entityBreed() #### 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 + * callback - A function which is called whenever the [entity.EntityBreedEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityBreedEvent.html) is fired * priority - optional - see events.on() for more information. -### events.playerItemHeld() +### events.expBottle() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerAchievementAwarded() +### events.slimeSplit() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerToggleSneak() +### events.entityDeath() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerExpChange() +### events.entityAirChange() #### 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 + * callback - A function which is called whenever the [entity.EntityAirChangeEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityAirChangeEvent.html) is fired * priority - optional - see events.on() for more information. -### events.playerResourcePackStatus() +### events.projectileLaunch() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerPreLogin() +### events.entityPortal() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerJoin() +### events.horseJump() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerAnimation() +### events.fireworkExplode() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerEditBook() +### events.entityExplode() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerPickupItem() +### events.itemMerge() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerInteractAtEntity() +### events.entitySpawn() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerChangedWorld() +### events.projectileHit() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerFish() +### events.creatureSpawn() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerChatTabComplete() +### events.entityPortalExit() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerRespawn() +### events.entityTame() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerBedLeave() +### events.entityPortalEnter() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.asyncPlayerPreLogin() +### events.playerLeashEntity() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerInteract() +### events.entityDamage() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerBucketFill() +### events.pigZap() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerVelocity() +### events.entityCombustByEntity() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerQuit() +### events.entityChangeBlock() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerLogin() +### events.areaEffectCloudApply() #### 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 + * callback - A function which is called whenever the [entity.AreaEffectCloudApplyEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/AreaEffectCloudApplyEvent.html) is fired * priority - optional - see events.on() for more information. -### events.playerKick() +### events.creeperPower() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerToggleSprint() +### events.sheepDyeWool() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerCommandPreprocess() +### events.playerDeath() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerGameModeChange() +### events.villagerReplenishTrade() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.furnaceSmelt() +### events.entityCombustByBlock() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.inventoryDrag() +### events.entityResurrect() #### 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 + * callback - A function which is called whenever the [entity.EntityResurrectEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityResurrectEvent.html) is fired * priority - optional - see events.on() for more information. -### events.craftItem() +### events.villagerAcquireTrade() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.furnaceBurn() +### events.enderDragonChangePhase() #### 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 + * callback - A function which is called whenever the [entity.EnderDragonChangePhaseEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EnderDragonChangePhaseEvent.html) is fired * priority - optional - see events.on() for more information. -### events.inventoryOpen() +### events.entityCreatePortal() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.inventoryPickupItem() +### events.sheepRegrowWool() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.inventoryMoveItem() +### events.entityRegainHealth() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.inventoryClick() +### events.entityInteract() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.inventoryClose() +### events.potionSplash() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.inventoryCreative() +### events.entityTarget() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.inventory() +### events.entityBreakDoor() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.prepareItemCraft() +### events.entityUnleash() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.furnaceExtract() +### events.entityDamageByBlock() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.brew() +### events.entityTeleport() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.serverCommand() +### events.itemDespawn() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.serverListPing() +### events.explosionPrime() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.serviceRegister() +### events.entityDamageByEntity() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.pluginDisable() +### events.portalCreate() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.remoteServerCommand() +### events.worldSave() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.mapInitialize() +### events.worldLoad() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.serviceUnregister() +### events.chunkLoad() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.pluginEnable() +### events.chunkPopulate() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerDeath() +### events.chunkUnload() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.entityCreatePortal() +### events.structureGrow() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.entityCombust() +### events.worldInit() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.sheepDyeWool() +### events.spawnChange() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.expBottle() +### events.worldUnload() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.entityTame() +### events.playerShearEntity() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.projectileLaunch() +### events.playerVelocity() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.entityDamage() +### events.playerBucketFill() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.itemSpawn() +### events.playerFish() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.projectileHit() +### events.playerGameModeChange() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.foodLevelChange() +### events.playerCommandPreprocess() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.itemDespawn() +### events.playerInteract() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.entityPortalEnter() +### events.playerInteractAtEntity() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.entityPortal() +### events.playerPortal() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.entityTarget() +### events.playerPreLogin() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.entityDeath() +### events.playerMove() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.entitySpawn() +### events.playerQuit() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.sheepRegrowWool() +### events.playerToggleSneak() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.entityShootBow() +### events.playerPickupArrow() #### 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 + * callback - A function which is called whenever the [player.PlayerPickupArrowEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerPickupArrowEvent.html) is fired * priority - optional - see events.on() for more information. -### events.creeperPower() +### events.playerBedLeave() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.entityCombustByBlock() +### events.playerChangedMainHand() #### 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 + * callback - A function which is called whenever the [player.PlayerChangedMainHandEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerChangedMainHandEvent.html) is fired * priority - optional - see events.on() for more information. -### events.entityBreakDoor() +### events.playerEditBook() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.entityDamageByEntity() +### events.playerAnimation() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.entityUnleash() +### events.playerResourcePackStatus() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.entityExplode() +### events.playerItemDamage() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.entityInteract() +### events.playerBucketEmpty() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.explosionPrime() +### events.playerExpChange() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.horseJump() +### events.asyncPlayerChat() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.creatureSpawn() +### events.playerItemBreak() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.entityCombustByEntity() +### events.playerUnleashEntity() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.entityDamageByBlock() +### events.playerRespawn() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.entityTargetLivingEntity() +### events.playerDropItem() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.entityTeleport() +### events.playerItemHeld() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.playerLeashEntity() +### events.playerTeleport() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.spawnerSpawn() +### events.playerInteractEntity() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.itemMerge() +### events.playerEggThrow() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.slimeSplit() +### events.playerChat() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.pigZap() +### events.playerRegisterChannel() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.potionSplash() +### events.playerSwapHandItems() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.entityChangeBlock() +### events.playerChangedWorld() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.entityPortalExit() +### events.playerLevelChange() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.entityRegainHealth() +### events.playerPickupItem() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.entityBlockForm() +### events.asyncPlayerPreLogin() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.blockSpread() +### events.playerUnregisterChannel() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.blockMultiPlace() +### events.playerStatisticIncrement() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.blockExplode() +### events.playerBedEnter() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.notePlay() +### events.playerKick() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.blockFade() +### events.playerToggleSprint() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.blockPlace() +### events.playerAchievementAwarded() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.blockPhysics() +### events.playerJoin() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.blockIgnite() +### events.playerToggleFlight() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.blockBreak() +### events.playerArmorStandManipulate() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.blockBurn() +### events.playerLogin() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.blockFromTo() +### events.playerItemConsume() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.blockRedstone() +### events.playerChatTabComplete() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.blockPistonRetract() +### events.weatherChange() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.blockDispense() +### events.thunderChange() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.signChange() +### events.lightningStrike() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.blockPistonExtend() +### events.vehicleMove() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.blockCanBuild() +### events.vehicleDamage() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.blockGrow() +### events.vehicleDestroy() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.leavesDecay() +### events.vehicleUpdate() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.blockExp() +### events.vehicleCreate() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.blockForm() +### events.vehicleEntityCollision() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.blockDamage() +### events.vehicleBlockCollision() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.hangingPlace() +### events.vehicleEnter() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.hangingBreakByEntity() +### events.vehicleExit() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.hangingBreak() +### events.prepareItemEnchant() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.structureGrow() +### events.enchantItem() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.spawnChange() +### events.pluginDisable() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.worldLoad() +### events.serverListPing() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.worldInit() +### events.serviceRegister() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.worldUnload() +### events.serverCommand() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.worldSave() +### events.remoteServerCommand() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.chunkUnload() +### events.pluginEnable() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.chunkPopulate() +### events.serviceUnregister() #### 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 + * 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 * priority - optional - see events.on() for more information. -### events.portalCreate() +### events.tabComplete() #### 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 + * callback - A function which is called whenever the [server.TabCompleteEvent event](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/server/TabCompleteEvent.html) is fired * priority - optional - see events.on() for more information. -### events.chunkLoad() +### events.mapInitialize() #### 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 + * 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 * priority - optional - see events.on() for more information. @@ -3589,7 +3722,7 @@ Alternatively if you provide just a function as a parameter, then the function n // submitted by [edonaldson][edonaldson] var Drone = require('drone'); - Drone.extend('pyramid', function( block,height) { + Drone.extend('pyramid', function( block, height ) { this.chkpt('pyramid'); for ( var i = height; i > 0; i -= 2) { this.box(block, i, 1, i).up().right().fwd(); @@ -3600,7 +3733,7 @@ Alternatively if you provide just a function as a parameter, then the function n #### Example 2 Using just a named function as a parameter var Drone = require('drone'); - function pyramid( block,height) { + function pyramid( block, height ) { this.chkpt('pyramid'); for ( var i = height; i > 0; i -= 2) { this.box(block, i, 1, i).up().right().fwd(); @@ -3658,6 +3791,22 @@ If you want to place a torch so it faces _away_ from the drone: drone.box( blocks.torch + ':' + Drone.PLAYER_TORCH_FACING[(drone.dir + 2) % 4]); +#### Drone.MAX_SIDE + +Specifies the maximum length (in any dimension) when calling the Drone.cuboidX (box) method. +The default value is 1,000 blocks. + +If you see an error message in the console `Build too big!` It's because the width, height or length paramete was greater than the Drone.MAX_SIDE value. + +#### Drone.MAX_VOLUME + +Specifies the maximum value for any call to Drone.cuboidX (box) method. +The default value is 1,000,000 (1 million) blocks. + +If the volume (width X height X length) of any single call to the Drone.cuboidX() method exceeds this value, you will see an error message in the console `Build too big!` . + +The values of both the `Drone.MAX_SiDE` and `Drone.MAX_VOLUME` variables _can_ be overridden but it's not recommended. + ### Drone.times() Method The `times()` method makes building multiple copies of buildings @@ -4665,42 +4814,6 @@ location. For example... ![firework example](img/firework.png) -## 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. See below for examples of usage. - -```javascript -var inventory = require('inventory'); -var items = require('items'); -var utils = require('utils'); - -// gives every player a cookie and a baked potatoe -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: - -* add : Adds items to the inventory (Expects parameters of type `net.canarymod.api.inventory.Item` - I strongly recommend using the `items` module for constructing items) -* remove : removes items from the inventory (Expects parameters of type `net.canarymod.api.inventory.Item` - I strongly recommend using the `items` module for constructing items) -* contains : checks to see if there is the specified type and amount of item in the inventory (Expects parameters of type `net.canarymod.api.inventory.Item` - I strongly recommend using the `items` module for constructing items) - ## Classroom Plugin The `classroom` object contains a couple of utility functions for use @@ -4798,6 +4911,42 @@ To disallow scripting (and prevent players who join the server from using the co Only ops users can run the classroom.allowScripting() function - this is so that students don't try to bar themselves and each other from scripting. +## 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. See below for examples of usage. + +```javascript +var inventory = require('inventory'); +var items = require('items'); +var utils = require('utils'); + +// gives every player a cookie and a baked potatoe +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: + +* add : Adds items to the inventory (Expects parameters of type `net.canarymod.api.inventory.Item` - I strongly recommend using the `items` module for constructing items) +* remove : removes items from the inventory (Expects parameters of type `net.canarymod.api.inventory.Item` - I strongly recommend using the `items` module for constructing items) +* contains : checks to see if there is the specified type and amount of item in the inventory (Expects parameters of type `net.canarymod.api.inventory.Item` - I strongly recommend using the `items` module for constructing items) + ## Asynchronous Input Module The `input` module provides a simple way to prompt players for input at the @@ -4854,6 +5003,23 @@ The callback function as well as being bound to an object with the above propert The `value` parameter will be the same as `this.value`, the `repeat` parameter will be the same as `this.repeat` and so on. +## Lightning module + +Causes a bolt of lightning to strike. + +### Usage +```javascript +// strike lightning wherever a player's arrow lands +var lightning = require('lightning'); +events.projectileHit( function( event ){ + if ( entities.arrow( event.projectile ) // it's an arrow + && entities.player( event.projectile.owner ) // it was shot by a player + ) { + lightning( event.projectile ); // strike lightning at the arrow location + } +}); +``` + ## The recipes module The Recipes module provides convenience functions for adding and removing recipes @@ -4912,7 +5078,7 @@ The following example illustrates how to use http.request to make a request to a ```javascript var jsResponse; -var http = require('request'); +var http = require('http'); http.request('http://scriptcraftjs.org/sample.json',function(responseCode, responseBody){ jsResponse = JSON.parse( responseBody ); }); @@ -5093,7 +5259,7 @@ This function makes it easy to execute one or more minecraft commands. #### Parameters * commands : A String or Array of strings - each string is a command to be executed. - * sender: The player or server on whose behalf the commands should be executed. + * sender: (optional) The player on whose behalf the commands should be executed. If not specified the commands will be executed as the server console user. #### Examples @@ -5101,17 +5267,20 @@ Invoke the `/defaultgamemode creative` command (as server). ```javascript var slash = require('slash'); -slash('defaultgamemode creative', server); +slash('defaultgamemode creative'); ``` -Set the time of day to Midday and toggle downfall: +Set the time of day to Midday and toggle downfall (as player 'JohnDoe'): ```javascript -var slash = require('slash'); +var slash = require('slash'), + utils = require('utils'); +var johnDoe = utils.player('John_Doe'); + slash([ 'time set 6000', 'toggledownfall' -], server); +], johnDoe); ``` ## Sounds Module @@ -5139,6 +5308,31 @@ In addition, a play function is provided for each possible sound using the follo sounds.villagerNo(); // plays VILLAGER_NO sound for all players online. These methods are provided for convenience to help beginners explore sounds using TAB completion. +## Spawn Module + +Provides a single function to 'spawn' an entity at a given location. + +### Parameters + + * entityType - The type of entity to spawn. This can be a string (see entities module for reference) or a framework-specific object type (see https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/EntityType.html). A list of [all possible entities][ents] functions (equivalent to the EntityType enum). + + * location - where the entity should be spawned. + +[ents]: #entities-module + +### Example + +Using the entities module as a helper, spawn a new polar bear at the world's default spawn location: + +```javascript +var entities = require('entities'), + spawn = require('spawn'); +... +var spawnLocation = world.spawnLocation; +spawn(entities.polar_bear(), spawnLocation); +``` + +This module is in turn used by the Drone's `spawn()` method and the `jsp spawn` command. String class extensions ----------------------- The following chat-formatting methods are added to the javascript String class.. @@ -5903,8 +6097,8 @@ Allows in-game operators to easily spawn creatures at current location. This command supports TAB completion so to see a list of possible entitities, type `/jsp spawn ' at the in-game command prompt, then press TAB. Visit - (CanaryMod) -or (Bukkit) + (Bukkit/SpigotMC) +or (CanaryMod) for a list of possible entities (creatures) which can be spawned. @@ -6146,10 +6340,468 @@ your own mini-game... mini-game, joins the server - should they automatically resume the mini-game? -[bukscore]: http://jd.bukkit.org/beta/apidocs/org/bukkit/scoreboard/package-summary.html +[bukscore]: http://jd.bukkit.org/beta/apidocs/org/bukkit/scoreboard/package-summary.html + + +## Items module (SpigotMC version) +The Items module provides a suite of functions - one for each possible item. +See https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html for a list of possible items + +### Usage + + items.book(); // returns org.bukkit.Material.BOOK + items.book(2); // returns a new org.bukkit.Material object with an amount 2 (2 books) + items.book( itemType ); // compares itemType parameter to org.bukkit.Material.BOOK or an Item of type book + +The following functions are provided: + + * 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() + * blackShulkerBox() + * blazePowder() + * blazeRod() + * blueShulkerBox() + * boat() + * boatAcacia() + * boatBirch() + * boatDarkOak() + * boatJungle() + * boatSpruce() + * bone() + * boneBlock() + * book() + * bookAndQuill() + * bookshelf() + * bow() + * bowl() + * bread() + * brewingStand() + * brewingStandItem() + * brick() + * brickStairs() + * brownMushroom() + * brownShulkerBox() + * 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() + * cyanShulkerBox() + * 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() + * grayShulkerBox() + * greenRecord() + * greenShulkerBox() + * grilledPork() + * hardClay() + * hayBlock() + * hopper() + * hopperMinecart() + * hugeMushroom1() + * hugeMushroom2() + * ice() + * inkSack() + * ironAxe() + * ironBarding() + * ironBlock() + * ironBoots() + * ironChestplate() + * ironDoor() + * ironDoorBlock() + * ironFence() + * ironHelmet() + * ironHoe() + * ironIngot() + * ironLeggings() + * ironNugget() + * 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() + * lightBlueShulkerBox() + * limeShulkerBox() + * lingeringPotion() + * log() + * log2() + * longGrass() + * magentaShulkerBox() + * 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() + * observer() + * obsidian() + * orangeShulkerBox() + * packedIce() + * painting() + * paper() + * pinkShulkerBox() + * pistonBase() + * pistonExtension() + * pistonMovingPiece() + * pistonStickyBase() + * poisonousPotato() + * pork() + * portal() + * potato() + * potatoItem() + * potion() + * poweredMinecart() + * poweredRail() + * prismarine() + * prismarineCrystals() + * prismarineShard() + * pumpkin() + * pumpkinPie() + * pumpkinSeeds() + * pumpkinStem() + * purpleShulkerBox() + * 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() + * redShulkerBox() + * redstone() + * redstoneBlock() + * redstoneComparator() + * redstoneComparatorOff() + * redstoneComparatorOn() + * redstoneLampOff() + * redstoneLampOn() + * redstoneOre() + * redstoneTorchOff() + * redstoneTorchOn() + * redstoneWire() + * rottenFlesh() + * saddle() + * sand() + * sandstone() + * sandstoneStairs() + * sapling() + * seaLantern() + * seeds() + * shears() + * shield() + * shulkerShell() + * sign() + * signPost() + * silverShulkerBox() + * 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() + * totem() + * trapDoor() + * trappedChest() + * tripwire() + * tripwireHook() + * vine() + * wallBanner() + * wallSign() + * watch() + * water() + * waterBucket() + * waterLily() + * web() + * wheat() + * whiteShulkerBox() + * wood() + * woodAxe() + * woodButton() + * woodDoor() + * woodDoubleStep() + * woodHoe() + * woodPickaxe() + * woodPlate() + * woodSpade() + * woodStairs() + * woodStep() + * woodSword() + * woodenDoor() + * wool() + * workbench() + * writtenBook() + * yellowFlower() + * yellowShulkerBox() + -/********************* -## Items module +## Items module (CanaryMod version) The Items module provides a suite of functions - one for each possible item. See https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/api/inventory/ItemType.html for a list of possible items @@ -6694,4 +7346,113 @@ The following functions are provided: * yellowStainedClay() * zombieHead() -***/ + +## Entities module +The Entities module provides a suite of functions - one for each possible entity type. +It acts as a helper or enumerated module to assist in use with the `spawn` module and command. +This module is useful for TAB-completion at the in-game prompt. + +When each function is called with no parameters, it will return the appropriate EntityType object. +For example `entities.polar_bear()` will return an `EntityType.POLAR_BEAR` object. + +When each function is called with a single parameter - an entity - the entity's type will be compared and return true or false. + +### Usage + + entities.zombie(); // returns a SpigotMC/CanaryMod EntityType.ZOMBIE enum value + entities.zombie( mob ); // compares the entity's type to a zombie, returns true if mob type is zombie, false otherwise + entities.player( self ); // at the in-game prompt this should return true (compares self to a player entity type) + entities.rabbit( self ); // at the in-game prompt this should return false (compares self to a rabbit entity type) + +The following functions are provided: + + * area_effect_cloud() + * armor_stand() + * arrow() + * bat() + * blaze() + * boat() + * cave_spider() + * chicken() + * complex_part() + * cow() + * creeper() + * donkey() + * dragon_fireball() + * dropped_item() + * egg() + * elder_guardian() + * ender_crystal() + * ender_dragon() + * ender_pearl() + * ender_signal() + * enderman() + * endermite() + * evoker() + * evoker_fangs() + * experience_orb() + * falling_block() + * fireball() + * firework() + * fishing_hook() + * ghast() + * giant() + * guardian() + * horse() + * husk() + * iron_golem() + * item_frame() + * leash_hitch() + * lightning() + * lingering_potion() + * llama() + * llama_spit() + * magma_cube() + * minecart() + * minecart_chest() + * minecart_command() + * minecart_furnace() + * minecart_hopper() + * minecart_mob_spawner() + * minecart_tnt() + * mule() + * mushroom_cow() + * ocelot() + * painting() + * pig() + * pig_zombie() + * player() + * polar_bear() + * primed_tnt() + * rabbit() + * sheep() + * shulker() + * shulker_bullet() + * silverfish() + * skeleton() + * skeleton_horse() + * slime() + * small_fireball() + * snowball() + * snowman() + * spectral_arrow() + * spider() + * splash_potion() + * squid() + * stray() + * thrown_exp_bottle() + * tipped_arrow() + * unknown() + * vex() + * villager() + * vindicator() + * weather() + * witch() + * wither() + * wither_skeleton() + * wither_skull() + * wolf() + * zombie() + * zombie_horse() + * zombie_villager() + diff --git a/docs/YoungPersonsGuideToProgrammingMinecraft.md b/docs/YoungPersonsGuideToProgrammingMinecraft.md index 14af537ea..a41d9738e 100644 --- a/docs/YoungPersonsGuideToProgrammingMinecraft.md +++ b/docs/YoungPersonsGuideToProgrammingMinecraft.md @@ -7,8 +7,8 @@ If you would like to make changes, change file src/docs/templates/ypgpm.md inste # The Young Person's Guide to Programming in Minecraft ## Table of Contents * [Introduction](#introduction) - * [Installation](#installation) - * [CanaryMod and Permissions](#canarymod-and-permissions) + * [Installing and Running SpigotMC](#installing-and-running-spigotmc) + * [Installing ScriptCraft](#installing-scriptcraft) * [Configuring your Server (optional)](#configuring-your-server-optional) * [Learning Javascript](#learning-javascript) * [First Steps](#first-steps) @@ -43,7 +43,6 @@ If you would like to make changes, change file src/docs/templates/ypgpm.md inste * [Keeping Score - Lookup tables in Javascript](#keeping-score---lookup-tables-in-javascript) * [Counting block break events for each player](#counting-block-break-events-for-each-player) * [Next Steps](#next-steps) - ## Introduction Minecraft is an open-ended 3D game where you can build and craft @@ -63,78 +62,39 @@ players connect to a Minecraft Server on the internet or locally ![Cottages created using ScriptCraft in MineCraft][img_cr] -## Installation - -CanaryMod is a version of the Minecraft server software which allows -easy addition of 'Mods' and extensions to Minecraft. ScriptCraft is a -'Mod' for use with CanaryMod. Adding Mods to Minecraft can be -difficult but CanaryMod makes it easy. Follow these steps to -Install ScriptCraft on your computer... - -1. [Download and install CanaryMod][dlcm] then follow the [CanaryMod - Installation Instructions][cmadmin]. - -2. Start the CanaryMod server, then once it has started up, stop it - by typing 'stop'. If you go to the CanaryMod folder (see step 1) you - should see some new files and subfolders. - -3. [Download the latest version of the ScriptCraft Mod][sc-plugin]. Then copy the ScriptCraft.jar file to the - `plugins` folder (This folder won't be created until you run CanaryMod for the first time (see previous step). - -4. Start up the CanaryMod server again (see [instructions for starting the server][cmadmin]). - -5. In the CanaryMod command window type `op {your_username}` and hit - enter, replacing {your_username} with your own minecraft - username. This will give you `operator` access meaning you can perform - more commands than are normally available in Minecraft. You should - make yourself a server operator (Server operators have full privileges - for the server) permanently by editing the ops.txt file - and adding your username (one username per line). - -6. In the CanaryMod command window type `js 1 + 1` and hit enter. You should see `> 2` . - -... Congratulations! You just installed your own Minecraft Server with -the ScriptCraft Mod and are now ready to begin programming in Minecraft. +# Installation -Normally, Minecraft Mods are written in Java. This makes writing your -own extension or game rules difficult because you must first learn Java. -Java is different enough from Javascript. With the ScriptCraft plug-in -installed, you don't have to learn Java, you can extend and customize -Minecraft your way using Javascript. Javascript is easier to learn than -Java but it's also more flexible and powerful and is used for creating -interactive web sites and many other applications. +Before installing ScriptCraft you must first install SpigotMC which is +a special version of Minecraft Server that makes it easy to customize +the game. -## CanaryMod and Permissions -CanaryMod works slightly differently to CraftBukkit in how it handles -permissions and groups. By default, there are 4 groups: visitors, -players, mods and admins. Each player who joins the game is added to the -'visitors' group. This group has no permissions by default so -visitors can't break or place blocks. If you would like to change this -behaviour then issue the following command at the console window: +## Installing and Running SpigotMC - groupmod permission add visitors canary.world.build +Follow these steps to download and install SpigotMC. -If you would like all admins to have scripting ability then issue the -following command: +1. Download Spigot's [BuildTools.jar][spigotdl] +2. Save the BuildTools.jar file to a new directory called spigotmc. +3. Open a terminal (Mac and Linux) or command prompt (windows) window and type `java -jar BuildTools.jar`. This will kick off a long series of commands to "build" SpigotMC. +4. When the build is done, there will be a new file beginning with `spigot` and ending in `.jar` in the spigotmc directory. Run this file by typing `java -jar spigot-1.10.2.jar` (it might not be that exact name - you can list files in the directory by typing `dir` (Windows) or `ls` (Mac and Linux). +5. The server will start up then shut down very shortly afterwards. You'll need to edit a file called `eula.txt` - change `eula=false` to `eula=true` and save the file. +6. Run the `java -jar spigot-1.10.2.jar` command again - this time the server will start up. Shut it down by typing `stop` at the server prompt. - groupmod permission add admins scriptcraft.evaluate +## Installing ScriptCraft -This will enable all admins on your server to issue javascript statements. -All operators can issue any command (including the `/js` command to evaluate javascript). -For more information on CanaryMod's Permissions and Groups see the following: +Follow these steps to download and install ScriptCraft. - * [Permissions and Groups][cmPerms] - * [List of Permissions][cmPermsList] +1. Download the [scriptcraft.jar][dl] plugin and save it to the `plugins` directory and restart the server by typing `java -jar spigot-1.10.2.jar`. +2. At the server prompt type `js 1 + 1` and hit enter. The result `2` should be displayed. -[cmPerms]: http://canarymod.net/books/canarymod-admin-guide/permissions-and-groups -[cmPermsList]: http://canarymod.net/books/canarymod-admin-guide/list-permissions +Congratulations - you've just installed your Custom Minecraft Server and are ready to begin writing your first mod! ## Configuring your Server (optional) -Once you've installed CanaryMod, depending on your specific needs, -you might want to consider setting the following properties in the `server.cfg` or `config/worlds//.cfg` files ... +Once you've installed SpigotMC, depending on your specific needs, +you might want to consider setting the following properties in the `server.properties` file: # completely flat worlds are best for building from scratch + # bukkit/spigotmc level-type=FLAT generate-structures=false @@ -670,19 +630,17 @@ compare the ages of your friends or siblings to your own age. You can find out if you can Fly in minecraft by typing the following statement ... - /js self.getCapabilities().mayFly() + /js self.allowFlight ... the result will be `true` or `false` depending on whether you can fly or not. You can turn on and off your ability to fly by setting -your `mayFly` property to `true` or `false`. Try it ... +your `allowFlight` property to `true` or `false`. Try it ... - /js self.capabilities.flying = true - /js self.updateCapabilities() + /js self.allowFlight = true; ... Now you can fly! Double-press the space bar key to start flying. To turn off flight ... - /js self.capabilities.flying = false; - /js self.updateCapabilities() + /js self.allowFlight = false; ... and you come crashing down to earth. This is just one example of how `true` and `false` are used throughout ScriptCraft – these are @@ -691,55 +649,56 @@ Maths Professor at University College Cork. There are plenty more examples of boolean values in Minecraft. You can find out if it's raining in your minecraft world by typing the following statement ... - /js self.world.raining + /js self.world.hasStorm() ... The result of this statement will be either `false` (if it's not raining) or `true` (if it *is* raining). If it's raining, you can make it stop raining typing the following command: - /js self.world.raining = false + /js self.world.setStorm(false) ... Similarly, to make it start raining you can issue the following command: - /js self.world.raining = true + /js self.world.setStorm( true ) ### Booleans and JavaBeans There are many *boolean* properties you can use to turn on or off -certain game behaviours. For example, the *raining* behavior is turned -on or off using the World's `raining` property. The World object's -properties and methods are [documented on the CanaryMod JavaDocs World -page][cmworld]. When browsing the CanaryMod JavaDoc pages, whenever -you see a method whose name begins with `is` such as `isRaining()` and -a companion method `setRaining()`, these methods are called *JavaBean* -methods - the *raining* property is a *JavaBean* property and there +certain game behaviours. For example, the *thundering* behavior is turned +on or off using the World's `thundering` property. The World object's +properties and methods are [documented on the SpigotMC JavaDocs World +page][spworld]. When browsing the SpigotMC JavaDoc pages, whenever +you see a method whose name begins with `is` such as `isThundering()` and +a companion method `setThundering()`, these methods are called *JavaBean* +methods - the *thundering* property is a *JavaBean* property and there are two ways you can use JavaBean properties in Javascript. You can *get* and *set* the property using the methods provided by Java. To -*get* the raining property you can call the JavaBean Method: +*get* the thundering property you can call the JavaBean Method: - /js self.world.isRaining() + /js self.world.isThundering() ... or you can get the property like this: - /js self.world.raining + /js self.world.thundering -To *set* the raining property, you can call the JavaBean method: +To *set* the thundering property, you can call the JavaBean method: - /js self.world.setRaining( true ) + /js self.world.setThundering( true ) ... or you can set the property like this: - /js self.world.raining = true + /js self.world.thundering = true Whatever approach you use, the result will be the same. [cmworld]: https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/api/world/World.html +[spworld]: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/World.html ### SIDENOTE You may be wondering how to change other aspects of the Minecraft game - pretty much all aspects of the game can be changed. Changes are made using what are called `API` calls - these are calls to functions and methods in -Minecraft - you can read more about these on the [CanaryMod API -Reference][cmapi]. +Minecraft - you can read more about these on the [SpigotMC API +Reference][spigotapi]. ## ...and Again, and Again, and Again,... @@ -940,7 +899,10 @@ var utils = require('utils'); var players = utils.players(); var sounds = require('sounds'); utils.foreach( players, function( player ) { - sounds.catMeow( player ); + sounds.entityCatAmbient( player ); // spigot 1.9 + /* canarymod only + sounds.catMeow( player ); + */ } ); ``` @@ -1062,7 +1024,7 @@ This time no message should appear on your screen. The `if` statement tests to see if something is `true` or `false` and if `true` then the block of code between the curly braces ( `{` and `}` ) is executed - but only if the condition is true. The condition -in the above example is `!self.onGround` (self is not on ground) which +in the above example is `!self.onGround` (self is _not_ on ground) which will be `true` if you are currently flying or `false` if you aren't. What if you wanted to display a message only if a condition is *not* @@ -1118,29 +1080,29 @@ following code sends a message to any player who breaks a block in the game... ```javascript -function myBlockDestroyHook( event ){ +function myBlockBreakHook( event ){ var breaker = event.player; echo( breaker, 'You broke a block'); } -events.blockDestroy( myBlockDestroyHook ); +events.blockBreak( myBlockBreakHook ); ``` -The `events.blockDestroy()` function is just one of the many `events` functions which can be used to *register* a function to be called whenever a particular type of event occurs. In the -above code the blockDestroy function takes as a parameter a function +The `events.blockBreak()` function is just one of the many `events` functions which can be used to *register* a function to be called whenever a particular type of event occurs. In the +above code the blockBreak function takes as a parameter a function I want to be called when that event occurs. The function I want called in turn takes 1 parameter. The `event` object has all the information about the event which just occurred. I can tell who broke the block and send a message to the player. The important thing to note is that -the `myBlockDestroyHook` function defined above will not be called until a player breaks a +the `myBlockBreakHook` function defined above will not be called until a player breaks a block. Try it - save the above code in a new file in the `scriptcraft/plugins` directory then type `/js refresh()` to reload scriptcraft. Then break a block in the game and you should see the message 'You broke a block'. There are many types of events you can listen for in Minecraft. You can -browse [all possible event registration functions][cmevts2] in the API Reference. +browse [all possible event registration functions][spevts2] in the API Reference. -For custom events (events which aren't in the net.canarymod.hook tree) +For custom events (events which aren't in the org.bukkit.event tree) just specify the fully qualified class name instead. E.g. ... events.on ( net.yourdomain.events.YourEvent, function( event ) { @@ -1152,12 +1114,12 @@ just specify the fully qualified class name instead. E.g. ... If you want an event handler to only execute once, you can remove the handler like this... ```javascript -function myBlockDestroyHook( evt ) { +function myBlockBreakHook( evt ) { var breaker = evt.player; echo( breaker, 'You broke a block'); this.unregister(); } -events.blockDestroy( myBlockDestroyHook ); +events.blockBreak( myBlockBreakHook ); ``` The `this.unregister();` statement will remove this function from the @@ -1169,11 +1131,11 @@ to stop listening for events. To unregister a listener *outside* of the listener function... ```javascript -function myBlockDestroyHook( evt ){ +function myBlockBreakHook( evt ){ var breaker = evt.player; echo( breaker, 'You broke a block'); } -var myBlockBreakListener = events.blockDestroy( myBlockDestroyHook ); +var myBlockBreakListener = events.blockBreak( myBlockBreakHook ); ... myBlockBreakListener.unregister(); ``` @@ -1293,7 +1255,7 @@ var breaks = {}; function initializeBreakCount( event ){ breaks[event.player.name] = 0; } -events.connection( initializeBreakCount ); +events.playerJoin( initializeBreakCount ); /* every time a player breaks a block increase their block-break-count @@ -1303,7 +1265,7 @@ function incrementBreakCount( event ){ var breakCount = breaks[event.player.name]; echo( event.player, 'You broke ' + breakCount + ' blocks'); } -events.blockDestroy( incrementBreakCount ); +events.blockBreak( incrementBreakCount ); ``` With a little more work, you could turn this into a game where players @@ -1321,12 +1283,12 @@ minecraft, I recommend reading the accompanying [ScriptCraft API reference][api] which covers all of the ScriptCraft functions, objects and methods. I also recommend reading the source code to some of the existing scriptcraft plugins, followed by -[Anatomy of a ScriptCraft Plug-in][ap]. The online [CanaryMod API -Reference][cmapi] provides lots of valuable information about the +[Anatomy of a ScriptCraft Plug-in][ap]. The online [SpigotMC API +Reference][spigotapi] provides lots of valuable information about the different objects and methods available for use by ScriptCraft. -[cmadmin]: http://canarymod.net/books/canarymod-admin-guide +[cmadmin]: https://github.com/walterhiggins/canarymod-admin-guide/ [dlbuk2]: http://dl.bukkit.org/downloads/craftbukkit/ [dlcm]: http://canarymod.net/releases [bii]: http://wiki.bukkit.org/Setting_up_a_server @@ -1336,6 +1298,7 @@ different objects and methods available for use by ScriptCraft. [np]: http://notepad-plus-plus.org/ [cbapi]: http://jd.bukkit.org/beta/apidocs/ [cmapi]: https://ci.visualillusionsent.net/job/CanaryLib/javadoc/ +[spigotapi]: https://hub.spigotmc.org/javadocs/spigot/ [boole]: http://en.wikipedia.org/wiki/George_Boole [soundapi]: https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/api/world/effects/SoundEffect.Type.html [ap]: Anatomy-of-a-Plugin.md @@ -1344,6 +1307,7 @@ different objects and methods available for use by ScriptCraft. [bkevts]: http://jd.bukkit.org/dev/apidocs/org/bukkit/event/package-summary.html [cmevts]: https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/package-summary.html [cmevts2]: API-Reference.md#events-helper-module-canary-version +[spevts2]: API-Reference.md#events-helper-module-spigotmc-version [img_echo_date]: img/ypgpm_echo_date.png [img_3d_shapes]: img/ypgpm_3dshapes.jpg [img_whd]: img/ypgpm_whd.jpg diff --git a/lib/spigot-1.8.8.jar b/lib/spigot-1.11.2.jar similarity index 71% rename from lib/spigot-1.8.8.jar rename to lib/spigot-1.11.2.jar index 64362953a..6a055256d 100644 Binary files a/lib/spigot-1.8.8.jar and b/lib/spigot-1.11.2.jar differ diff --git a/license.txt b/license.txt index 3f3b29081..e0e06da85 100644 --- a/license.txt +++ b/license.txt @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2014 Walter Higgins +Copyright (c) 2016 Walter Higgins Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/release-notes.md b/release-notes.md index f36ea48dc..5d19238ed 100644 --- a/release-notes.md +++ b/release-notes.md @@ -1,6 +1,53 @@ RELEASE NOTES ============= +3.2.1 Release (2016 12 23) +-------------------------- + +Bug fixes and updated from Spigot 1.9 to Spigot 1.11.2 + +3.2.0 Release (2016 03 20) +-------------------------- + +Bug fixes and updated from Spigot 1.8.8 to Spigot 1.9 + +Fixed issues #256 and #287 + +3.1.12 Release (2015 12 30) +--------------------------- + +Added new modules + +* lightning + +The entities module and lightning module are now documented. + +To make lightning strikes when and where any arrow lands: + + var lightning = require('lightning'); + events.projectileHit( function( event ) { + if (entities.arrow( event.projectile ) + lightning( event.projectile ); + }); + +3.1.11 Release (2015 11 21) +--------------------------- + +Added new modules + +* entities +* spawn + +And new Drone function `spawn()` + +To use: +Point at a block then type... +``` +/js spawn('ZOMBIE').fwd().times(5).right().back(5).times(6) +``` + +... unleash a horde of zombies (in 5x6 grid formation). + 3.1.10 Release (2015 08 16) --------------------------- Bug fix: modules/bukkit/sounds.js now works (fixed for Bukkit/SpigotMC/Glowstone) diff --git a/src/docs/java/jscript.java b/src/docs/java/jscript.java index 89dadd5fe..53334a134 100644 --- a/src/docs/java/jscript.java +++ b/src/docs/java/jscript.java @@ -11,7 +11,7 @@ public static void main(String[] args) throws Exception java.io.File file = new java.io.File(args[0]); engine.put("engine",engine); engine.put("args",args); - engine.put("itemTypeClass",ItemType.class); + engine.put("cmItemTypeClass",ItemType.class); FileReader fr = new java.io.FileReader(file); engine.eval(fr); fr.close(); diff --git a/src/docs/js/generateEntitiesDoc.js b/src/docs/js/generateEntitiesDoc.js new file mode 100644 index 000000000..f24e368c2 --- /dev/null +++ b/src/docs/js/generateEntitiesDoc.js @@ -0,0 +1,46 @@ +args = Array.prototype.slice.call(args,1); +// [0] = type, [1] = lib.jar [2] = blockX, [3] = classX +var out = java.lang.System.out, + err = java.lang.System.err, + entry = null; +var content = [ + '', + '## Entities module', + 'The Entities module provides a suite of functions - one for each possible entity type. ', + 'It acts as a helper or enumerated module to assist in use with the `spawn` module and command. ', + 'This module is useful for TAB-completion at the in-game prompt. ', + '', + 'When each function is called with no parameters, it will return the appropriate EntityType object. ', + 'For example `entities.polar_bear()` will return an `EntityType.POLAR_BEAR` object. ', + '', + 'When each function is called with a single parameter - an entity - the entity\'s type will be compared and return true or false. ', + '', + '### Usage', + '', + ' entities.zombie(); // returns a SpigotMC/CanaryMod EntityType.ZOMBIE enum value', + ' entities.zombie( mob ); // compares the entity\'s type to a zombie, returns true if mob type is zombie, false otherwise', + ' entities.player( self ); // at the in-game prompt this should return true (compares self to a player entity type)', + ' entities.rabbit( self ); // at the in-game prompt this should return false (compares self to a rabbit entity type)', + '', + 'The following functions are provided:', + '' +]; + +var enumVals = [], t, i, name; +var entitytypes = org.bukkit.entity.EntityType.values(); +for (t in entitytypes) { + if (entitytypes[t] && entitytypes[t].ordinal) { + name = entitytypes[t].name(); + name = ('' + name).replace(/^(.*)/,function(a){ return a.toLowerCase(); }); + enumVals.push(' * ' + name + '()'); + } +} +enumVals.sort(); +content = content.concat(enumVals); +content.push(''); +for (i = 0; i< content.length; i++){ + out.println(content[i]); +} + + + diff --git a/src/docs/js/generateEventsHelper.js b/src/docs/js/generateEventsHelper.js index 5d5a2037a..d32fcb864 100644 --- a/src/docs/js/generateEventsHelper.js +++ b/src/docs/js/generateEventsHelper.js @@ -3,6 +3,7 @@ args = Array.prototype.slice.call(args,1); var File = java.io.File, FileReader = java.io.FileReader, FileInputStream = java.io.FileInputStream, + FRAMEWORK = args[0], out = java.lang.System.out, err = java.lang.System.err, Modifier = java.lang.reflect.Modifier, @@ -12,7 +13,7 @@ var File = java.io.File, entry = null; var content = [ '/*********************', - '## Events Helper Module (' + args[0] + ' version)', + '## Events Helper Module (' + FRAMEWORK + ' version)', 'The Events helper module provides a suite of functions - one for each possible event.', 'For example, the events.' + args[2] + '() function is just a wrapper function which calls events.on(' + args[3] + ', callback, priority)', 'This module is a convenience wrapper for easily adding new event handling functions in Javascript. ', @@ -30,7 +31,7 @@ var content = [ '***/' ]; var canary = false; -if (args[0] == 'canary'){ +if (FRAMEWORK == 'CanaryMod'){ canary = true; } @@ -89,10 +90,9 @@ while ( ( entry = zis.nextEntry) != null) { out.println(comment[i]); } out.println('exports.' + fname + ' = function(callback,priority){ '); - if (args[0] == 'canary'){ + if (canary){ out.println(' return events.on(Packages.' + name + ',callback,priority);'); - } - if (args[0] == 'bukkit'){ + } else { out.println(' return events.on(' + name + ',callback,priority);'); } out.println('};'); diff --git a/src/docs/js/generateItemsDoc.js b/src/docs/js/generateItemsDoc.js index 07610c52e..fe5715fe6 100644 --- a/src/docs/js/generateItemsDoc.js +++ b/src/docs/js/generateItemsDoc.js @@ -4,8 +4,40 @@ var out = java.lang.System.out, err = java.lang.System.err, entry = null; var content = [ - '/*********************', - '## Items module', + '', + '## Items module (SpigotMC version)', + 'The Items module provides a suite of functions - one for each possible item.', + 'See https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html for a list of possible items', + '', + '### Usage', + '', + ' items.book(); // returns org.bukkit.Material.BOOK', + ' items.book(2); // returns a new org.bukkit.Material object with an amount 2 (2 books)', + ' items.book( itemType ); // compares itemType parameter to org.bukkit.Material.BOOK or an Item of type book', + '', + 'The following functions are provided:', + '' +]; + +var enumVals = [], t, i, name; +var types = org.bukkit.Material.values(); +for (t in types) { + if (types[t] && types[t].ordinal) { + name = ('' + types[t].name()).toLowerCase(); + name = name.replace(/(_.)/g,function(a){ return a.replace(/_/,'').toUpperCase(); }); + enumVals.push(' * ' + name + '()'); + } +} +enumVals.sort(); +content = content.concat(enumVals); +content.push(''); +for (i = 0; i< content.length; i++){ + out.println(content[i]); +} + +content = [ + '', + '## Items module (CanaryMod version)', 'The Items module provides a suite of functions - one for each possible item.', 'See https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/api/inventory/ItemType.html for a list of possible items', '', @@ -20,22 +52,23 @@ var content = [ ]; //var ItemType = java.lang.Class.forName('net.canarymod.api.inventory.ItemType'); -var materials = itemTypeClass.getDeclaredFields(); +var materials = cmItemTypeClass.getDeclaredFields(); -var enumVals = []; -for (var i = 0;i < materials.length; i++ ){ +enumVals = []; +for ( i = 0;i < materials.length; i++ ){ - if (materials[i].type != itemTypeClass) { + if (materials[i].type != cmItemTypeClass) { continue; } var materialField = materials[i]; - var name = (''+materialField.name).replace(/^(.)/,function(a){ return a.toLowerCase() }); + name = (''+materialField.name).replace(/^(.)/,function(a){ + return a.toLowerCase() ; + }); enumVals.push(' * ' + name + '()'); } enumVals.sort(); content = content.concat(enumVals); content.push(''); -content.push('***/'); for (var i = 0; i< content.length; i++){ out.println(content[i]); } diff --git a/src/docs/js/generateTOC.js b/src/docs/js/generateTOC.js index b53605184..22e35df68 100644 --- a/src/docs/js/generateTOC.js +++ b/src/docs/js/generateTOC.js @@ -40,11 +40,11 @@ for (var i = 0; i < contents.length; i++){ if (line.match(/^##\s+/)){ var h2 = line.match(/^##\s+(.*)/)[1].trim(); var link = createLink(h2); - java.lang.System.out.println (' * [' + h2 + '](#' + link + ')'); + java.lang.System.out.println(' * [' + h2 + '](#' + link + ')'); } if (line.match(/^###\s+/)){ var h3 = line.match(/^###\s+(.*)/)[1].trim(); var link = createLink(h3); - java.lang.System.out.println (' * [' + h3 + '](#' + link + ')'); + java.lang.System.out.println(' * [' + h3 + '](#' + link + ')'); } } diff --git a/src/docs/templates/ypgpm.md b/src/docs/templates/ypgpm.md index fa87aa9d4..445166c48 100644 --- a/src/docs/templates/ypgpm.md +++ b/src/docs/templates/ypgpm.md @@ -1,4 +1,3 @@ - ## Introduction Minecraft is an open-ended 3D game where you can build and craft @@ -18,78 +17,39 @@ players connect to a Minecraft Server on the internet or locally ![Cottages created using ScriptCraft in MineCraft][img_cr] -## Installation - -CanaryMod is a version of the Minecraft server software which allows -easy addition of 'Mods' and extensions to Minecraft. ScriptCraft is a -'Mod' for use with CanaryMod. Adding Mods to Minecraft can be -difficult but CanaryMod makes it easy. Follow these steps to -Install ScriptCraft on your computer... - -1. [Download and install CanaryMod][dlcm] then follow the [CanaryMod - Installation Instructions][cmadmin]. - -2. Start the CanaryMod server, then once it has started up, stop it - by typing 'stop'. If you go to the CanaryMod folder (see step 1) you - should see some new files and subfolders. - -3. [Download the latest version of the ScriptCraft Mod][sc-plugin]. Then copy the ScriptCraft.jar file to the - `plugins` folder (This folder won't be created until you run CanaryMod for the first time (see previous step). - -4. Start up the CanaryMod server again (see [instructions for starting the server][cmadmin]). - -5. In the CanaryMod command window type `op {your_username}` and hit - enter, replacing {your_username} with your own minecraft - username. This will give you `operator` access meaning you can perform - more commands than are normally available in Minecraft. You should - make yourself a server operator (Server operators have full privileges - for the server) permanently by editing the ops.txt file - and adding your username (one username per line). - -6. In the CanaryMod command window type `js 1 + 1` and hit enter. You should see `> 2` . - -... Congratulations! You just installed your own Minecraft Server with -the ScriptCraft Mod and are now ready to begin programming in Minecraft. +# Installation -Normally, Minecraft Mods are written in Java. This makes writing your -own extension or game rules difficult because you must first learn Java. -Java is different enough from Javascript. With the ScriptCraft plug-in -installed, you don't have to learn Java, you can extend and customize -Minecraft your way using Javascript. Javascript is easier to learn than -Java but it's also more flexible and powerful and is used for creating -interactive web sites and many other applications. +Before installing ScriptCraft you must first install SpigotMC which is +a special version of Minecraft Server that makes it easy to customize +the game. -## CanaryMod and Permissions -CanaryMod works slightly differently to CraftBukkit in how it handles -permissions and groups. By default, there are 4 groups: visitors, -players, mods and admins. Each player who joins the game is added to the -'visitors' group. This group has no permissions by default so -visitors can't break or place blocks. If you would like to change this -behaviour then issue the following command at the console window: +## Installing and Running SpigotMC - groupmod permission add visitors canary.world.build +Follow these steps to download and install SpigotMC. -If you would like all admins to have scripting ability then issue the -following command: +1. Download Spigot's [BuildTools.jar][spigotdl] +2. Save the BuildTools.jar file to a new directory called spigotmc. +3. Open a terminal (Mac and Linux) or command prompt (windows) window and type `java -jar BuildTools.jar`. This will kick off a long series of commands to "build" SpigotMC. +4. When the build is done, there will be a new file beginning with `spigot` and ending in `.jar` in the spigotmc directory. Run this file by typing `java -jar spigot-1.10.2.jar` (it might not be that exact name - you can list files in the directory by typing `dir` (Windows) or `ls` (Mac and Linux). +5. The server will start up then shut down very shortly afterwards. You'll need to edit a file called `eula.txt` - change `eula=false` to `eula=true` and save the file. +6. Run the `java -jar spigot-1.10.2.jar` command again - this time the server will start up. Shut it down by typing `stop` at the server prompt. - groupmod permission add admins scriptcraft.evaluate +## Installing ScriptCraft -This will enable all admins on your server to issue javascript statements. -All operators can issue any command (including the `/js` command to evaluate javascript). -For more information on CanaryMod's Permissions and Groups see the following: +Follow these steps to download and install ScriptCraft. - * [Permissions and Groups][cmPerms] - * [List of Permissions][cmPermsList] +1. Download the [scriptcraft.jar][dl] plugin and save it to the `plugins` directory and restart the server by typing `java -jar spigot-1.10.2.jar`. +2. At the server prompt type `js 1 + 1` and hit enter. The result `2` should be displayed. -[cmPerms]: http://canarymod.net/books/canarymod-admin-guide/permissions-and-groups -[cmPermsList]: http://canarymod.net/books/canarymod-admin-guide/list-permissions +Congratulations - you've just installed your Custom Minecraft Server and are ready to begin writing your first mod! ## Configuring your Server (optional) -Once you've installed CanaryMod, depending on your specific needs, -you might want to consider setting the following properties in the `server.cfg` or `config/worlds//.cfg` files ... +Once you've installed SpigotMC, depending on your specific needs, +you might want to consider setting the following properties in the `server.properties` file: # completely flat worlds are best for building from scratch + # bukkit/spigotmc level-type=FLAT generate-structures=false @@ -625,19 +585,17 @@ compare the ages of your friends or siblings to your own age. You can find out if you can Fly in minecraft by typing the following statement ... - /js self.getCapabilities().mayFly() + /js self.allowFlight ... the result will be `true` or `false` depending on whether you can fly or not. You can turn on and off your ability to fly by setting -your `mayFly` property to `true` or `false`. Try it ... +your `allowFlight` property to `true` or `false`. Try it ... - /js self.capabilities.flying = true - /js self.updateCapabilities() + /js self.allowFlight = true; ... Now you can fly! Double-press the space bar key to start flying. To turn off flight ... - /js self.capabilities.flying = false; - /js self.updateCapabilities() + /js self.allowFlight = false; ... and you come crashing down to earth. This is just one example of how `true` and `false` are used throughout ScriptCraft – these are @@ -646,55 +604,56 @@ Maths Professor at University College Cork. There are plenty more examples of boolean values in Minecraft. You can find out if it's raining in your minecraft world by typing the following statement ... - /js self.world.raining + /js self.world.hasStorm() ... The result of this statement will be either `false` (if it's not raining) or `true` (if it *is* raining). If it's raining, you can make it stop raining typing the following command: - /js self.world.raining = false + /js self.world.setStorm(false) ... Similarly, to make it start raining you can issue the following command: - /js self.world.raining = true + /js self.world.setStorm( true ) ### Booleans and JavaBeans There are many *boolean* properties you can use to turn on or off -certain game behaviours. For example, the *raining* behavior is turned -on or off using the World's `raining` property. The World object's -properties and methods are [documented on the CanaryMod JavaDocs World -page][cmworld]. When browsing the CanaryMod JavaDoc pages, whenever -you see a method whose name begins with `is` such as `isRaining()` and -a companion method `setRaining()`, these methods are called *JavaBean* -methods - the *raining* property is a *JavaBean* property and there +certain game behaviours. For example, the *thundering* behavior is turned +on or off using the World's `thundering` property. The World object's +properties and methods are [documented on the SpigotMC JavaDocs World +page][spworld]. When browsing the SpigotMC JavaDoc pages, whenever +you see a method whose name begins with `is` such as `isThundering()` and +a companion method `setThundering()`, these methods are called *JavaBean* +methods - the *thundering* property is a *JavaBean* property and there are two ways you can use JavaBean properties in Javascript. You can *get* and *set* the property using the methods provided by Java. To -*get* the raining property you can call the JavaBean Method: +*get* the thundering property you can call the JavaBean Method: - /js self.world.isRaining() + /js self.world.isThundering() ... or you can get the property like this: - /js self.world.raining + /js self.world.thundering -To *set* the raining property, you can call the JavaBean method: +To *set* the thundering property, you can call the JavaBean method: - /js self.world.setRaining( true ) + /js self.world.setThundering( true ) ... or you can set the property like this: - /js self.world.raining = true + /js self.world.thundering = true Whatever approach you use, the result will be the same. [cmworld]: https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/api/world/World.html +[spworld]: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/World.html ### SIDENOTE You may be wondering how to change other aspects of the Minecraft game - pretty much all aspects of the game can be changed. Changes are made using what are called `API` calls - these are calls to functions and methods in -Minecraft - you can read more about these on the [CanaryMod API -Reference][cmapi]. +Minecraft - you can read more about these on the [SpigotMC API +Reference][spigotapi]. ## ...and Again, and Again, and Again,... @@ -895,7 +854,10 @@ var utils = require('utils'); var players = utils.players(); var sounds = require('sounds'); utils.foreach( players, function( player ) { - sounds.catMeow( player ); + sounds.entityCatAmbient( player ); // spigot 1.9 + /* canarymod only + sounds.catMeow( player ); + */ } ); ``` @@ -1017,7 +979,7 @@ This time no message should appear on your screen. The `if` statement tests to see if something is `true` or `false` and if `true` then the block of code between the curly braces ( `{` and `}` ) is executed - but only if the condition is true. The condition -in the above example is `!self.onGround` (self is not on ground) which +in the above example is `!self.onGround` (self is _not_ on ground) which will be `true` if you are currently flying or `false` if you aren't. What if you wanted to display a message only if a condition is *not* @@ -1073,29 +1035,29 @@ following code sends a message to any player who breaks a block in the game... ```javascript -function myBlockDestroyHook( event ){ +function myBlockBreakHook( event ){ var breaker = event.player; echo( breaker, 'You broke a block'); } -events.blockDestroy( myBlockDestroyHook ); +events.blockBreak( myBlockBreakHook ); ``` -The `events.blockDestroy()` function is just one of the many `events` functions which can be used to *register* a function to be called whenever a particular type of event occurs. In the -above code the blockDestroy function takes as a parameter a function +The `events.blockBreak()` function is just one of the many `events` functions which can be used to *register* a function to be called whenever a particular type of event occurs. In the +above code the blockBreak function takes as a parameter a function I want to be called when that event occurs. The function I want called in turn takes 1 parameter. The `event` object has all the information about the event which just occurred. I can tell who broke the block and send a message to the player. The important thing to note is that -the `myBlockDestroyHook` function defined above will not be called until a player breaks a +the `myBlockBreakHook` function defined above will not be called until a player breaks a block. Try it - save the above code in a new file in the `scriptcraft/plugins` directory then type `/js refresh()` to reload scriptcraft. Then break a block in the game and you should see the message 'You broke a block'. There are many types of events you can listen for in Minecraft. You can -browse [all possible event registration functions][cmevts2] in the API Reference. +browse [all possible event registration functions][spevts2] in the API Reference. -For custom events (events which aren't in the net.canarymod.hook tree) +For custom events (events which aren't in the org.bukkit.event tree) just specify the fully qualified class name instead. E.g. ... events.on ( net.yourdomain.events.YourEvent, function( event ) { @@ -1107,12 +1069,12 @@ just specify the fully qualified class name instead. E.g. ... If you want an event handler to only execute once, you can remove the handler like this... ```javascript -function myBlockDestroyHook( evt ) { +function myBlockBreakHook( evt ) { var breaker = evt.player; echo( breaker, 'You broke a block'); this.unregister(); } -events.blockDestroy( myBlockDestroyHook ); +events.blockBreak( myBlockBreakHook ); ``` The `this.unregister();` statement will remove this function from the @@ -1124,11 +1086,11 @@ to stop listening for events. To unregister a listener *outside* of the listener function... ```javascript -function myBlockDestroyHook( evt ){ +function myBlockBreakHook( evt ){ var breaker = evt.player; echo( breaker, 'You broke a block'); } -var myBlockBreakListener = events.blockDestroy( myBlockDestroyHook ); +var myBlockBreakListener = events.blockBreak( myBlockBreakHook ); ... myBlockBreakListener.unregister(); ``` @@ -1248,7 +1210,7 @@ var breaks = {}; function initializeBreakCount( event ){ breaks[event.player.name] = 0; } -events.connection( initializeBreakCount ); +events.playerJoin( initializeBreakCount ); /* every time a player breaks a block increase their block-break-count @@ -1258,7 +1220,7 @@ function incrementBreakCount( event ){ var breakCount = breaks[event.player.name]; echo( event.player, 'You broke ' + breakCount + ' blocks'); } -events.blockDestroy( incrementBreakCount ); +events.blockBreak( incrementBreakCount ); ``` With a little more work, you could turn this into a game where players @@ -1276,12 +1238,12 @@ minecraft, I recommend reading the accompanying [ScriptCraft API reference][api] which covers all of the ScriptCraft functions, objects and methods. I also recommend reading the source code to some of the existing scriptcraft plugins, followed by -[Anatomy of a ScriptCraft Plug-in][ap]. The online [CanaryMod API -Reference][cmapi] provides lots of valuable information about the +[Anatomy of a ScriptCraft Plug-in][ap]. The online [SpigotMC API +Reference][spigotapi] provides lots of valuable information about the different objects and methods available for use by ScriptCraft. -[cmadmin]: http://canarymod.net/books/canarymod-admin-guide +[cmadmin]: https://github.com/walterhiggins/canarymod-admin-guide/ [dlbuk2]: http://dl.bukkit.org/downloads/craftbukkit/ [dlcm]: http://canarymod.net/releases [bii]: http://wiki.bukkit.org/Setting_up_a_server @@ -1291,6 +1253,7 @@ different objects and methods available for use by ScriptCraft. [np]: http://notepad-plus-plus.org/ [cbapi]: http://jd.bukkit.org/beta/apidocs/ [cmapi]: https://ci.visualillusionsent.net/job/CanaryLib/javadoc/ +[spigotapi]: https://hub.spigotmc.org/javadocs/spigot/ [boole]: http://en.wikipedia.org/wiki/George_Boole [soundapi]: https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/api/world/effects/SoundEffect.Type.html [ap]: Anatomy-of-a-Plugin.md @@ -1299,6 +1262,7 @@ different objects and methods available for use by ScriptCraft. [bkevts]: http://jd.bukkit.org/dev/apidocs/org/bukkit/event/package-summary.html [cmevts]: https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/package-summary.html [cmevts2]: API-Reference.md#events-helper-module-canary-version +[spevts2]: API-Reference.md#events-helper-module-spigotmc-version [img_echo_date]: img/ypgpm_echo_date.png [img_3d_shapes]: img/ypgpm_3dshapes.jpg [img_whd]: img/ypgpm_whd.jpg diff --git a/src/main/js/lib/events-bukkit.js b/src/main/js/lib/events-bukkit.js index a2577c90a..875d91c34 100644 --- a/src/main/js/lib/events-bukkit.js +++ b/src/main/js/lib/events-bukkit.js @@ -69,7 +69,7 @@ exports.on = function( The workaround is to make the ScriptCraftPlugin java class a Listener. Should only unregister() registered plugins in ScriptCraft js code. */ - regd = new bkRegisteredListener( __plugin, eventExecutor, priority, __plugin, true ); + regd = new bkRegisteredListener( __plugin, eventExecutor, priority, __plugin, false ); handlerList.register( regd ); result.unregister = function(){ handlerList.unregister( regd ); diff --git a/src/main/js/lib/legacy-check.js b/src/main/js/lib/legacy-check.js index b13da082c..21bf89c45 100644 --- a/src/main/js/lib/legacy-check.js +++ b/src/main/js/lib/legacy-check.js @@ -11,8 +11,7 @@ module.exports = function( jsPluginsRootDir ) { } var legacyExists = false, legacyDirs = [ - new File( mcServerDir, 'js-plugins' ), - new File( mcServerDir, 'plugins/scriptcraft' ) + new File( mcServerDir, 'js-plugins' ) ]; for ( var i = 0; i < legacyDirs.length; i++ ) { @@ -27,7 +26,7 @@ module.exports = function( jsPluginsRootDir ) { } } if ( legacyExists ) { - console.info( 'Please note that the working directory for %s is %s', + console.info( 'The working directory for %s is %s', __plugin, jsPluginsRootDir.canonicalPath ); } }; diff --git a/src/main/js/lib/require.js b/src/main/js/lib/require.js index 4090e1d6f..c75fba2ae 100644 --- a/src/main/js/lib/require.js +++ b/src/main/js/lib/require.js @@ -160,23 +160,12 @@ When resolving module names to file paths, ScriptCraft uses the following rules. } } } else { - // it's of the form ./path - file = new File(parentDir, moduleName); - if ( file.exists() ) { + if ((file = new File(parentDir, moduleName)).exists()) { return fileExists(file); - } else { - // try appending a .js to the end - pathWithJSExt = file.canonicalPath + '.js'; - file = new File( parentDir, pathWithJSExt ); - if (file.exists()) { - return file; - } else { - file = new File(pathWithJSExt); - if ( file.exists() ) { - return file; - } - } - + } else if ((file = new File(parentDir, moduleName + ".js")).exists()) { // try .js extension + return file; + } else if ((file = new File(parentDir, moduleName + ".json")).exists()) { // try .json extension + return file; } } return null; @@ -250,6 +239,9 @@ When resolving module names to file paths, ScriptCraft uses the following rules. } buffered.close(); // close the stream so there's no file locks + if(canonizedFilename.toLowerCase().substring(canonizedFilename.length - 5) === ".json") // patch code when it is json + code = "module.exports = (" + code + ");"; + moduleInfo = { loaded: false, id: canonizedFilename, @@ -309,11 +301,18 @@ When resolving module names to file paths, ScriptCraft uses the following rules. return moduleInfo; } - function _requireClosure( parent ) { - return function requireBoundToParent( path, options ) { - var module = _require( parent, path , options); + function _requireClosure( parentFile ) { + var _boundRequire = function requireBoundToParent( path, options ) { + var module = _require( parentFile, path , options); return module.exports; }; + + _boundRequire.resolve = function resolveBoundToParent ( path ) { + return resolveModuleToFile(path, parentFile); + }; + _boundRequire.cache = _loadedModules; + + return _boundRequire; } var _loadedModules = {}; var _format = java.lang.String.format; diff --git a/src/main/js/lib/scriptcraft.js b/src/main/js/lib/scriptcraft.js index 0f7428d7a..369f7c09c 100644 --- a/src/main/js/lib/scriptcraft.js +++ b/src/main/js/lib/scriptcraft.js @@ -366,11 +366,18 @@ The refresh() function can be used to only reload the ScriptCraft plugin (it's l 1. Disable the ScriptCraft plugin. 2. Unload all event listeners associated with the ScriptCraft plugin. +3. Cancel all timed tasks (created by `setInterval` & `setTimeout`) 3. Enable the ScriptCraft plugin. ... refresh() can be used during development to reload only scriptcraft javascript files. See [issue #69][issue69] for more information. +By default, if `self` is defined at runtime, it checks, whether `self` is server operator, otherwise fails with message. This behavivor can be modified using `skipOpCheck` parameter (useful, if you are doing some custom premission checks before calling this function). + +#### Parameters + + * skipOpCheck (boolean - optional) : If true, the function won't check if `self` is server operator. + [issue69]: https://github.com/walterhiggins/ScriptCraft/issues/69 ### addUnloadHandler() function @@ -529,19 +536,20 @@ function __onEnable ( __engine, __plugin, __script ) { return sender.op; } } - function _refresh( ) { - if ( typeof self !== 'undefined' ) { - if ( !_isOp(self) ) { - echo( self, 'Only operators can refresh()'); - return; - } + function _refresh( skipOpCheck ) { + if (!skipOpCheck && typeof self !== 'undefined') { + if (!_isOp(self)) + return echo(self, 'Only operators can refresh()'); } + if (__plugin.canary){ var pluginName = __plugin.name; Canary.manager().disablePlugin( pluginName ); Canary.manager().enablePlugin( pluginName ); } else { __plugin.pluginLoader.disablePlugin( __plugin ); + org.bukkit.event.HandlerList["unregisterAll(org.bukkit.plugin.Plugin)"]( __plugin ); + server.scheduler.cancelTasks( __plugin ); __plugin.pluginLoader.enablePlugin( __plugin ); } } // end _refresh() diff --git a/src/main/js/modules/blockhelper.js b/src/main/js/modules/blockhelper.js index d6831e223..8955f7add 100644 --- a/src/main/js/modules/blockhelper.js +++ b/src/main/js/modules/blockhelper.js @@ -98,31 +98,24 @@ function applyFacing( block, metadata ){ function face(direction){ property(block).set('facing', lookup.facing[direction]); } - switch( block.typeId ){ - case blocks.stairs.oak: - case blocks.stairs.cobblestone: - case blocks.stairs.brick: - case blocks.stairs.stone: - case blocks.stairs.nether: - case blocks.stairs.sandstone: - case blocks.stairs.spruce: - case blocks.stairs.jungle: - case blocks.stairs.quartz: - face( ['east','west','south','north'][metadata] ); - break; - case blocks.sign: - case blocks.ladder: - // bug: furnace, chest, dispenser don't always use the right metadata - case blocks.furnace: - case blocks.furnace_burning: - case blocks.chest: - case blocks.enderchest: - case blocks.dispenser: - face( [null,null,'north','south','west','east'][metadata] ); - break; - case blocks.torch: - face( ['up'/* default */,'east','west','south','north','up'][metadata] ); - break; + if ( blocks.isStair(block.typeId) ){ + face( ['east','west','south','north'] [metadata] ); + } else { + switch( block.typeId ){ + case blocks.sign: + case blocks.ladder: + // bug: furnace, chest, dispenser don't always use the right metadata + case blocks.furnace: + case blocks.furnace_burning: + case blocks.chest: + case blocks.enderchest: + case blocks.dispenser: + face( [null,null,'north','south','west','east'][metadata] ); + break; + case blocks.torch: + face( ['up'/* default */,'east','west','south','north','up'][metadata] ); + break; + } } } function applyColors( block, metadata ){ diff --git a/src/main/js/modules/blocks.js b/src/main/js/modules/blocks.js index 162e82ec6..920c69a7c 100644 --- a/src/main/js/modules/blocks.js +++ b/src/main/js/modules/blocks.js @@ -28,8 +28,8 @@ var blocks = { grass: 2, dirt: 3, cobblestone: 4, - oak: 5, spruce: '5:1', birch: '5:2', jungle: '5:3', - sapling: { oak: 6, spruce: '6:1', birch: '6:2', jungle: '6:3' }, + oak: 5, spruce: '5:1', birch: '5:2', jungle: '5:3', acacia: '5:4', dark_oak: '5:5', + sapling: { oak: 6, spruce: '6:1', birch: '6:2', jungle: '6:3', acacia: '6:4', dark_oak: '6:5' }, bedrock: 7, water: 8, water_still: 9, @@ -43,11 +43,17 @@ var blocks = { wood: 17, leaves: 18, sponge: 19, + sponge_wet: '19:1', glass: 20, lapis_lazuli_ore: 21, lapis_lazuli_block: 22, dispenser: 23, sandstone: 24, + sandstone_chiseled: '24:1', + sandstone_smooth: '24:2', + sandstone_red: 179, + sandstone_red_chiseled: '179:1', + sandstone_red_smooth: '179:2', note: 25, bed: 26, powered_rail: 27, @@ -70,7 +76,17 @@ var blocks = { double_slab: { stone: 43, sandstone: '43:1', + sandstone_red: 181, + sandstone_red_smooth: '181:8', wooden: '43:2', + wood: { + oak: 125, + spruce: '125:1', + birch: '125:2', + jungle: '125:3', + acacia: '125:4', + dark_oak: '125:5' + }, cobblestone: '43:3', brick: '43:4', stonebrick: '43:5', @@ -78,9 +94,11 @@ var blocks = { quartz: '43:7', smooth_stone: '43:8', smooth_sandstone: '43:9', - tile_quartz: '43:15' + tile_quartz: '43:15', + purpur: 204, }, slab: { + stone: '44:0', sandstone: '44:1', wooden: '44:2', cobblestone: '44:3', @@ -91,6 +109,7 @@ var blocks = { upper: { stone: '44:8', sandstone: '44:9', + sandstone_red: '182:8', wooden: '44:10', cobblestone: '44:11', brick: '44:12', @@ -100,14 +119,20 @@ var blocks = { oak: '126:8', spruce: '126:9', birch: '126:10', - jungle: '126:11' + jungle: '126:11', + acacia: '126:12', + dark_oak: '126:13' }, snow: 78, stone: 44, oak: 126, spruce: '126:1', birch: '126:2', - jungle: '126:3' + jungle: '126:3', + acacia: '126:4', + dark_oak: '126:5', + sandstone_red: 182, + purpur: 205, }, // see brick.red 45 tnt: 46, @@ -127,7 +152,11 @@ var blocks = { spruce: 134, birch: 135, jungle: 136, - quartz: 156 + quartz: 156, + acacia: 163, + dark_oak: 164, + sandstone_red: 180, + purpur: 203, }, chest: 54, redstone_wire: 55, @@ -167,7 +196,7 @@ var blocks = { jackolantern: 91, cake: 92, redstone_repeater: 93, - redeston_repeater_active: 94, + redstone_repeater_active: 94, stained_glass: { white: 95 // all other colors added below }, @@ -215,6 +244,7 @@ var blocks = { flowerpot: 140, carrots: 141, potatoes: 142, + beetroot: 207, button_wood: 143, skull: 144, mobhead: 144, anvil: 145, @@ -257,6 +287,8 @@ var blocks = { packed_ice: 174, double_plant: 175, sunflower: 175, + purpur: 201, + purpur_pillar: 202, flower: { sunflower: 175, lilac: '175:1', @@ -267,7 +299,16 @@ var blocks = { yellow: 37, dandelion: 37, rose: 38, - red: 38 + red: 38, + poppy: 38, + blueorchid: '38:1', + allium: '38:2', + azure_bluet: '38:3', + red_tulip: '38:4', + orange_tulip: '38:5', + white_tulip: '38:6', + pink_tulip: '38:7', + oxeye_daisy: '38:8' }, bonemeal: '351:15', banner: { @@ -311,11 +352,11 @@ for (var i = 0, len = colorized_blocks.length; i < len; i++) { }; /* - rainbow colors - a convenience - Color aliased properties that were a direct descendant of the blocks - object are no longer used to avoid confusion with carpet and stained - clay blocks. - */ + rainbow colors - a convenience + Color aliased properties that were a direct descendant of the blocks + object are no longer used to avoid confusion with carpet and stained + clay blocks. +*/ blocks.rainbow = [ blocks.stained_glass.red, blocks.stained_glass.orange, @@ -325,5 +366,12 @@ blocks.rainbow = [ blocks.stained_glass.blue, blocks.stained_glass.purple ]; - +blocks.isStair = function(id){ + var p; + for (p in this.stairs){ + if (this.stairs[p] == id) + return true; + } + return false; +}; module.exports = blocks; diff --git a/src/main/js/modules/bukkit/recipes.js b/src/main/js/modules/bukkit/recipes.js index edcb85609..315fd0f3b 100644 --- a/src/main/js/modules/bukkit/recipes.js +++ b/src/main/js/modules/bukkit/recipes.js @@ -3,9 +3,9 @@ var bkShapedRecipe = org.bukkit.inventory.ShapedRecipe; exports.add = function( recipe ){ var result = new bkShapedRecipe( recipe.result ); - result.shape( recipe.shape ); + result.shape(recipe.shape[0], recipe.shape[1], recipe.shape[2]); for (var i in recipe.ingredients ){ - result.setIngredient( i, recipe.ingredients[i] ); + result.setIngredient( new java.lang.Character(i), recipe.ingredients[i].getData() ); } server.addRecipe(result); return result; diff --git a/src/main/js/modules/classroom/index.js b/src/main/js/modules/classroom/index.js index be56396bc..31d17296c 100644 --- a/src/main/js/modules/classroom/index.js +++ b/src/main/js/modules/classroom/index.js @@ -166,8 +166,19 @@ function grantScripting( player ) { console.log('Enabling scripting for player ' + player.name); var playerName = '' + player.name; playerName = playerName.replace(/[^a-zA-Z0-9_\-]/g,''); + var playerDir = new File( playersDir + playerName ); - playerDir.mkdirs(); + if (!playerDir.exists()) { + playerDir.mkdirs(); + var exampleJs = "//Try running this function from Minecraft with: /js $username.hi( self )\n" + + "//Remember to use your real username instead of $username!\n" + + "//So if you had username 'walterh', you would run: /js walterh.hi( self )\n" + + "exports.hi = function( player ){\n" + + "\techo( player, 'Hi ' + player.name);\n" + + "};" + createFile(playerDir, 'greet.js', exampleJs); + } + if (__plugin.bukkit){ player.addAttachment( __plugin, 'scriptcraft.*', true ); } @@ -188,6 +199,12 @@ function grantScripting( player ) { autoloadTime[playerName] = currentTime; }); + function createFile(fileDir, fileName, fileContent) { + var out = new java.io.PrintWriter(new File(fileDir, fileName)); + out.println(fileContent); + out.close(); + } + /* echo( player, 'Create your own minecraft mods by adding javascript (.js) files'); echo( player, ' Windows: Open Explorer, go to \\\\' + serverAddress + '\\players\\' + player.name); diff --git a/src/main/js/modules/drone/blocktype.js b/src/main/js/modules/drone/blocktype.js index 5d0311e2e..0d9160e38 100644 --- a/src/main/js/modules/drone/blocktype.js +++ b/src/main/js/modules/drone/blocktype.js @@ -294,6 +294,18 @@ var bitmaps = { ' '+ ' '+ ' ', + + '(': ' # '+ + ' # '+ + ' # '+ + ' # '+ + ' # ', + + ')': ' # '+ + ' # '+ + ' # '+ + ' # '+ + ' # ', ' ':' '+ ' '+ @@ -352,7 +364,7 @@ function blocktype( message, fg, bg, immediate ) { if ( typeof bg != 'undefined' ) { bmbg = this.getBlockIdAndMeta( bg ); } - lines = message.split( '\n' ); + lines = (''+ message).split( '\n' ); lineCount = lines.length; for ( h = 0; h < lineCount; h++) { diff --git a/src/main/js/modules/drone/index.js b/src/main/js/modules/drone/index.js index 5601cb890..b4d405c1a 100644 --- a/src/main/js/modules/drone/index.js +++ b/src/main/js/modules/drone/index.js @@ -208,7 +208,7 @@ Alternatively if you provide just a function as a parameter, then the function n // submitted by [edonaldson][edonaldson] var Drone = require('drone'); - Drone.extend('pyramid', function( block,height) { + Drone.extend('pyramid', function( block, height ) { this.chkpt('pyramid'); for ( var i = height; i > 0; i -= 2) { this.box(block, i, 1, i).up().right().fwd(); @@ -219,7 +219,7 @@ Alternatively if you provide just a function as a parameter, then the function n #### Example 2 Using just a named function as a parameter var Drone = require('drone'); - function pyramid( block,height) { + function pyramid( block, height ) { this.chkpt('pyramid'); for ( var i = height; i > 0; i -= 2) { this.box(block, i, 1, i).up().right().fwd(); @@ -277,6 +277,22 @@ If you want to place a torch so it faces _away_ from the drone: drone.box( blocks.torch + ':' + Drone.PLAYER_TORCH_FACING[(drone.dir + 2) % 4]); +#### Drone.MAX_SIDE + +Specifies the maximum length (in any dimension) when calling the Drone.cuboidX (box) method. +The default value is 1,000 blocks. + +If you see an error message in the console `Build too big!` It's because the width, height or length paramete was greater than the Drone.MAX_SIDE value. + +#### Drone.MAX_VOLUME + +Specifies the maximum value for any call to Drone.cuboidX (box) method. +The default value is 1,000,000 (1 million) blocks. + +If the volume (width X height X length) of any single call to the Drone.cuboidX() method exceeds this value, you will see an error message in the console `Build too big!` . + +The values of both the `Drone.MAX_SiDE` and `Drone.MAX_VOLUME` variables _can_ be overridden but it's not recommended. + ***/ // @@ -656,7 +672,7 @@ Drone.prototype.cuboida = function(/* Array */ blocks, w, h, d, overwrite) { Drone.MAX_VOLUME = 1 * MILLION; Drone.MAX_SIDE = 1 * THOUSAND; -var tooBig = function(w, h, d ) { +function isTooBig(w, h, d ) { return ( w * h * d ) >= Drone.MAX_VOLUME || ( w >= Drone.MAX_SIDE ) || ( h >= Drone.MAX_SIDE ) || @@ -677,7 +693,7 @@ Drone.prototype.cuboidX = function( blockType, meta, w, h, d, immediate ) { if ( typeof w == 'undefined' ) { w = 1; } - if ( tooBig( w, h, d ) ) { + if ( isTooBig( w, h, d ) ) { this.sign([ 'Build too Big!', 'width:' + w, @@ -766,28 +782,20 @@ Drone.prototype.debug = function( ) { function getBlockIdAndMeta( b ) { var defaultMeta = 0, - i = 0, - bs, - md, - sp; + i = 0, + bs, + md, + sp; if (typeof b === 'number' || /^[0-9]+$/.test(b)) { // wph 20130414 - use sensible defaults for certain blocks e.g. stairs // should face the drone. - switch (b) { - case blocks.stairs.oak: - case blocks.stairs.cobblestone: - case blocks.stairs.brick: - case blocks.stairs.stone: - case blocks.stairs.nether: - case blocks.stairs.sandstone: - case blocks.stairs.spruce: - case blocks.stairs.jungle: - case blocks.stairs.quartz: - defaultMeta = Drone.PLAYER_STAIRS_FACING[ this.dir % 4 ]; - break; + if ( blocks.isStair(b) ) { + defaultMeta = Drone.PLAYER_STAIRS_FACING[ this.dir % 4 ]; + } else { + switch (b) { case blocks.sign: case blocks.ladder: - // bug: furnace, chest, dispenser don't always use the right metadata + // bug: furnace, chest, dispenser don't always use the right metadata case blocks.furnace: case blocks.furnace_burning: case blocks.chest: @@ -798,6 +806,7 @@ function getBlockIdAndMeta( b ) { case blocks.sign_post: defaultMeta = ( 12 + ( ( this.dir + 2 ) * 4 ) ) % 16; break; + } } return [ b, defaultMeta ]; } diff --git a/src/main/js/modules/entities.js b/src/main/js/modules/entities.js new file mode 100644 index 000000000..0b74a642b --- /dev/null +++ b/src/main/js/modules/entities.js @@ -0,0 +1,38 @@ +'use strict'; +/*global __plugin, org, Packages, module, exports*/ +var entities = {}, + entitytypes, + t, i, name; +if (__plugin.bukkit) { + entitytypes = org.bukkit.entity.EntityType.values(); +} +if (__plugin.canary) { + entitytypes = Packages.net.canarymod.api.entity.EntityType.values(); +} +function getEntityHandler( entityType ) { + return function( entity ){ + if (arguments.length == 0){ + return entityType; + } + if (arguments.length == 1){ + if (entity){ + if (__plugin.bukkit){ + return entity.type == entityType; + } + if (__plugin.canary){ + return entity.entityType == entityType; + } + } + } + return null; + }; +} +for (t in entitytypes) { + if (entitytypes[t] && entitytypes[t].ordinal) { + name = ('' + entitytypes[t].name()).replace(/^(.*)/,function(a){ + return a.toLowerCase(); + }); + entities[name] = getEntityHandler(entitytypes[t]); + } +} +module.exports = entities; diff --git a/src/main/js/modules/http/request.js b/src/main/js/modules/http/request.js index be39c975a..adbe9cb6f 100644 --- a/src/main/js/modules/http/request.js +++ b/src/main/js/modules/http/request.js @@ -30,7 +30,7 @@ The following example illustrates how to use http.request to make a request to a ```javascript var jsResponse; -var http = require('request'); +var http = require('http'); http.request('http://scriptcraftjs.org/sample.json',function(responseCode, responseBody){ jsResponse = JSON.parse( responseBody ); }); diff --git a/src/main/js/modules/lightning.js b/src/main/js/modules/lightning.js new file mode 100644 index 000000000..b1e8a4166 --- /dev/null +++ b/src/main/js/modules/lightning.js @@ -0,0 +1,30 @@ +'use strict'; +/************************************************************************ +## Lightning module + +Causes a bolt of lightning to strike. + +### Usage +```javascript +// strike lightning wherever a player's arrow lands +var lightning = require('lightning'); +events.projectileHit( function( event ){ + if ( entities.arrow( event.projectile ) // it's an arrow + && entities.player( event.projectile.owner ) // it was shot by a player + ) { + lightning( event.projectile ); // strike lightning at the arrow location + } +}); +``` + +***/ +module.exports = function lightning( something ) { + if (__plugin.canary && something.location){ + return something.location.world.makeLightningBolt(something.location); + } + if (__plugin.bukkit && something.location){ + return something.location.world.strikeLightning(something.location); + } + console.log('Need an object with a location property for lightning strike'); + return null; +}; diff --git a/src/main/js/modules/minigames/scoreboard.js b/src/main/js/modules/minigames/scoreboard.js index 8d7d524d7..6fc34f436 100644 --- a/src/main/js/modules/minigames/scoreboard.js +++ b/src/main/js/modules/minigames/scoreboard.js @@ -55,7 +55,7 @@ function updatePlayerScore( objectiveName, playerName, score ){ var sc = sb['getScore(String, ScoreObjective)']( playerName, sb.getScoreObjective( objectiveName) ); sc.score = score; */ - execCommand('scoreboard players set ' + playerName + ' ' + objectiveName + score); + execCommand('scoreboard players set ' + playerName + ' ' + objectiveName + ' ' + score); } function removeTeamFromScoreboard( teamName ){ diff --git a/src/main/js/modules/slash.js b/src/main/js/modules/slash.js index 62dd94262..92e66a7c1 100644 --- a/src/main/js/modules/slash.js +++ b/src/main/js/modules/slash.js @@ -14,7 +14,7 @@ This function makes it easy to execute one or more minecraft commands. #### Parameters * commands : A String or Array of strings - each string is a command to be executed. - * sender: The player or server on whose behalf the commands should be executed. + * sender: (optional) The player on whose behalf the commands should be executed. If not specified the commands will be executed as the server console user. #### Examples @@ -22,17 +22,20 @@ Invoke the `/defaultgamemode creative` command (as server). ```javascript var slash = require('slash'); -slash('defaultgamemode creative', server); +slash('defaultgamemode creative'); ``` -Set the time of day to Midday and toggle downfall: +Set the time of day to Midday and toggle downfall (as player 'JohnDoe'): ```javascript -var slash = require('slash'); +var slash = require('slash'), + utils = require('utils'); +var johnDoe = utils.player('John_Doe'); + slash([ 'time set 6000', 'toggledownfall' -], server); +], johnDoe); ``` ***/ @@ -51,7 +54,12 @@ function slash( commands, sender ){ } } if (__plugin.bukkit){ - server.dispatchCommand(sender, commands); + if (!sender){ + // if sender is not specified assume server console + server.dispatchCommand(server.consoleSender, commands); + } else { + server.dispatchCommand(sender, commands); + } } } module.exports = slash; diff --git a/src/main/js/modules/spawn.js b/src/main/js/modules/spawn.js new file mode 100644 index 000000000..471d9d565 --- /dev/null +++ b/src/main/js/modules/spawn.js @@ -0,0 +1,46 @@ +/*global require, module, __plugin, Packages*/ +'use strict'; +var entities = require('entities'); +/************************************************************************ +## Spawn Module + +Provides a single function to 'spawn' an entity at a given location. + +### Parameters + + * entityType - The type of entity to spawn. This can be a string (see entities module for reference) or a framework-specific object type (see https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/EntityType.html). A list of [all possible entities][ents] functions (equivalent to the EntityType enum). + + * location - where the entity should be spawned. + +[ents]: #entities-module + +### Example + +Using the entities module as a helper, spawn a new polar bear at the world's default spawn location: + +```javascript +var entities = require('entities'), + spawn = require('spawn'); +... +var spawnLocation = world.spawnLocation; +spawn(entities.polar_bear(), spawnLocation); +``` + +This module is in turn used by the Drone's `spawn()` method and the `jsp spawn` command. +***/ +module.exports = function(entityType, location){ + var entityTypeFn; + if (typeof entityType === 'string'){ + entityTypeFn = entities[entityType.toLowerCase()]; + entityType = entityTypeFn(); + } + var world = location.world; + if (__plugin.bukkit){ + world.spawnEntity( location, entityType); + } + if (__plugin.canary){ + var Canary = Packages.net.canarymod.Canary, + entityInstance = Canary.factory().entityFactory.newEntity(entityType, location); + entityInstance.spawn(); + } +}; diff --git a/src/main/js/modules/utils/utils.js b/src/main/js/modules/utils/utils.js index 82ed01f6c..11dd21113 100644 --- a/src/main/js/modules/utils/utils.js +++ b/src/main/js/modules/utils/utils.js @@ -610,8 +610,9 @@ This function returns a javascript array of player names (as javascript strings) ***/ function getPlayersBukkit(){ var result = []; - for (var i = 0; i < server.onlinePlayers.length; i++){ - result.push(server.onlinePlayers[i]); + var players = server.getOnlinePlayers(); + for (var i = 0; i < players.size(); i++){ + result.push(players.get(i)); } return result; } diff --git a/src/main/js/plugins/commando/commando-test.js b/src/main/js/plugins/commando/commando-test.js index 3e535cb1e..cd9b987e9 100644 --- a/src/main/js/plugins/commando/commando-test.js +++ b/src/main/js/plugins/commando/commando-test.js @@ -14,7 +14,7 @@ commando( 'js-time' , function( params, sender ) { i = 0; if ( sender.location ) { for ( ; i < 4; i++ ) { - if ( times.toLowerCase() == time ) { + if ( times[i].toLowerCase() == time ) { sender.location.world.setTime( i * 6000 ); break; } diff --git a/src/main/js/plugins/drone/contrib/spawn.js b/src/main/js/plugins/drone/contrib/spawn.js new file mode 100644 index 000000000..24f86c071 --- /dev/null +++ b/src/main/js/plugins/drone/contrib/spawn.js @@ -0,0 +1,8 @@ +'use strict'; +var spawnFn = require('spawn'), + Drone = require('drone') + ; +function spawn(entityType){ + spawnFn(entityType, this.getBlock().location); +} +Drone.extend(spawn); diff --git a/src/main/js/plugins/entities.js b/src/main/js/plugins/entities.js new file mode 100644 index 000000000..48446df32 --- /dev/null +++ b/src/main/js/plugins/entities.js @@ -0,0 +1,8 @@ +'use strict'; +/*global require, exports*/ +/* + make entities a global variable for use at in-game prompt + Tab completion is a useful way to discover what entity types are available. +*/ +var entities = require('entities'); +exports.entities = entities; diff --git a/src/main/js/plugins/spawn.js b/src/main/js/plugins/spawn.js index dd6272f9a..2ff425ae7 100644 --- a/src/main/js/plugins/spawn.js +++ b/src/main/js/plugins/spawn.js @@ -15,29 +15,18 @@ Allows in-game operators to easily spawn creatures at current location. This command supports TAB completion so to see a list of possible entitities, type `/jsp spawn ' at the in-game command prompt, then press TAB. Visit - (CanaryMod) -or (Bukkit) + (Bukkit/SpigotMC) +or (CanaryMod) for a list of possible entities (creatures) which can be spawned. ***/ -var entities = [], - entityType = null, - entitytypes, - t; -if (__plugin.bukkit) { - entityType = org.bukkit.entity.EntityType; +var entities = require('entities'), + spawn = require('spawn'); +var entityNames = []; +for (var name in entities){ + entityNames.push(name); } -if (__plugin.canary) { - entityType = Packages.net.canarymod.api.entity.EntityType; -} -entitytypes = entityType.values(); -for (t in entitytypes) { - if (entitytypes[t] && entitytypes[t].ordinal) { - entities.push(entitytypes[t].name()); - } -} - command('spawn', function (parameters, sender) { if (!isOp(sender)) { echo(sender, 'Only operators can perform this command'); @@ -48,14 +37,6 @@ command('spawn', function (parameters, sender) { echo(sender, 'You have no location. This command only works in-game.'); return; } - var world = location.world || sender.world, - type = ('' + parameters[0]).toUpperCase(); - if (__plugin.bukkit) { - world.spawnEntity(location, entityType[type]); - } - if (__plugin.canary) { - var Canary = Packages.net.canarymod.Canary, - entity = Canary.factory().entityFactory.newEntity(entityType[type], location); - entity.spawn(); - } -}, entities); + var name = ('' + parameters[0]).toUpperCase(); + spawn( name, sender.location); +}, entityNames);