2015-01-11 01:11:44 +01:00
<!--
IMPORTANT NOTE FOR CONTRIBUTORS
-------------------------------
Contributors: This file is generated from comments in javascript source files src/main/js/*
If you would like to make changes, change the comments in the src/main/js/* files instead.
-->
2013-12-24 23:47:57 +01:00
# ScriptCraft API Reference
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
Walter Higgins
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
[walter.higgins@gmail.com][email]
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
[email]: mailto:walter.higgins@gmail.com?subject=ScriptCraft_API_Reference
2013-12-18 00:49:00 +01:00
2014-01-04 19:39:49 +01:00
## Table of Contents
* [Modules in Scriptcraft ](#modules-in-scriptcraft )
* [Module Loading ](#module-loading )
* [The plugins directory ](#the-plugins-directory )
* [The modules directory ](#the-modules-directory )
* [The lib directory ](#the-lib-directory )
* [plugins sub-directories ](#plugins-sub-directories )
* [Global variables ](#global-variables )
2014-01-04 21:23:17 +01:00
* [__plugin variable ](#__plugin-variable )
2014-01-04 19:39:49 +01:00
* [server variable ](#server-variable )
* [self variable ](#self-variable )
* [config variable ](#config-variable )
* [events variable ](#events-variable )
* [Module variables ](#module-variables )
2014-01-04 21:23:17 +01:00
* [__filename variable ](#__filename-variable )
* [__dirname variable ](#__dirname-variable )
2014-01-04 19:39:49 +01:00
* [Global functions ](#global-functions )
* [echo function ](#echo-function )
* [require() function ](#require-function )
2014-01-13 22:06:17 +01:00
* [scload() function ](#scload-function )
* [scsave() function ](#scsave-function )
2014-01-04 19:39:49 +01:00
* [plugin() function ](#plugin-function )
* [command() function ](#command-function )
* [setTimeout() function ](#settimeout-function )
* [clearTimeout() function ](#cleartimeout-function )
* [setInterval() function ](#setinterval-function )
* [clearInterval() function ](#clearinterval-function )
* [refresh() function ](#refresh-function )
* [addUnloadHandler() function ](#addunloadhandler-function )
2014-10-05 18:29:04 +02:00
* [isOp() function ](#isop-function )
2014-01-04 19:39:49 +01:00
* [require - Node.js-style module loading in ScriptCraft ](#require---nodejs-style-module-loading-in-scriptcraft )
* [math.js ](#mathjs )
* [inc.js ](#incjs )
* [program.js ](#programjs )
* [Important ](#important )
* [module name resolution ](#module-name-resolution )
* [events Module ](#events-module )
* [events.on() static method ](#eventson-static-method )
2015-01-03 21:57:30 +01:00
* [Events Helper Module (canary version) ](#events-helper-module-canary-version )
2014-04-26 17:56:57 +02:00
* [Usage ](#usage )
2015-01-03 21:57:30 +01:00
* [events.minecartActivate() ](#eventsminecartactivate )
* [events.villagerTradeUnlock() ](#eventsvillagertradeunlock )
* [events.mobTarget() ](#eventsmobtarget )
* [events.chickenLayEgg() ](#eventschickenlayegg )
* [events.potionEffectFinish() ](#eventspotioneffectfinish )
* [events.entityMove() ](#eventsentitymove )
* [events.hangingEntityDestroy() ](#eventshangingentitydestroy )
* [events.vehicleCollision() ](#eventsvehiclecollision )
* [events.potionEffectApplied() ](#eventspotioneffectapplied )
* [events.vehicleDestroy() ](#eventsvehicledestroy )
* [events.vehicleEnter() ](#eventsvehicleenter )
* [events.damage() ](#eventsdamage )
* [events.entityMount() ](#eventsentitymount )
* [events.slimeSplit() ](#eventsslimesplit )
* [events.endermanDropBlock() ](#eventsendermandropblock )
* [events.itemTouchGround() ](#eventsitemtouchground )
* [events.entitySpawn() ](#eventsentityspawn )
* [events.endermanPickupBlock() ](#eventsendermanpickupblock )
* [events.vehicleDamage() ](#eventsvehicledamage )
* [events.entityLightningStruck() ](#eventsentitylightningstruck )
* [events.entityDespawn() ](#eventsentitydespawn )
* [events.vehicleMove() ](#eventsvehiclemove )
* [events.projectileHit() ](#eventsprojectilehit )
* [events.entityDeath() ](#eventsentitydeath )
* [events.entityTame() ](#eventsentitytame )
* [events.vehicleExit() ](#eventsvehicleexit )
* [events.dimensionSwitch() ](#eventsdimensionswitch )
* [events.foodLevel() ](#eventsfoodlevel )
* [events.bookEdit() ](#eventsbookedit )
* [events.eat() ](#eventseat )
2015-01-11 01:11:44 +01:00
* [events.playerList() ](#eventsplayerlist )
2015-01-03 21:57:30 +01:00
* [events.playerIdle() ](#eventsplayeridle )
* [events.enchant() ](#eventsenchant )
* [events.playerArmSwing() ](#eventsplayerarmswing )
* [events.teleport() ](#eventsteleport )
* [events.anvilUse() ](#eventsanviluse )
* [events.portalUse() ](#eventsportaluse )
* [events.foodSaturation() ](#eventsfoodsaturation )
* [events.connection() ](#eventsconnection )
* [events.playerRespawned() ](#eventsplayerrespawned )
* [events.armorBroken() ](#eventsarmorbroken )
* [events.levelUp() ](#eventslevelup )
* [events.blockRightClick() ](#eventsblockrightclick )
* [events.itemDrop() ](#eventsitemdrop )
2015-04-04 12:27:14 +02:00
* [events.itemFrameRotate() ](#eventsitemframerotate )
2015-01-03 21:57:30 +01:00
* [events.playerRespawning() ](#eventsplayerrespawning )
* [events.craft() ](#eventscraft )
* [events.experience() ](#eventsexperience )
* [events.signChange() ](#eventssignchange )
* [events.healthChange() ](#eventshealthchange )
* [events.disconnection() ](#eventsdisconnection )
* [events.gameModeChange() ](#eventsgamemodechange )
* [events.preConnection() ](#eventspreconnection )
* [events.villagerTrade() ](#eventsvillagertrade )
* [events.returnFromIdle() ](#eventsreturnfromidle )
2015-04-04 12:27:14 +02:00
* [events.armorStandModify() ](#eventsarmorstandmodify )
2015-01-03 21:57:30 +01:00
* [events.slotClick() ](#eventsslotclick )
2015-04-04 12:27:14 +02:00
* [events.itemFrameSetItem() ](#eventsitemframesetitem )
2015-01-03 21:57:30 +01:00
* [events.entityRightClick() ](#eventsentityrightclick )
* [events.foodExhaustion() ](#eventsfoodexhaustion )
* [events.chat() ](#eventschat )
* [events.itemPickup() ](#eventsitempickup )
* [events.bedExit() ](#eventsbedexit )
* [events.blockPlace() ](#eventsblockplace )
2015-02-21 11:19:51 +01:00
* [events.heldItemChange() ](#eventshelditemchange )
2015-01-03 21:57:30 +01:00
* [events.toolBroken() ](#eventstoolbroken )
* [events.kick() ](#eventskick )
* [events.playerDeath() ](#eventsplayerdeath )
* [events.blockLeftClick() ](#eventsblockleftclick )
* [events.blockDestroy() ](#eventsblockdestroy )
* [events.bedEnter() ](#eventsbedenter )
* [events.signShow() ](#eventssignshow )
* [events.inventory() ](#eventsinventory )
* [events.playerMove() ](#eventsplayermove )
* [events.itemUse() ](#eventsitemuse )
* [events.ban() ](#eventsban )
* [events.statGained() ](#eventsstatgained )
* [events.smeltBegin() ](#eventssmeltbegin )
* [events.treeGrow() ](#eventstreegrow )
* [events.chunkCreated() ](#eventschunkcreated )
* [events.liquidDestroy() ](#eventsliquiddestroy )
* [events.chunkLoaded() ](#eventschunkloaded )
* [events.pistonRetract() ](#eventspistonretract )
* [events.smelt() ](#eventssmelt )
* [events.blockUpdate() ](#eventsblockupdate )
* [events.portalDestroy() ](#eventsportaldestroy )
* [events.ignition() ](#eventsignition )
* [events.redstoneChange() ](#eventsredstonechange )
2014-11-09 12:52:10 +01:00
* [events.weatherChange() ](#eventsweatherchange )
2015-01-03 21:57:30 +01:00
* [events.chunkCreation() ](#eventschunkcreation )
* [events.hopperTransfer() ](#eventshoppertransfer )
* [events.chunkUnload() ](#eventschunkunload )
* [events.blockGrow() ](#eventsblockgrow )
* [events.dispense() ](#eventsdispense )
* [events.blockDropXp() ](#eventsblockdropxp )
* [events.fireworkExplode() ](#eventsfireworkexplode )
* [events.leafDecay() ](#eventsleafdecay )
* [events.pistonExtend() ](#eventspistonextend )
* [events.noteBlockPlay() ](#eventsnoteblockplay )
2014-11-09 12:52:10 +01:00
* [events.lightningStrike() ](#eventslightningstrike )
2015-01-03 21:57:30 +01:00
* [events.decorate() ](#eventsdecorate )
* [events.explosion() ](#eventsexplosion )
* [events.tNTActivate() ](#eventstntactivate )
* [events.timeChange() ](#eventstimechange )
* [events.flow() ](#eventsflow )
* [events.portalCreate() ](#eventsportalcreate )
* [events.blockPhysics() ](#eventsblockphysics )
* [events.playerCommand() ](#eventsplayercommand )
* [events.consoleCommand() ](#eventsconsolecommand )
* [events.commandBlockCommand() ](#eventscommandblockcommand )
* [events.loadWorld() ](#eventsloadworld )
* [events.permissionCheck() ](#eventspermissioncheck )
* [events.serverGuiStart() ](#eventsserverguistart )
* [events.unloadWorld() ](#eventsunloadworld )
* [events.pluginDisable() ](#eventsplugindisable )
* [events.pluginEnable() ](#eventspluginenable )
* [events.serverTick() ](#eventsservertick )
* [events.serverListPing() ](#eventsserverlistping )
* [events.serverShutdown() ](#eventsservershutdown )
* [Events Helper Module (bukkit version) ](#events-helper-module-bukkit-version )
* [Usage ](#usage-1 )
* [events.weatherChange() ](#eventsweatherchange-1 )
* [events.lightningStrike() ](#eventslightningstrike-1 )
2014-11-09 12:52:10 +01:00
* [events.thunderChange() ](#eventsthunderchange )
2015-01-03 21:57:30 +01:00
* [events.vehicleMove() ](#eventsvehiclemove-1 )
* [events.vehicleDestroy() ](#eventsvehicledestroy-1 )
* [events.vehicleExit() ](#eventsvehicleexit-1 )
2014-11-09 12:52:10 +01:00
* [events.vehicleEntityCollision() ](#eventsvehicleentitycollision )
* [events.vehicleBlockCollision() ](#eventsvehicleblockcollision )
2015-01-03 21:57:30 +01:00
* [events.vehicleEnter() ](#eventsvehicleenter-1 )
* [events.vehicleDamage() ](#eventsvehicledamage-1 )
2014-11-09 12:52:10 +01:00
* [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.playerChat() ](#eventsplayerchat )
* [events.playerShearEntity() ](#eventsplayershearentity )
* [events.asyncPlayerChat() ](#eventsasyncplayerchat )
* [events.playerDropItem() ](#eventsplayerdropitem )
* [events.playerRegisterChannel() ](#eventsplayerregisterchannel )
2015-01-03 21:57:30 +01:00
* [events.playerMove() ](#eventsplayermove-1 )
2014-11-09 12:52:10 +01:00
* [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.playerPreLogin() ](#eventsplayerprelogin )
* [events.playerJoin() ](#eventsplayerjoin )
* [events.playerAnimation() ](#eventsplayeranimation )
* [events.playerEditBook() ](#eventsplayereditbook )
* [events.playerPickupItem() ](#eventsplayerpickupitem )
* [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.inventoryDrag() ](#eventsinventorydrag )
* [events.craftItem() ](#eventscraftitem )
* [events.furnaceBurn() ](#eventsfurnaceburn )
* [events.inventoryOpen() ](#eventsinventoryopen )
* [events.inventoryPickupItem() ](#eventsinventorypickupitem )
* [events.inventoryMoveItem() ](#eventsinventorymoveitem )
* [events.inventoryClick() ](#eventsinventoryclick )
* [events.inventoryClose() ](#eventsinventoryclose )
* [events.inventoryCreative() ](#eventsinventorycreative )
2015-01-03 21:57:30 +01:00
* [events.inventory() ](#eventsinventory-1 )
2014-11-09 12:52:10 +01:00
* [events.prepareItemCraft() ](#eventsprepareitemcraft )
* [events.furnaceExtract() ](#eventsfurnaceextract )
* [events.brew() ](#eventsbrew )
* [events.serverCommand() ](#eventsservercommand )
2015-01-03 21:57:30 +01:00
* [events.serverListPing() ](#eventsserverlistping-1 )
2014-11-09 12:52:10 +01:00
* [events.serviceRegister() ](#eventsserviceregister )
2015-01-03 21:57:30 +01:00
* [events.pluginDisable() ](#eventsplugindisable-1 )
2014-11-09 12:52:10 +01:00
* [events.remoteServerCommand() ](#eventsremoteservercommand )
* [events.mapInitialize() ](#eventsmapinitialize )
* [events.serviceUnregister() ](#eventsserviceunregister )
2015-01-03 21:57:30 +01:00
* [events.pluginEnable() ](#eventspluginenable-1 )
* [events.playerDeath() ](#eventsplayerdeath-1 )
2014-11-09 12:52:10 +01:00
* [events.entityCreatePortal() ](#eventsentitycreateportal )
* [events.entityCombust() ](#eventsentitycombust )
* [events.sheepDyeWool() ](#eventssheepdyewool )
* [events.expBottle() ](#eventsexpbottle )
2015-01-03 21:57:30 +01:00
* [events.entityTame() ](#eventsentitytame-1 )
2014-11-09 12:52:10 +01:00
* [events.projectileLaunch() ](#eventsprojectilelaunch )
* [events.entityDamage() ](#eventsentitydamage )
* [events.itemSpawn() ](#eventsitemspawn )
2015-01-03 21:57:30 +01:00
* [events.projectileHit() ](#eventsprojectilehit-1 )
2014-11-09 12:52:10 +01:00
* [events.foodLevelChange() ](#eventsfoodlevelchange )
* [events.itemDespawn() ](#eventsitemdespawn )
* [events.entityPortalEnter() ](#eventsentityportalenter )
* [events.entityPortal() ](#eventsentityportal )
* [events.entityTarget() ](#eventsentitytarget )
2015-01-03 21:57:30 +01:00
* [events.entityDeath() ](#eventsentitydeath-1 )
2014-11-09 12:52:10 +01:00
* [events.sheepRegrowWool() ](#eventssheepregrowwool )
* [events.entityShootBow() ](#eventsentityshootbow )
* [events.creeperPower() ](#eventscreeperpower )
* [events.entityCombustByBlock() ](#eventsentitycombustbyblock )
* [events.entityBreakDoor() ](#eventsentitybreakdoor )
* [events.entityDamageByEntity() ](#eventsentitydamagebyentity )
* [events.entityUnleash() ](#eventsentityunleash )
* [events.entityExplode() ](#eventsentityexplode )
* [events.entityInteract() ](#eventsentityinteract )
* [events.explosionPrime() ](#eventsexplosionprime )
* [events.horseJump() ](#eventshorsejump )
* [events.creatureSpawn() ](#eventscreaturespawn )
* [events.entityCombustByEntity() ](#eventsentitycombustbyentity )
* [events.entityDamageByBlock() ](#eventsentitydamagebyblock )
* [events.entityTargetLivingEntity() ](#eventsentitytargetlivingentity )
* [events.entityTeleport() ](#eventsentityteleport )
* [events.playerLeashEntity() ](#eventsplayerleashentity )
2015-01-03 21:57:30 +01:00
* [events.slimeSplit() ](#eventsslimesplit-1 )
2014-11-09 12:52:10 +01:00
* [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.notePlay() ](#eventsnoteplay )
* [events.blockFade() ](#eventsblockfade )
2015-01-03 21:57:30 +01:00
* [events.blockPlace() ](#eventsblockplace-1 )
* [events.blockPhysics() ](#eventsblockphysics-1 )
2014-11-09 12:52:10 +01:00
* [events.blockIgnite() ](#eventsblockignite )
* [events.blockBreak() ](#eventsblockbreak )
* [events.blockBurn() ](#eventsblockburn )
* [events.blockFromTo() ](#eventsblockfromto )
* [events.blockRedstone() ](#eventsblockredstone )
* [events.blockPistonRetract() ](#eventsblockpistonretract )
* [events.blockDispense() ](#eventsblockdispense )
2015-01-03 21:57:30 +01:00
* [events.signChange() ](#eventssignchange-1 )
2014-11-09 12:52:10 +01:00
* [events.blockPistonExtend() ](#eventsblockpistonextend )
* [events.blockCanBuild() ](#eventsblockcanbuild )
2015-01-03 21:57:30 +01:00
* [events.blockGrow() ](#eventsblockgrow-1 )
2014-11-09 12:52:10 +01:00
* [events.leavesDecay() ](#eventsleavesdecay )
* [events.blockExp() ](#eventsblockexp )
* [events.blockForm() ](#eventsblockform )
* [events.blockDamage() ](#eventsblockdamage )
* [events.hangingPlace() ](#eventshangingplace )
* [events.hangingBreakByEntity() ](#eventshangingbreakbyentity )
* [events.hangingBreak() ](#eventshangingbreak )
* [events.structureGrow() ](#eventsstructuregrow )
* [events.spawnChange() ](#eventsspawnchange )
* [events.worldLoad() ](#eventsworldload )
* [events.worldInit() ](#eventsworldinit )
* [events.worldUnload() ](#eventsworldunload )
* [events.worldSave() ](#eventsworldsave )
2015-01-03 21:57:30 +01:00
* [events.chunkUnload() ](#eventschunkunload-1 )
2014-11-09 12:52:10 +01:00
* [events.chunkPopulate() ](#eventschunkpopulate )
2015-01-03 21:57:30 +01:00
* [events.portalCreate() ](#eventsportalcreate-1 )
2014-11-09 12:52:10 +01:00
* [events.chunkLoad() ](#eventschunkload )
2015-01-03 21:57:30 +01:00
* [console global variable ](#console-global-variable )
* [Example ](#example )
* [Using string substitutions ](#using-string-substitutions )
2014-01-04 19:39:49 +01:00
* [Drone Plugin ](#drone-plugin )
* [Constructing a Drone Object ](#constructing-a-drone-object )
* [Drone.box() method ](#dronebox-method )
* [Drone.box0() method ](#dronebox0-method )
* [Drone.boxa() method ](#droneboxa-method )
* [Chaining ](#chaining )
* [Drone Properties ](#drone-properties )
* [Extending Drone ](#extending-drone )
* [Drone.extend() static method ](#droneextend-static-method )
* [Drone Constants ](#drone-constants )
* [Drone.times() Method ](#dronetimes-method )
2014-12-28 16:07:32 +01:00
* [Drone.arc() method ](#dronearc-method )
2015-01-01 13:53:11 +01:00
* [Drone.bed() method ](#dronebed-method )
2014-01-04 19:39:49 +01:00
* [Drone.blocktype() method ](#droneblocktype-method )
2014-12-28 16:07:32 +01:00
* [Copy & Paste using Drone ](#copy--paste-using-drone )
* [Drone.copy() method ](#dronecopy-method )
* [Drone.paste() method ](#dronepaste-method )
* [Drone.cylinder() method ](#dronecylinder-method )
* [Drone.cylinder0() method ](#dronecylinder0-method )
* [Drone.door() method ](#dronedoor-method )
* [Drone.door_iron() method ](#dronedoor_iron-method )
* [Drone.door2() method ](#dronedoor2-method )
* [Drone.door2_iron() method ](#dronedoor2_iron-method )
2015-01-03 21:57:30 +01:00
* [Drone.firework() method ](#dronefirework-method )
2014-12-28 16:07:32 +01:00
* [Drone.garden() method ](#dronegarden-method )
2014-12-30 15:54:38 +01:00
* [Drone.ladder() method ](#droneladder-method )
2014-12-28 16:07:32 +01:00
* [Drone Movement ](#drone-movement )
* [Drone Positional Info ](#drone-positional-info )
* [Drone Markers ](#drone-markers )
* [Drone.prism() method ](#droneprism-method )
* [Drone.prism0() method ](#droneprism0-method )
* [Drone.rand() method ](#dronerand-method )
2014-12-30 15:54:38 +01:00
* [Drone.wallsign() method ](#dronewallsign-method )
* [Drone.signpost() method ](#dronesignpost-method )
2014-12-28 16:07:32 +01:00
* [Drone.sign() method ](#dronesign-method )
2014-01-04 19:39:49 +01:00
* [Drone.sphere() method ](#dronesphere-method )
* [Drone.sphere0() method ](#dronesphere0-method )
* [Drone.hemisphere() method ](#dronehemisphere-method )
* [Drone.hemisphere0() method ](#dronehemisphere0-method )
2014-12-28 16:07:32 +01:00
* [Drone.stairs() function ](#dronestairs-function )
* [Drone Trees methods ](#drone-trees-methods )
2015-01-16 22:20:34 +01:00
* [Drone.castle() method ](#dronecastle-method )
* [Drone.chessboard() method ](#dronechessboard-method )
* [Drone.cottage() method ](#dronecottage-method )
* [Drone.cottage_road() method ](#dronecottage_road-method )
* [Drone.dancefloor() method ](#dronedancefloor-method )
* [Drone.fort() method ](#dronefort-method )
* [Drone.hangtorch() method ](#dronehangtorch-method )
* [Drone.lcdclock() method. ](#dronelcdclock-method )
* [Drone.logojs() method ](#dronelogojs-method )
* [Drone.maze() method ](#dronemaze-method )
2015-01-03 21:57:30 +01:00
* [Drone.rainbow() method ](#dronerainbow-method )
* [Drone.spiral_stairs() method ](#dronespiral_stairs-method )
2015-01-16 22:20:34 +01:00
* [Drone.temple() method ](#dronetemple-method )
2015-01-25 20:11:37 +01:00
* [The at Module ](#the-at-module )
* [at() function ](#at-function )
2015-01-03 21:57:30 +01:00
* [Blocks Module ](#blocks-module )
* [Examples ](#examples )
* [Fireworks Module ](#fireworks-module )
* [Examples ](#examples-1 )
2015-03-22 15:05:19 +01:00
* [Inventory Module ](#inventory-module )
* [Usage ](#usage-2 )
2015-01-24 20:42:52 +01:00
* [Classroom Plugin ](#classroom-plugin )
* [jsp classroom command ](#jsp-classroom-command )
* [classroom.allowScripting() function ](#classroomallowscripting-function )
2015-01-03 21:57:30 +01:00
* [Asynchronous Input Module ](#asynchronous-input-module )
* [The recipes module ](#the-recipes-module )
* [Example ](#example-1 )
* [Http Module ](#http-module )
* [http.request() function ](#httprequest-function )
* [sc-mqtt module ](#sc-mqtt-module )
2015-03-22 15:05:19 +01:00
* [Usage ](#usage-3 )
2015-01-03 21:57:30 +01:00
* [Signs Module ](#signs-module )
* [signs.menu() function ](#signsmenu-function )
* [signs.getTargetedBy() function ](#signsgettargetedby-function )
2015-01-25 20:11:37 +01:00
* [The slash Module ](#the-slash-module )
* [The slash() function ](#the-slash-function )
2015-01-03 21:57:30 +01:00
* [Sounds Module ](#sounds-module )
* [Usage (Bukkit) : ](#usage-bukkit- )
2015-01-17 10:31:14 +01:00
* [Teleport Module ](#teleport-module )
* [Parameters ](#parameters )
* [Example ](#example-2 )
2015-01-03 21:57:30 +01:00
* [Utilities Module ](#utilities-module )
* [utils.player() function ](#utilsplayer-function )
2015-01-11 01:11:44 +01:00
* [utils.world( worldName ) function ](#utilsworld-worldname--function )
* [utils.blockAt( Location ) function ](#utilsblockat-location--function )
2015-01-03 21:57:30 +01:00
* [utils.locationToJSON() function ](#utilslocationtojson-function )
* [utils.locationToString() function ](#utilslocationtostring-function )
* [utils.locationFromJSON() function ](#utilslocationfromjson-function )
* [utils.getPlayerPos() function ](#utilsgetplayerpos-function )
* [utils.getMousePos() function ](#utilsgetmousepos-function )
* [utils.foreach() function ](#utilsforeach-function )
* [utils.nicely() function ](#utilsnicely-function )
2015-01-11 13:27:47 +01:00
* [utils.time( world ) function ](#utilstime-world--function )
* [utils.time24( world ) function ](#utilstime24-world--function )
2015-01-03 21:57:30 +01:00
* [utils.find() function ](#utilsfind-function )
* [utils.serverAddress() function ](#utilsserveraddress-function )
* [utils.array() function ](#utilsarray-function )
* [utils.players() function ](#utilsplayers-function )
* [utils.playerNames() function ](#utilsplayernames-function )
* [utils.stat() function ](#utilsstat-function )
2015-01-25 20:11:37 +01:00
* [The watcher Module ](#the-watcher-module )
* [watcher.watchFile() function ](#watcherwatchfile-function )
* [watcher.watchDir() function ](#watcherwatchdir-function )
* [watcher.unwatchFile() function ](#watcherunwatchfile-function )
* [watcher.unwatchDir() function ](#watcherunwatchdir-function )
2014-01-04 19:39:49 +01:00
* [Example Plugin #1 - A simple extension to Minecraft. ](#example-plugin-1---a-simple-extension-to-minecraft )
2014-10-05 18:29:04 +02:00
* [Usage: ](#usage-4 )
2015-03-22 15:05:19 +01:00
* [Example Plugin #2 - Making extensions available for all players. ](#example-plugin-2---making-extensions-available-for-all-players )
2014-10-05 18:29:04 +02:00
* [Usage: ](#usage-5 )
2015-03-22 15:05:19 +01:00
* [Example Plugin #3 - Limiting use of commands to operators only. ](#example-plugin-3---limiting-use-of-commands-to-operators-only )
2014-10-05 18:29:04 +02:00
* [Usage: ](#usage-6 )
2015-03-22 15:05:19 +01:00
* [Example Plugin #4 - Using parameters in commands. ](#example-plugin-4---using-parameters-in-commands )
2014-10-05 18:29:04 +02:00
* [Usage: ](#usage-7 )
2015-03-22 15:05:19 +01:00
* [Example Plugin #5 - Re-use - Using your own and others modules. ](#example-plugin-5---re-use---using-your-own-and-others-modules )
2014-11-09 12:52:10 +01:00
* [Usage: ](#usage-8 )
2015-03-22 15:05:19 +01:00
* [Example Plugin #6 - Re-use - Using 'utils' to get Player objects. ](#example-plugin-6---re-use---using-utils-to-get-player-objects )
* [Usage: ](#usage-9 )
2014-01-04 19:39:49 +01:00
* [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 )
2015-03-22 15:05:19 +01:00
* [Usage: ](#usage-10 )
2014-01-12 12:26:26 +01:00
* [Spawn Plugin ](#spawn-plugin )
2015-03-22 15:05:19 +01:00
* [Usage ](#usage-11 )
2014-01-04 19:39:49 +01:00
* [alias Plugin ](#alias-plugin )
2014-01-06 21:54:53 +01:00
* [Examples ](#examples-2 )
2014-01-04 19:39:49 +01:00
* [Commando Plugin ](#commando-plugin )
* [Description ](#description )
* [Example hi-command.js ](#example-hi-commandjs )
* [Example - timeofday-command.js ](#example---timeofday-commandjs )
* [Caveats ](#caveats )
* [homes Plugin ](#homes-plugin )
* [Basic options ](#basic-options )
* [Social options ](#social-options )
* [Administration options ](#administration-options )
* [NumberGuess mini-game: ](#numberguess-mini-game )
2014-01-06 21:54:53 +01:00
* [Description ](#description-1 )
2015-01-17 10:31:14 +01:00
* [Example ](#example-3 )
2014-01-12 12:26:26 +01:00
* [Cow Clicker Mini-Game ](#cow-clicker-mini-game )
* [How to Play ](#how-to-play )
* [Rules ](#rules )
* [Gameplay Mechanics ](#gameplay-mechanics )
2014-10-05 18:29:04 +02:00
* [Items module ](#items-module )
2015-03-22 15:05:19 +01:00
* [Usage ](#usage-12 )
2014-01-04 19:39:49 +01:00
2013-12-24 23:47:57 +01:00
## Modules in Scriptcraft
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
ScriptCraft has a simple module loading system. In ScriptCraft, files
and modules are in one-to-one correspondence. As an example, foo.js
loads the module circle.js in the same directory.
*ScriptCraft now uses the same module system as Node.js - see [Node.js Modules][njsmod] for more details.*
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
[njsmod]: http://nodejs.org/api/modules.html
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
The contents of foo.js:
2013-12-18 00:49:00 +01:00
2014-02-04 22:36:00 +01:00
```javascript
var circle = require('./circle.js');
console.log( 'The area of a circle of radius 4 is '
+ circle.area(4));
```
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
The contents of circle.js:
2014-02-04 22:36:00 +01:00
```javascript
var PI = Math.PI;
exports.area = function (r) {
return PI * r * r;
};
exports.circumference = function (r) {
return 2 * PI * r;
};
```
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
The module circle.js has exported the functions area() and
circumference(). To add functions and objects to the root of your
module, you can add them to the special exports object.
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
Variables local to the module will be private, as though the module
was wrapped in a function. In this example the variable PI is private
to circle.js.
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
If you want the root of your module's export to be a function (such as
a constructor) or if you want to export a complete object in one
assignment instead of building it one property at a time, assign it to
module.exports instead of exports.
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
## Module Loading
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
When the ScriptCraft Java plugin is first installed, a new
2014-12-31 12:15:28 +01:00
`scriptcraft` subdirectory is created. If your minecraft server
directory is called 'mcserver' then the new subdirectories will be ...
2013-12-18 00:49:00 +01:00
2014-12-31 12:15:28 +01:00
* mcserver/scriptcraft/
* mcserver/scriptcraft/plugins
* mcserver/scriptcraft/modules
* mcserver/scriptcraft/lib
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
... The `plugins` , `modules` and `lib` directories each serve a different purpose.
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
### The plugins directory
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
At server startup the ScriptCraft Java plugin is loaded and begins
automatically loading and executing all of the modules (javascript
files with the extension `.js` ) it finds in the `scriptcraft/plugins`
directory. All modules in the plugins directory are automatically
loaded into the `global` namespace. What this means is that anything a
module in the `plugins` directory exports becomes a global
variable. For example, if you have a module greeting.js in the plugins
directory....
2013-12-18 00:49:00 +01:00
2014-02-04 22:36:00 +01:00
```javascript
exports.greet = function(player) {
2014-10-05 18:29:04 +02:00
echo(player, 'Hello ' + player.name);
2014-02-04 22:36:00 +01:00
};
```
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
... then `greet` becomes a global function and can be used at the
in-game (or server) command prompt like so...
2013-12-30 22:33:12 +01:00
/js greet(self)
2013-12-24 23:47:57 +01:00
... This differs from how modules (in NodeJS and commonJS
environments) normally work. If you want your module to be exported
globally, put it in the `plugins` directory. If you don't want your
module to be exported globally but only want it to be used by other
modules, then put it in the `modules` directory instead. If you've
used previous versions of ScriptCraft and have put your custom
javascript modules in the `js-plugins` directory, then put them in the
`scriptcraft/plugins` directory. To summarise, modules in this directory are ...
* Automatically loaded and run at server startup.
* Anything exported by modules becomes a global variable.
### The modules directory
The module directory is where you should place your modules if you
don't want to export globally. In javascript, it's considered best
practice not to have too many global variables, so if you want to
develop modules for others to use, or want to develop more complex
mods then your modules should be placed in the `modules` directory.
*Modules in the `modules` directory are not automatically loaded at
startup*, instead, they are loaded and used by other modules/plugins
using the standard `require()` function. This is the key difference
between modules in the `plugins` directory and modules in the
`modules` directory. Modules in the `plugins` directory are
automatically loaded and exported in to the global namespace at server
startup, modules in the `modules` directory are not.
### The lib directory
Modules in the `lib` directory are for use by ScriptCraft and some
core functions for use by module and plugin developers are also
provided. The `lib` directory is for internal use by ScriptCraft.
Modules in this directory are not automatically loaded nor are they
globally exported.
2013-12-18 00:49:00 +01:00
2013-12-28 09:44:40 +01:00
### plugins sub-directories
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
As of December 24 2013, the `scriptcraft/plugins` directory has the following sub-directories...
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
* drone - Contains the drone module and drone extensions. Drone was the first scriptcraft module.
* mini-games - Contains mini-games
2013-12-28 09:44:40 +01:00
* arrows - The arrows module - Changes the behaviour of Arrows: Explosive, Fireworks, Teleportation etc.
* signs - The signs module (includes example signs) - create interactive signs.
* chat - The chat plugin/module
2014-06-14 16:45:44 +02:00
* alias - The alias plugin/module - for creating custom aliases for commonly-used commands.
2013-12-24 23:47:57 +01:00
* home - The home module - for setting homes and visiting other homes.
2013-12-18 00:49:00 +01:00
2013-12-28 23:49:13 +01:00
## Global variables
There are a couple of special javascript variables available in ScriptCraft...
### __plugin variable
The ScriptCraft JavaPlugin object.
### server variable
The Minecraft Server object
### self variable
2014-06-14 16:45:44 +02:00
The current player. (Note - this value should not be used in multi-threaded scripts or event-handling code - it's not thread-safe). This variable is only safe to use at the in-game prompt and should *never* be used in modules. For example you can use it here...
2013-12-30 22:33:12 +01:00
/js console.log(self.name)
... but not in any javascript module you create yourself or in any
event handling code. `self` is a temporary short-lived variable which
only exists in the context of the in-game or server command prompts.
2013-12-28 23:49:13 +01:00
### config variable
ScriptCraft configuration - this object is loaded and saved at startup/shutdown.
### events variable
The events object is used to add new event handlers to Minecraft.
## Module variables
The following variables are available only within the context of Modules. (not available at in-game prompt).
2014-01-04 19:39:49 +01:00
### __filename variable
2013-12-28 23:49:13 +01:00
The current file - this variable is only relevant from within the context of a Javascript module.
2014-01-04 19:39:49 +01:00
### __dirname variable
2013-12-28 23:49:13 +01:00
The current directory - this variable is only relevant from within the context of a Javascript module.
2013-12-28 09:44:40 +01:00
## Global functions
2013-12-18 00:49:00 +01:00
2013-12-28 09:44:40 +01:00
ScripCraft provides some global functions which can be used by all plugins/modules...
2013-12-18 00:49:00 +01:00
2013-12-28 09:44:40 +01:00
### echo function
2014-10-05 18:29:04 +02:00
The `echo()` function displays a message on the in-game screen.
2013-12-28 09:44:40 +01:00
2014-01-04 19:39:49 +01:00
#### Example
2013-12-28 09:44:40 +01:00
2014-10-05 18:29:04 +02:00
/js echo( self, 'Hello World')
2013-12-28 09:44:40 +01:00
2013-12-28 23:49:13 +01:00
For programmers familiar with Javascript web programming, an `alert`
function is also provided. `alert` works exactly the same as `echo`
2014-10-05 18:29:04 +02:00
e.g. `alert( self, 'Hello World')` .
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
### require() function
2013-12-18 00:49:00 +01:00
2014-06-14 16:45:44 +02:00
ScriptCraft's `require()` function is used to load modules. The `require()` function takes a module name as a parameter and will try to load the named module.
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
#### Parameters
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
* modulename - The name of the module to be loaded. Can be one of the following...
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
- A relative file path (with or without `.js` suffix)
- An absolute file path (with or without `.js` suffix)
- A relative directory path (uses node.js rules for directories)
- An absolute directory path (uses node.js rules for directories)
- A name of the form `'events'` - in which case the `lib` directory and `modules` directories are searched for the module.
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
#### Return
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
require() will return the loaded module's exports.
2013-12-18 00:49:00 +01:00
2014-01-13 22:06:17 +01:00
### scload() function
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
#### No longer recommended for use by Plugin/Module developers (deprecated)
2013-12-18 00:49:00 +01:00
2014-01-13 22:06:17 +01:00
scload() should only be used to load .json data.
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
#### Parameters
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
* filename - The name of the file to load.
* warnOnFileNotFound (optional - default: false) - warn if the file was not found.
2013-12-18 00:49:00 +01:00
2013-12-28 09:44:40 +01:00
#### Returns
2013-12-18 00:49:00 +01:00
2014-01-13 22:06:17 +01:00
scload() will return the result of the last statement evaluated in the file.
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
#### Example
2013-12-21 09:58:40 +01:00
2014-01-13 22:06:17 +01:00
scload("myFile.js"); // loads a javascript file and evaluates it.
2013-12-21 09:58:40 +01:00
2014-01-13 22:06:17 +01:00
var myData = scload("myData.json"); // loads a javascript file and evaluates it - eval'd contents are returned.
2013-12-21 10:10:59 +01:00
2014-01-04 19:39:49 +01:00
##### myData.json contents...
2013-12-21 09:58:40 +01:00
2014-01-04 19:39:49 +01:00
{ players: {
walterh: {
h: ["jsp home {1}"],
sunny:["time set 0",
"weather clear"]
}
}
}
2013-12-21 09:58:40 +01:00
2014-01-13 22:06:17 +01:00
### scsave() function
2013-12-21 09:58:40 +01:00
2014-01-13 22:06:17 +01:00
The scsave() function saves an in-memory javascript object to a
specified file. Under the hood, scsave() uses JSON (specifically
2015-04-11 11:43:33 +02:00
json2.js) to save the object. There will usually be no need to call
this function directly - If you want to have a javascript object
automatically loaded at startup and saved on shutdown then use the
`persist()` module. The `persist()` module uses scsave and scload
under the hood. Any in-memory object saved using the `scsave()`
function can later be restored using the `scload()` function.
2013-12-21 09:58:40 +01:00
2013-12-24 23:47:57 +01:00
#### Parameters
2013-12-21 09:58:40 +01:00
2013-12-24 23:47:57 +01:00
* objectToSave : The object you want to save.
* filename : The name of the file you want to save it to.
2013-12-21 09:58:40 +01:00
2013-12-24 23:47:57 +01:00
#### Example
2013-12-21 09:58:40 +01:00
2014-02-04 22:36:00 +01:00
```javascript
var myObject = { name: 'John Doe',
aliases: ['John Ray', 'John Mee'],
date_of_birth: '1982/01/31' };
scsave(myObject, 'johndoe.json');
```
2013-12-21 09:58:40 +01:00
2014-01-04 19:39:49 +01:00
##### johndoe.json contents...
2013-12-21 09:58:40 +01:00
2014-01-04 19:39:49 +01:00
{ "name": "John Doe",
"aliases": ["John Ray", "John Mee"],
"date_of_birth": "1982/01/31"
};
2013-12-21 09:58:40 +01:00
2013-12-24 23:47:57 +01:00
### plugin() function
2013-12-21 09:58:40 +01:00
2015-04-11 11:43:33 +02:00
#### Update April 2015
The `plugin()` function is deprecated. Please refer to [Anatomy of a
ScriptCraft Plugin][anatomy] for an up-to-date step-by-step guide to
creating a plugin which uses persistence (loading and saving data).
#### Deprecated
2013-12-24 23:47:57 +01:00
The `plugin()` function should be used to declare a javascript module
whose state you want to have managed by ScriptCraft - that is - a
Module whose state will be loaded at start up and saved at shut down.
A plugin is just a regular javascript object whose state is managed by
ScriptCraft. The only member of the plugin which whose persistence is
managed by Scriptcraft is `store` - this special member will be
automatically saved at shutdown and loaded at startup by
ScriptCraft. This makes it easier to write plugins which need to
persist data.
2013-12-21 09:58:40 +01:00
2013-12-24 23:47:57 +01:00
#### Parameters
* pluginName (String) : The name of the plugin - this becomes a global variable.
* pluginDefinition (Object) : The various functions and members of the plugin object.
2013-12-28 23:49:13 +01:00
* isPersistent (boolean - optional) : Specifies whether or not the
plugin/object state should be loaded and saved by ScriptCraft.
2013-12-21 10:10:59 +01:00
2013-12-24 23:47:57 +01:00
#### Example
2013-12-21 10:10:59 +01:00
2013-12-24 23:47:57 +01:00
See chat/color.js for an example of a simple plugin - one which lets
players choose a default chat color. See also [Anatomy of a
ScriptCraft Plugin][anatomy].
2014-01-02 19:46:46 +01:00
[anatomy]: ./Anatomy-of-a-Plugin.md
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
### command() function
2013-12-18 00:49:00 +01:00
2014-06-14 16:45:44 +02:00
The `command()` function is used to expose javascript functions for use by non-operators (regular players). Only operators should be allowed use raw javascript using the `/js ` command because it is too powerful for use by regular players and can be easily abused. However, the `/jsp ` command lets you (the operator / server administrator / plugin author) safely expose javascript functions for use by players.
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
#### Parameters
2014-06-14 16:45:44 +02:00
* commandFunction: The named javascript function which will be invoked when the command is invoked by a player. The name of the function will be used as the command name so name this function accordingly. The callback function in turn takes 2 parameters...
* params : An Array of type String - the list of parameters passed to the command.
* sender : The [CommandSender][bukcs] object that invoked the command (this is usually a Player object but can be a Block ([BlockCommandSender][bukbcs]).
2014-06-14 16:47:13 +02:00
* options (Array|Function - optional) : An array of command options/parameters which the player can supply (It's useful to supply an array so that Tab-Completion works for the `/jsp ` commands. If a function is supplied instead of an array then the function will be invoked at TAB-completion time and should return an array of strings.
2014-06-14 16:45:44 +02:00
* intercepts (boolean - optional) : Indicates whether this command can intercept Tab-Completion of the `/jsp ` command - advanced usage - see alias/alias.js for example.
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
#### Example
2013-12-18 00:49:00 +01:00
2014-06-14 16:45:44 +02:00
// javascript code
function boo( params, sender) {
2014-10-05 18:29:04 +02:00
echo( sender, params[0] );
2014-06-14 16:45:44 +02:00
}
command( boo );
# in-game execution
/jsp boo Hi!
> Hi!
2014-06-14 16:47:13 +02:00
To use a callback for options (TAB-Completion) ...
2014-12-31 12:15:28 +01:00
var utils = require('utils');
2014-06-14 16:47:13 +02:00
function boo( params, sender ) {
var receiver = server.getPlayer( params[0] );
if ( receiver ){
2014-10-05 18:29:04 +02:00
echo( receiver, sender.name + ' says boo!');
2014-06-14 16:47:13 +02:00
}
}
2014-12-31 12:15:28 +01:00
command( boo, utils.playerNames );
2014-06-14 16:47:13 +02:00
2014-06-14 16:45:44 +02:00
See chat/colors.js or alias/alias.js or homes/homes.js for more examples of how to use the `command()` function.
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
### setTimeout() function
2013-12-18 00:49:00 +01:00
2014-10-05 18:29:04 +02:00
This function mimics the setTimeout() function used in browser-based javascript. However, the function will only accept a function reference, not a string of javascript code. Where setTimeout() in the browser returns a numeric value which can be subsequently passed to clearTimeout(), This implementation returns an object which can be subsequently passed to ScriptCraft's own clearTimeout() implementation.
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
If Node.js supports setTimeout() then it's probably good for ScriptCraft to support it too.
2013-12-24 01:15:17 +01:00
2013-12-24 23:47:57 +01:00
#### Example
2013-12-18 00:49:00 +01:00
2014-02-04 22:36:00 +01:00
```javascript
//
// start a storm in 5 seconds
//
setTimeout( function() {
var world = server.worlds.get(0);
world.setStorm(true);
}, 5000);
```
2013-12-24 01:15:17 +01:00
2013-12-24 23:47:57 +01:00
### clearTimeout() function
2013-12-24 01:15:17 +01:00
2013-12-24 23:47:57 +01:00
A scriptcraft implementation of clearTimeout().
2013-12-24 01:15:17 +01:00
2013-12-24 23:47:57 +01:00
### setInterval() function
2013-12-24 01:15:17 +01:00
2014-10-05 18:29:04 +02:00
This function mimics the setInterval() function used in browser-based javascript. However, the function will only accept a function reference, not a string of javascript code. Where setInterval() in the browser returns a numeric value which can be subsequently passed to clearInterval(), This implementation returns an object which can be subsequently passed to ScriptCraft's own clearInterval() implementation.
2013-12-24 01:15:17 +01:00
2013-12-24 23:47:57 +01:00
### clearInterval() function
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
A scriptcraft implementation of clearInterval().
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
### refresh() function
2013-12-18 00:49:00 +01:00
2014-06-14 16:45:44 +02:00
The refresh() function can be used to only reload the ScriptCraft plugin (it's like the `reload` command except it only reloads ScriptCraft). The refresh() function will ...
2013-12-24 01:15:17 +01:00
2013-12-24 23:47:57 +01:00
1. Disable the ScriptCraft plugin.
2. Unload all event listeners associated with the ScriptCraft plugin.
3. Enable the ScriptCraft plugin.
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
... refresh() can be used during development to reload only scriptcraft javascript files.
See [issue #69 ][issue69] for more information.
2013-12-24 01:15:17 +01:00
2013-12-24 23:47:57 +01:00
[issue69]: https://github.com/walterhiggins/ScriptCraft/issues/69
2013-12-18 00:49:00 +01:00
2013-12-28 23:49:13 +01:00
### addUnloadHandler() function
2014-06-14 16:45:44 +02:00
The addUnloadHandler() function takes a callback function as a parameter. The callback will be called when the ScriptCraft plugin is unloaded (usually as a result of a a `reload` command or server shutdown).
2013-12-28 23:49:13 +01:00
2014-06-14 16:45:44 +02:00
This function provides a way for ScriptCraft modules to do any required cleanup/housekeeping just prior to the ScriptCraft Plugin unloading.
2014-01-02 19:46:46 +01:00
2014-10-05 18:29:04 +02:00
### isOp() function
This function takes a single parameter and returns true if it's an operator or has operator-level privileges.
2013-12-28 09:44:40 +01:00
## require - Node.js-style module loading in ScriptCraft
2013-12-24 01:15:17 +01:00
2013-12-24 23:47:57 +01:00
Node.js is a server-side javascript environment with an excellent
module loading system based on CommonJS. Modules in Node.js are really
simple. Each module is in its own javascript file and all variables
and functions within the file are private to that file/module only.
There is a very concise explanation of CommonJS modules at...
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
[http://wiki.commonjs.org/wiki/Modules/1.1.1.][cjsmodules]
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
Node.js also has good documentation on [Modules][njsmod].
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
If you want to export a variable or function you use the module.export
property.
2013-12-24 01:15:17 +01:00
2013-12-24 23:47:57 +01:00
For example imagine you have 3 files program.js, inc.js and math.js ...
2013-12-24 01:15:17 +01:00
2013-12-24 23:47:57 +01:00
### math.js
2013-12-24 01:15:17 +01:00
2014-02-04 22:36:00 +01:00
```javascript
exports.add = function(a,b){
return a + b;
}
```
2013-12-24 01:15:17 +01:00
2013-12-24 23:47:57 +01:00
### inc.js
2013-12-24 01:15:17 +01:00
2014-02-04 22:36:00 +01:00
```javascript
var math = require('./math');
exports.increment = function(n){
return math.add(n, 1);
}
```
2013-12-24 01:15:17 +01:00
2013-12-24 23:47:57 +01:00
### program.js
2013-12-24 01:15:17 +01:00
2014-02-04 22:36:00 +01:00
```javascript
var inc = require('./inc').increment;
var a = 7;
a = inc(a);
print(a);
```
2013-12-24 01:15:17 +01:00
2013-12-24 23:47:57 +01:00
You can see from the above sample code that programs can use modules
and modules themeselves can use other modules. Modules have full
control over what functions and properties they want to provide to
others.
2013-12-18 00:49:00 +01:00
2013-12-28 09:44:40 +01:00
### Important
2013-12-24 01:15:17 +01:00
2013-12-24 23:47:57 +01:00
Although ScriptCraft now supports Node.js style modules, it does not
support node modules. Node.js and Rhino are two very different
Javascript environments. ScriptCraft uses Rhino Javascript, not
2013-12-28 09:44:40 +01:00
Node.js. Standard Node.js modules such as `'fs'` are not available in ScriptCraft.
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
Modules can be loaded using relative or absolute paths. Per the CommonJS
module specification, the '.js' suffix is optional.
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
[cjsmodules]: http://wiki.commonjs.org/wiki/Modules/1.1.1.
2013-12-18 00:49:00 +01:00
2013-12-28 09:44:40 +01:00
### module name resolution
When resolving module names to file paths, ScriptCraft uses the following rules...
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
1. if the module does not begin with './' or '/' then ...
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
1.1 Look in the 'scriptcraft/lib' directory. If it's not there then...
1.2 Look in the 'scriptcraft/modules' directory. If it's not there then
Throw an Error.
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
2. If the module begins with './' or '/' then ...
2.1 if the module begins with './' then it's treated as a file path. File paths are
always relative to the module from which the require() call is being made.
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
2.2 If the module begins with '/' then it's treated as an absolute path.
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
If the module does not have a '.js' suffix, and a file with the same name and a .js sufix exists,
then the file will be loaded.
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
3. If the module name resolves to a directory then...
2013-12-24 01:15:17 +01:00
2013-12-24 23:47:57 +01:00
3.1 look for a package.json file in the directory and load the `main` property e.g.
2013-12-24 01:15:17 +01:00
2013-12-24 23:47:57 +01:00
// package.json located in './some-library/'
{
"main": './some-lib.js',
"name": 'some-library'
}
3.2 if no package.json file exists then look for an index.js file in the directory
2013-12-18 00:49:00 +01:00
2013-12-28 09:44:40 +01:00
## events Module
2015-01-18 21:27:37 +01:00
The Events module provides a thin wrapper around CanaryMod's or
Bukkit's Event-handling API. The Java-based CanaryMod and Bukkit
Events APIs make use of Java Annotations which are not available in
Javascript, so this module provides a simple way to listen to
minecraft events in javascript.
2013-12-24 01:15:17 +01:00
2013-12-28 09:44:40 +01:00
### events.on() static method
2015-01-18 21:27:37 +01:00
This method is used to register event listeners. This method is called by all of the Event Helper methods.
The `events` object has functions for registering listeners for each type of event. For example, you can register a block-break listener using events.on:
```javascript
events.on( Packages.net.canarymod.hook.player.BlockDestroyHook, function( evt, cancel ) {
echo(evt.player, evt.player.name + ' broke a block!');
} );
```
or you can (and probably should) use the more succinct:
```javascript
events.blockDestroy( function( evt, cancel ) {
echo(evt.player, evt.player.name + ' broke a block!');
} );
```
The events.on method can be used to register standard CanaryMod/Bukkit
events and can also be used to register non-standard events - that is
- events provided by plugins.
2013-12-24 01:15:17 +01:00
2013-12-28 09:44:40 +01:00
#### Parameters
2015-01-18 21:27:37 +01:00
* eventType - A Java class. See the [CanaryMod Hook API][cmEvtApi] or [Bukkit Event API][buk] for details of the many event types.
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
* callback - A function which will be called whenever the event
2015-01-18 21:27:37 +01:00
fires. The callback in turn takes 2 parameters:
- event : the event fired
- cancel : a function which if invoked will cancel the event - not all event types are cancelable; this function only cancels cancelable events).
* priority (optional - default: "CRITICAL" for CanaryMod or "HIGHEST" for Bukkit) -
The priority the listener/callback takes over other listeners to the same event.
Possible values for CanaryMod are "CRITICAL", "HIGH", "LOW", "NORMAL" and "PASSIVE".
For an explanation of what the different CanaryMod Hook priorities
mean, refer to CanaryMod's [Hook Priority class][cmPriority].
Possible values for Bukkit are "HIGH", "HIGHEST", "LOW", "LOWEST", "NORMAL", "MONITOR".
For an explanation of what the different Bukkit Event priorities
mean, refer to bukkit's [Event API Reference][buk2].
2013-12-18 00:49:00 +01:00
2013-12-28 09:44:40 +01:00
#### Returns
2014-03-15 19:06:23 +01:00
An object which can be used to unregister the listener.
2013-12-18 00:49:00 +01:00
2013-12-28 09:44:40 +01:00
#### Example:
2013-12-24 23:47:57 +01:00
2013-12-28 09:44:40 +01:00
The following code will print a message on screen every time a block is broken in the game
2013-12-24 23:47:57 +01:00
2014-02-04 22:49:12 +01:00
```javascript
2015-01-18 21:27:37 +01:00
events.on( Packages.net.canarymod.hook.player.BlockDestroyHook, function( evt, cancel ) {
echo(evt.player, evt.player.name + ' broke a block!');
2014-02-04 22:49:12 +01:00
} );
```
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
To handle an event only once and unregister from further events...
2014-02-04 22:49:12 +01:00
```javascript
2015-01-18 21:27:37 +01:00
events.on( Packages.net.canarymod.hook.player.BlockDestroyHook, function( evt, cancel ) {
echo( evt.player, evt.player.name + ' broke a block!');
this.unregister();
2014-02-04 22:49:12 +01:00
} );
2014-04-26 21:34:45 +02:00
```
2013-12-18 00:49:00 +01:00
2014-03-15 19:06:23 +01:00
The `this` keyword when used inside the callback function refers to
2015-02-15 14:10:17 +01:00
the Listener object created by ScriptCraft. It has 2 methods
`unregister()` which can be used to stop listening and `cancel()`
which can be used to cancel the current event. The object returned by
`events.on()` only has the `unregister()` method, the `cancel()`
method is only available from within the event handling function.
2014-03-15 19:06:23 +01:00
2013-12-24 23:47:57 +01:00
To unregister a listener *outside* of the listener function...
2013-12-18 00:49:00 +01:00
2014-02-04 22:49:12 +01:00
```javascript
2015-01-18 21:27:37 +01:00
var myBlockBreakListener = events.on( Packages.net.canarymod.hook.player.BlockDestroyHook, function( evt ) { ... } );
2014-02-04 22:49:12 +01:00
...
2014-03-15 19:06:23 +01:00
myBlockBreakListener.unregister();
2014-02-04 22:49:12 +01:00
```
2013-12-18 00:49:00 +01:00
2013-12-24 23:47:57 +01:00
[buk2]: http://wiki.bukkit.org/Event_API_Reference
[buk]: http://jd.bukkit.org/dev/apidocs/index.html?org/bukkit/event/Event.html
2015-01-18 21:27:37 +01:00
[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
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
## Events Helper Module (canary version)
2014-11-09 12:52:10 +01:00
The Events helper module provides a suite of functions - one for each possible event.
2015-01-03 21:57:30 +01:00
For example, the events.blockDestroy() function is just a wrapper function which calls events.on(net.canarymod.hook.player.BlockDestroyHook, callback, priority)
2014-11-09 12:52:10 +01:00
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
2015-01-03 21:57:30 +01:00
events.blockDestroy( function( event ) {
2014-11-09 12:52:10 +01:00
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.
2015-01-03 21:57:30 +01:00
### events.minecartActivate()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.MinecartActivateHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/entity/MinecartActivateHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.villagerTradeUnlock()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.VillagerTradeUnlockHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/entity/VillagerTradeUnlockHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.mobTarget()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.MobTargetHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/entity/MobTargetHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.chickenLayEgg()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.ChickenLayEggHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/entity/ChickenLayEggHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.potionEffectFinish()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.PotionEffectFinishHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/entity/PotionEffectFinishHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.entityMove()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.EntityMoveHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/entity/EntityMoveHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.hangingEntityDestroy()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.HangingEntityDestroyHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/entity/HangingEntityDestroyHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.vehicleCollision()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.VehicleCollisionHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/entity/VehicleCollisionHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.potionEffectApplied()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.PotionEffectAppliedHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/entity/PotionEffectAppliedHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.vehicleDestroy()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.VehicleDestroyHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/entity/VehicleDestroyHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.vehicleEnter()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.VehicleEnterHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/entity/VehicleEnterHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.damage()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.DamageHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/entity/DamageHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.entityMount()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.EntityMountHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/entity/EntityMountHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.slimeSplit()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.SlimeSplitHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/entity/SlimeSplitHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.endermanDropBlock()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.EndermanDropBlockHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/entity/EndermanDropBlockHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.itemTouchGround()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.ItemTouchGroundHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/entity/ItemTouchGroundHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.entitySpawn()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.EntitySpawnHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/entity/EntitySpawnHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.endermanPickupBlock()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.EndermanPickupBlockHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/entity/EndermanPickupBlockHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.vehicleDamage()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.VehicleDamageHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/entity/VehicleDamageHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.entityLightningStruck()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.EntityLightningStruckHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/entity/EntityLightningStruckHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.entityDespawn()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.EntityDespawnHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/entity/EntityDespawnHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.vehicleMove()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.VehicleMoveHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/entity/VehicleMoveHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.projectileHit()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.ProjectileHitHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/entity/ProjectileHitHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.entityDeath()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.EntityDeathHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/entity/EntityDeathHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.entityTame()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.EntityTameHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/entity/EntityTameHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.vehicleExit()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.VehicleExitHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/entity/VehicleExitHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.dimensionSwitch()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.DimensionSwitchHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/entity/DimensionSwitchHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.foodLevel()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.FoodLevelHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/FoodLevelHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.bookEdit()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.BookEditHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/BookEditHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.eat()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.EatHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/EatHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-11 01:11:44 +01:00
### events.playerList()
#### Parameters
* callback - A function which is called whenever the [player.PlayerListHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/PlayerListHook.html ) is fired
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.playerIdle()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerIdleHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/PlayerIdleHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.enchant()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.EnchantHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/EnchantHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.playerArmSwing()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerArmSwingHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/PlayerArmSwingHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.teleport()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.TeleportHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/TeleportHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.anvilUse()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.AnvilUseHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/AnvilUseHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.portalUse()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PortalUseHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/PortalUseHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.foodSaturation()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.FoodSaturationHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/FoodSaturationHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.connection()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.ConnectionHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/ConnectionHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.playerRespawned()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerRespawnedHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/PlayerRespawnedHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.armorBroken()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.ArmorBrokenHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/ArmorBrokenHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.levelUp()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.LevelUpHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/LevelUpHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.blockRightClick()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.BlockRightClickHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/BlockRightClickHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.itemDrop()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.ItemDropHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/ItemDropHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-04-04 12:27:14 +02:00
### events.itemFrameRotate()
#### Parameters
* callback - A function which is called whenever the [player.ItemFrameRotateHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/ItemFrameRotateHook.html ) is fired
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.playerRespawning()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerRespawningHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/PlayerRespawningHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.craft()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.CraftHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/CraftHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.experience()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.ExperienceHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/ExperienceHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.signChange()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.SignChangeHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/SignChangeHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.healthChange()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.HealthChangeHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/HealthChangeHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.disconnection()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.DisconnectionHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/DisconnectionHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.gameModeChange()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.GameModeChangeHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/GameModeChangeHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.preConnection()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PreConnectionHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/PreConnectionHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.villagerTrade()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.VillagerTradeHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/VillagerTradeHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.returnFromIdle()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.ReturnFromIdleHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/ReturnFromIdleHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-04-04 12:27:14 +02:00
### events.armorStandModify()
#### Parameters
* callback - A function which is called whenever the [player.ArmorStandModifyHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/ArmorStandModifyHook.html ) is fired
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.slotClick()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.SlotClickHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/SlotClickHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-04-04 12:27:14 +02:00
### events.itemFrameSetItem()
#### Parameters
* callback - A function which is called whenever the [player.ItemFrameSetItemHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/ItemFrameSetItemHook.html ) is fired
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.entityRightClick()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.EntityRightClickHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/EntityRightClickHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.foodExhaustion()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.FoodExhaustionHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/FoodExhaustionHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.chat()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.ChatHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/ChatHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.itemPickup()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.ItemPickupHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/ItemPickupHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.bedExit()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.BedExitHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/BedExitHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.blockPlace()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.BlockPlaceHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/BlockPlaceHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-02-21 11:19:51 +01:00
### events.heldItemChange()
#### Parameters
* callback - A function which is called whenever the [player.HeldItemChangeHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/HeldItemChangeHook.html ) is fired
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.toolBroken()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.ToolBrokenHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/ToolBrokenHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.kick()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.KickHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/KickHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.playerDeath()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerDeathHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/PlayerDeathHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.blockLeftClick()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.BlockLeftClickHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/BlockLeftClickHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.blockDestroy()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.BlockDestroyHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/BlockDestroyHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.bedEnter()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.BedEnterHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/BedEnterHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.signShow()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.SignShowHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/SignShowHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.inventory()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.InventoryHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/InventoryHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.playerMove()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerMoveHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/PlayerMoveHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.itemUse()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.ItemUseHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/ItemUseHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.ban()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.BanHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/BanHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.statGained()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.StatGainedHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/player/StatGainedHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.smeltBegin()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [world.SmeltBeginHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/world/SmeltBeginHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.treeGrow()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [world.TreeGrowHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/world/TreeGrowHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.chunkCreated()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [world.ChunkCreatedHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/world/ChunkCreatedHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.liquidDestroy()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [world.LiquidDestroyHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/world/LiquidDestroyHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.chunkLoaded()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [world.ChunkLoadedHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/world/ChunkLoadedHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.pistonRetract()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [world.PistonRetractHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/world/PistonRetractHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.smelt()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [world.SmeltHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/world/SmeltHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.blockUpdate()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [world.BlockUpdateHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/world/BlockUpdateHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.portalDestroy()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [world.PortalDestroyHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/world/PortalDestroyHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.ignition()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [world.IgnitionHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/world/IgnitionHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.redstoneChange()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [world.RedstoneChangeHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/world/RedstoneChangeHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.weatherChange()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [world.WeatherChangeHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/world/WeatherChangeHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.chunkCreation()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [world.ChunkCreationHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/world/ChunkCreationHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.hopperTransfer()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [world.HopperTransferHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/world/HopperTransferHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.chunkUnload()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [world.ChunkUnloadHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/world/ChunkUnloadHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.blockGrow()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [world.BlockGrowHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/world/BlockGrowHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.dispense()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [world.DispenseHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/world/DispenseHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.blockDropXp()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [world.BlockDropXpHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/world/BlockDropXpHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.fireworkExplode()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [world.FireworkExplodeHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/world/FireworkExplodeHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.leafDecay()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [world.LeafDecayHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/world/LeafDecayHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.pistonExtend()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [world.PistonExtendHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/world/PistonExtendHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.noteBlockPlay()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [world.NoteBlockPlayHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/world/NoteBlockPlayHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.lightningStrike()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [world.LightningStrikeHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/world/LightningStrikeHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.decorate()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [world.DecorateHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/world/DecorateHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.explosion()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [world.ExplosionHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/world/ExplosionHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.tNTActivate()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [world.TNTActivateHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/world/TNTActivateHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.timeChange()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [world.TimeChangeHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/world/TimeChangeHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.flow()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [world.FlowHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/world/FlowHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.portalCreate()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [world.PortalCreateHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/world/PortalCreateHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.blockPhysics()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [world.BlockPhysicsHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/world/BlockPhysicsHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.playerCommand()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [command.PlayerCommandHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/command/PlayerCommandHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.consoleCommand()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [command.ConsoleCommandHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/command/ConsoleCommandHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.commandBlockCommand()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [command.CommandBlockCommandHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/command/CommandBlockCommandHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.loadWorld()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [system.LoadWorldHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/system/LoadWorldHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.permissionCheck()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [system.PermissionCheckHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/system/PermissionCheckHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.serverGuiStart()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [system.ServerGuiStartHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/system/ServerGuiStartHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.unloadWorld()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [system.UnloadWorldHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/system/UnloadWorldHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.pluginDisable()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [system.PluginDisableHook event ](https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/system/PluginDisableHook.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.pluginEnable()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* 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
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.serverTick()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* 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
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.serverListPing()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* 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
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.serverShutdown()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* 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
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
## 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.
2014-11-09 12:52:10 +01:00
2015-01-03 21:57:30 +01:00
### Usage
2014-11-09 12:52:10 +01:00
2015-01-03 21:57:30 +01:00
events.blockBreak( function( event ) {
echo( event.player, 'You broke a block!');
});
2014-11-09 12:52:10 +01:00
2015-01-03 21:57:30 +01:00
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.
2014-11-09 12:52:10 +01:00
2015-01-03 21:57:30 +01:00
### events.weatherChange()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [weather.WeatherChangeEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/weather/WeatherChangeEvent.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.lightningStrike()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [weather.LightningStrikeEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/weather/LightningStrikeEvent.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.thunderChange()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [weather.ThunderChangeEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/weather/ThunderChangeEvent.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.vehicleMove()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [vehicle.VehicleMoveEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/vehicle/VehicleMoveEvent.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.vehicleDestroy()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [vehicle.VehicleDestroyEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/vehicle/VehicleDestroyEvent.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.vehicleExit()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [vehicle.VehicleExitEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/vehicle/VehicleExitEvent.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.vehicleEntityCollision()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [vehicle.VehicleEntityCollisionEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/vehicle/VehicleEntityCollisionEvent.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.vehicleBlockCollision()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [vehicle.VehicleBlockCollisionEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/vehicle/VehicleBlockCollisionEvent.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.vehicleEnter()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [vehicle.VehicleEnterEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/vehicle/VehicleEnterEvent.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.vehicleDamage()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [vehicle.VehicleDamageEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/vehicle/VehicleDamageEvent.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.vehicleUpdate()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [vehicle.VehicleUpdateEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/vehicle/VehicleUpdateEvent.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.vehicleCreate()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [vehicle.VehicleCreateEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/vehicle/VehicleCreateEvent.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.paintingBreak()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [painting.PaintingBreakEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/painting/PaintingBreakEvent.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.paintingBreakByEntity()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [painting.PaintingBreakByEntityEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/painting/PaintingBreakByEntityEvent.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.paintingPlace()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [painting.PaintingPlaceEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/painting/PaintingPlaceEvent.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.enchantItem()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [enchantment.EnchantItemEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/enchantment/EnchantItemEvent.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.prepareItemEnchant()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [enchantment.PrepareItemEnchantEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/enchantment/PrepareItemEnchantEvent.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.playerInteractEntity()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerInteractEntityEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerInteractEntityEvent.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.playerEggThrow()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerEggThrowEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerEggThrowEvent.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.playerUnleashEntity()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerUnleashEntityEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerUnleashEntityEvent.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.playerInventory()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerInventoryEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerInventoryEvent.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.playerLevelChange()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerLevelChangeEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerLevelChangeEvent.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.playerPortal()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerPortalEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerPortalEvent.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.playerItemConsume()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerItemConsumeEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerItemConsumeEvent.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.playerTeleport()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerTeleportEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerTeleportEvent.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.playerBedEnter()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerBedEnterEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerBedEnterEvent.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.playerUnregisterChannel()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerUnregisterChannelEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerUnregisterChannelEvent.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.playerChat()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerChatEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerChatEvent.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.playerShearEntity()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerShearEntityEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerShearEntityEvent.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.asyncPlayerChat()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.AsyncPlayerChatEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/AsyncPlayerChatEvent.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.playerDropItem()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerDropItemEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerDropItemEvent.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.playerRegisterChannel()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerRegisterChannelEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerRegisterChannelEvent.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.playerMove()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerMoveEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerMoveEvent.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.playerItemBreak()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerItemBreakEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerItemBreakEvent.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.playerBucketEmpty()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerBucketEmptyEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerBucketEmptyEvent.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.playerStatisticIncrement()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerStatisticIncrementEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerStatisticIncrementEvent.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.playerToggleFlight()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerToggleFlightEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerToggleFlightEvent.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.playerItemHeld()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerItemHeldEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerItemHeldEvent.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.playerAchievementAwarded()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerAchievementAwardedEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerAchievementAwardedEvent.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.playerToggleSneak()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerToggleSneakEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerToggleSneakEvent.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.playerExpChange()
2014-11-09 12:52:10 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerExpChangeEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerExpChangeEvent.html ) is fired
2014-11-09 12:52:10 +01:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.playerPreLogin()
2014-04-26 21:31:52 +02:00
2015-01-03 21:57:30 +01:00
#### Parameters
2014-04-26 17:56:57 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerPreLoginEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerPreLoginEvent.html ) is fired
2014-04-26 17:56:57 +02:00
2015-01-03 21:57:30 +01:00
* priority - optional - see events.on() for more information.
2014-04-26 17:56:57 +02:00
2015-01-03 21:57:30 +01:00
### events.playerJoin()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerJoinEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerJoinEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.playerAnimation()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerAnimationEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerAnimationEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.playerEditBook()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerEditBookEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerEditBookEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.playerPickupItem()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerPickupItemEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerPickupItemEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.playerChangedWorld()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerChangedWorldEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerChangedWorldEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.playerFish()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerFishEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerFishEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.playerChatTabComplete()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerChatTabCompleteEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerChatTabCompleteEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.playerRespawn()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerRespawnEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerRespawnEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.playerBedLeave()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerBedLeaveEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerBedLeaveEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.asyncPlayerPreLogin()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.AsyncPlayerPreLoginEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/AsyncPlayerPreLoginEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.playerInteract()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerInteractEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerInteractEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.playerBucketFill()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerBucketFillEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerBucketFillEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.playerVelocity()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerVelocityEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerVelocityEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.playerQuit()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerQuitEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerQuitEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.playerLogin()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerLoginEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerLoginEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.playerKick()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerKickEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerKickEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.playerToggleSprint()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerToggleSprintEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerToggleSprintEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.playerCommandPreprocess()
2014-05-18 01:35:26 +02:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerCommandPreprocessEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerCommandPreprocessEvent.html ) is fired
2014-05-18 01:35:26 +02:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.playerGameModeChange()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [player.PlayerGameModeChangeEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerGameModeChangeEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.furnaceSmelt()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [inventory.FurnaceSmeltEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/inventory/FurnaceSmeltEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.inventoryDrag()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [inventory.InventoryDragEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/inventory/InventoryDragEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.craftItem()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [inventory.CraftItemEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/inventory/CraftItemEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.furnaceBurn()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [inventory.FurnaceBurnEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/inventory/FurnaceBurnEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.inventoryOpen()
2014-05-18 01:35:26 +02:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [inventory.InventoryOpenEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/inventory/InventoryOpenEvent.html ) is fired
2014-05-18 01:35:26 +02:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.inventoryPickupItem()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [inventory.InventoryPickupItemEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/inventory/InventoryPickupItemEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.inventoryMoveItem()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [inventory.InventoryMoveItemEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/inventory/InventoryMoveItemEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.inventoryClick()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [inventory.InventoryClickEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/inventory/InventoryClickEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.inventoryClose()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [inventory.InventoryCloseEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/inventory/InventoryCloseEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.inventoryCreative()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [inventory.InventoryCreativeEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/inventory/InventoryCreativeEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.inventory()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [inventory.InventoryEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/inventory/InventoryEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.prepareItemCraft()
2014-05-18 01:35:26 +02:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [inventory.PrepareItemCraftEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/inventory/PrepareItemCraftEvent.html ) is fired
2014-05-18 01:35:26 +02:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.furnaceExtract()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [inventory.FurnaceExtractEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/inventory/FurnaceExtractEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.brew()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [inventory.BrewEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/inventory/BrewEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.serverCommand()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [server.ServerCommandEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/server/ServerCommandEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.serverListPing()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [server.ServerListPingEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/server/ServerListPingEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.serviceRegister()
2014-05-18 01:35:26 +02:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [server.ServiceRegisterEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/server/ServiceRegisterEvent.html ) is fired
2014-05-18 01:35:26 +02:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.pluginDisable()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [server.PluginDisableEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/server/PluginDisableEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.remoteServerCommand()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [server.RemoteServerCommandEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/server/RemoteServerCommandEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.mapInitialize()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [server.MapInitializeEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/server/MapInitializeEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.serviceUnregister()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [server.ServiceUnregisterEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/server/ServiceUnregisterEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.pluginEnable()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [server.PluginEnableEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/server/PluginEnableEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.playerDeath()
2014-05-18 01:35:26 +02:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.PlayerDeathEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/entity/PlayerDeathEvent.html ) is fired
2014-05-18 01:35:26 +02:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.entityCreatePortal()
2014-05-18 01:35:26 +02:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.EntityCreatePortalEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/entity/EntityCreatePortalEvent.html ) is fired
2014-05-18 01:35:26 +02:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.entityCombust()
2014-05-18 01:35:26 +02:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.EntityCombustEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/entity/EntityCombustEvent.html ) is fired
2014-05-18 01:35:26 +02:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.sheepDyeWool()
2014-05-18 01:35:26 +02:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.SheepDyeWoolEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/entity/SheepDyeWoolEvent.html ) is fired
2014-05-18 01:35:26 +02:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.expBottle()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.ExpBottleEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/entity/ExpBottleEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.entityTame()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.EntityTameEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/entity/EntityTameEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.projectileLaunch()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.ProjectileLaunchEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/entity/ProjectileLaunchEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.entityDamage()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.EntityDamageEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/entity/EntityDamageEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.itemSpawn()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.ItemSpawnEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/entity/ItemSpawnEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.projectileHit()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.ProjectileHitEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/entity/ProjectileHitEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.foodLevelChange()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.FoodLevelChangeEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/entity/FoodLevelChangeEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.itemDespawn()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.ItemDespawnEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/entity/ItemDespawnEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.entityPortalEnter()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.EntityPortalEnterEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/entity/EntityPortalEnterEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.entityPortal()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.EntityPortalEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/entity/EntityPortalEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.entityTarget()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.EntityTargetEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/entity/EntityTargetEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.entityDeath()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.EntityDeathEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/entity/EntityDeathEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.sheepRegrowWool()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.SheepRegrowWoolEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/entity/SheepRegrowWoolEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.entityShootBow()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.EntityShootBowEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/entity/EntityShootBowEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.creeperPower()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.CreeperPowerEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/entity/CreeperPowerEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.entityCombustByBlock()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.EntityCombustByBlockEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/entity/EntityCombustByBlockEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.entityBreakDoor()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.EntityBreakDoorEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/entity/EntityBreakDoorEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.entityDamageByEntity()
2014-05-18 01:35:26 +02:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.EntityDamageByEntityEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/entity/EntityDamageByEntityEvent.html ) is fired
2014-05-18 01:35:26 +02:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.entityUnleash()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.EntityUnleashEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/entity/EntityUnleashEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.entityExplode()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.EntityExplodeEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/entity/EntityExplodeEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.entityInteract()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.EntityInteractEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/entity/EntityInteractEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.explosionPrime()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.ExplosionPrimeEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/entity/ExplosionPrimeEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.horseJump()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.HorseJumpEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/entity/HorseJumpEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.creatureSpawn()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.CreatureSpawnEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/entity/CreatureSpawnEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.entityCombustByEntity()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.EntityCombustByEntityEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/entity/EntityCombustByEntityEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.entityDamageByBlock()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.EntityDamageByBlockEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/entity/EntityDamageByBlockEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.entityTargetLivingEntity()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.EntityTargetLivingEntityEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/entity/EntityTargetLivingEntityEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.entityTeleport()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.EntityTeleportEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/entity/EntityTeleportEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.playerLeashEntity()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.PlayerLeashEntityEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/entity/PlayerLeashEntityEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.slimeSplit()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.SlimeSplitEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/entity/SlimeSplitEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.pigZap()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.PigZapEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/entity/PigZapEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.potionSplash()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.PotionSplashEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/entity/PotionSplashEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.entityChangeBlock()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.EntityChangeBlockEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/entity/EntityChangeBlockEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.entityPortalExit()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.EntityPortalExitEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/entity/EntityPortalExitEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.entityRegainHealth()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [entity.EntityRegainHealthEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/entity/EntityRegainHealthEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.entityBlockForm()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [block.EntityBlockFormEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/block/EntityBlockFormEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.blockSpread()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [block.BlockSpreadEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/block/BlockSpreadEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.blockMultiPlace()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [block.BlockMultiPlaceEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/block/BlockMultiPlaceEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.notePlay()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [block.NotePlayEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/block/NotePlayEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.blockFade()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [block.BlockFadeEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/block/BlockFadeEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.blockPlace()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [block.BlockPlaceEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/block/BlockPlaceEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.blockPhysics()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [block.BlockPhysicsEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/block/BlockPhysicsEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.blockIgnite()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [block.BlockIgniteEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/block/BlockIgniteEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.blockBreak()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [block.BlockBreakEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/block/BlockBreakEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.blockBurn()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [block.BlockBurnEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/block/BlockBurnEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.blockFromTo()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [block.BlockFromToEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/block/BlockFromToEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.blockRedstone()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [block.BlockRedstoneEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/block/BlockRedstoneEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.blockPistonRetract()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [block.BlockPistonRetractEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/block/BlockPistonRetractEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.blockDispense()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [block.BlockDispenseEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/block/BlockDispenseEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.signChange()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [block.SignChangeEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/block/SignChangeEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.blockPistonExtend()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [block.BlockPistonExtendEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/block/BlockPistonExtendEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.blockCanBuild()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [block.BlockCanBuildEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/block/BlockCanBuildEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.blockGrow()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [block.BlockGrowEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/block/BlockGrowEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.leavesDecay()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [block.LeavesDecayEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/block/LeavesDecayEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.blockExp()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [block.BlockExpEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/block/BlockExpEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.blockForm()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [block.BlockFormEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/block/BlockFormEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.blockDamage()
2014-05-18 01:35:26 +02:00
#### Parameters
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [block.BlockDamageEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/block/BlockDamageEvent.html ) is fired
2014-05-18 01:35:26 +02:00
* priority - optional - see events.on() for more information.
2015-01-03 21:57:30 +01:00
### events.hangingPlace()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [hanging.HangingPlaceEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/hanging/HangingPlaceEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.hangingBreakByEntity()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [hanging.HangingBreakByEntityEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/hanging/HangingBreakByEntityEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.hangingBreak()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [hanging.HangingBreakEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/hanging/HangingBreakEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.structureGrow()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [world.StructureGrowEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/world/StructureGrowEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.spawnChange()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [world.SpawnChangeEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/world/SpawnChangeEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.worldLoad()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [world.WorldLoadEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/world/WorldLoadEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.worldInit()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [world.WorldInitEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/world/WorldInitEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.worldUnload()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [world.WorldUnloadEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/world/WorldUnloadEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.worldSave()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [world.WorldSaveEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/world/WorldSaveEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.chunkUnload()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [world.ChunkUnloadEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/world/ChunkUnloadEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.chunkPopulate()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [world.ChunkPopulateEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/world/ChunkPopulateEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.portalCreate()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [world.PortalCreateEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/world/PortalCreateEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
### events.chunkLoad()
2014-04-26 18:14:32 +02:00
2014-04-26 17:56:57 +02:00
#### Parameters
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
* callback - A function which is called whenever the [world.ChunkLoadEvent event ](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/world/ChunkLoadEvent.html ) is fired
2014-04-26 18:14:32 +02:00
2014-04-26 21:24:45 +02:00
* priority - optional - see events.on() for more information.
2014-04-26 18:14:32 +02:00
2015-01-03 21:57:30 +01:00
## console global variable
2013-12-31 22:09:50 +01:00
2015-01-03 21:57:30 +01:00
ScriptCraft provides a `console` global variable with the followng methods...
2013-12-31 22:09:50 +01:00
2015-01-03 21:57:30 +01:00
* log()
* info()
* warn()
* error()
2013-12-31 22:09:50 +01:00
2015-01-03 21:57:30 +01:00
The ScriptCraft console methods work like the [Web API implementation][webcons].
2013-12-31 22:09:50 +01:00
2015-01-03 21:57:30 +01:00
### Example
2013-12-31 22:09:50 +01:00
2015-01-03 21:57:30 +01:00
console.log('Hello %s', 'world');
2013-12-31 22:09:50 +01:00
2015-01-03 21:57:30 +01:00
Basic variable substitution is supported (ScriptCraft's implementation
of console uses the Bukkit Plugin [Logger][lgr] or Canary Plugin [Logman][cmlgr] under the hood and
uses [java.lang.String.format()][strfmt] for variable
substitution. All output will be sent to the server console (not
in-game).
2013-12-31 22:09:50 +01:00
2015-01-03 21:57:30 +01:00
### Using string substitutions
2013-12-31 22:09:50 +01:00
2015-01-03 21:57:30 +01:00
ScriptCraft uses Java's [String.format()][strfmt] so any string substitution identifiers supported by
`java.lang.String.format()` are supported (e.g. %s , %d etc).
2013-12-31 22:09:50 +01:00
2015-01-03 21:57:30 +01:00
for (var i=0; i< 5 ; i + + ) {
console.log("Hello, %s. You've called me %d times.", "Bob", i+1);
}
2013-12-31 22:09:50 +01:00
2015-01-03 21:57:30 +01:00
[lgr]: http://jd.bukkit.org/beta/apidocs/org/bukkit/plugin/PluginLogger.html
[cmlgr]: https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/logger/Logman.html
[strfmt]: http://docs.oracle.com/javase/6/docs/api/java/lang/String.html#format(java.lang.String, java.lang.Object...)
[webcons]: https://developer.mozilla.org/en-US/docs/Web/API/console
2013-12-31 22:09:50 +01:00
2015-01-03 21:57:30 +01:00
## Drone Plugin
2013-12-31 22:09:50 +01:00
2015-04-11 11:43:33 +02:00
The Drone is a convenience class for building.
2013-12-31 22:09:50 +01:00
2015-01-03 21:57:30 +01:00
It uses a fluent interface which means all of the Drone's methods return `this` and can be chained together like so...
2013-12-31 22:09:50 +01:00
2015-01-03 21:57:30 +01:00
var theDrone = new Drone(self);
theDrone.up().left().box(blocks.oak).down().fwd(3).cylinder0(blocks.lava,8);
2013-12-31 22:09:50 +01:00
2015-01-03 21:57:30 +01:00
### Constructing a Drone Object
2013-12-31 22:09:50 +01:00
2015-01-03 21:57:30 +01:00
Drones can be created in any of the following ways...
1. Calling any one of the methods listed below will return a Drone object. For example...
var d = box( blocks.oak )
2013-12-31 22:09:50 +01:00
2015-01-03 21:57:30 +01:00
... creates a 1x1x1 wooden block at the cross-hairs or player's location and returns a Drone object. This might look odd (if you're familiar with Java's Object-dot-method syntax) but all of the Drone class's methods are also global functions that return new Drone objects. This is short-hand for creating drones and is useful for playing around with Drones at the in-game command prompt. It's shorter than typing ...
var d = new Drone(self).box( blocks.oak )
... All of the Drone's methods return `this` so you can chain operations together like this...
var d = box( blocks.oak )
.up()
.box( blocks.oak ,3,1,3)
.down()
.fwd(2)
.box( blocks.oak )
.turn()
.fwd(2)
.box( blocks.oak )
.turn()
.fwd(2)
.box( blocks.oak );
2. Using the following form...
2014-04-14 00:25:02 +02:00
2015-01-03 21:57:30 +01:00
d = new Drone(self)
...will create a new Drone taking the current player as the parameter. If the player's cross-hairs are pointing at a block at the time then, that block's location becomes the drone's starting point. If the cross-hairs are _not_ pointing at a block, then the drone's starting location will be 2 blocks directly in front of the player. TIP: Building always happens right and front of the drone's position...
Plan View:
2014-04-14 00:25:02 +02:00
2015-01-03 21:57:30 +01:00
^
|
|
D---->
For convenience you can use a _corner stone_ to begin building. The corner stone should be located just above ground level. If the cross-hair is point at or into ground level when you create a new Drone() with either a player or location given as a parameter, then building begins at the location the player was looking at or at the location. You can get around this by pointing at a 'corner stone' just above ground level or alternatively use the following statement...
d = new Drone(self).up();
... which will move the drone up one block as soon as it's created.
2014-04-14 00:25:02 +02:00
2015-01-03 21:57:30 +01:00
![corner stone ](img/cornerstone1.png )
2014-04-14 00:25:02 +02:00
2015-01-03 21:57:30 +01:00
3. Or by using the following form...
d = new Drone(x,y,z,direction,world);
2014-04-14 00:25:02 +02:00
2015-01-03 21:57:30 +01:00
This will create a new Drone at the location you specified using x, y, z In minecraft, the X axis runs west to east and the Z axis runs north to south. The direction parameter says what direction you want the drone to face: 0 = east, 1 = south, 2 = west, 3 = north. If the direction parameter is omitted, the player's direction is used instead. Both the `direction` and `world` parameters are optional.
2014-04-14 00:25:02 +02:00
2015-01-03 21:57:30 +01:00
4. Create a new Drone based on a Location object...
2014-04-14 00:25:02 +02:00
2015-01-03 21:57:30 +01:00
d = new Drone(location);
2014-04-14 00:25:02 +02:00
2015-01-03 21:57:30 +01:00
This is useful when you want to create a drone at a given `org.bukkit.Location` . The `Location` class is used throughout the bukkit API. For example, if you want to create a drone when a block is broken at the block's location you would do so like this...
2014-04-14 00:25:02 +02:00
2015-01-03 21:57:30 +01:00
events.blockBreak( function( event ) {
var location = event.block.location;
var drone = new Drone(location);
// do more stuff with the drone here...
});
2014-04-14 00:25:02 +02:00
2015-01-03 21:57:30 +01:00
#### Parameters
2014-10-05 18:29:04 +02:00
2015-01-03 21:57:30 +01:00
* Player : If a player reference is given as the sole parameter then the block the player was looking at will be used as the starting point for the drone. If the player was not looking at a block then the player's location will be used as the starting point. If a `Player` object is provided as a paramter then it should be the only parameter.
* location : *NB* If a `Location` object is provided as a parameter, then it should be the only parameter.
* x : The x coordinate of the Drone (x,y,z,direction and world are not needed if either a player or location parameter is provided)
* y : The y coordinate of the Drone
* z : The z coordinate of the Drone
* direction : The direction in which the Drone is facing. Possible values are 0 (east), 1 (south), 2 (west) or 3 (north)
* world : The world in which the drone is created.
### Drone.box() method
2014-10-05 18:29:04 +02:00
2015-01-03 21:57:30 +01:00
the box() method is a convenience method for building things. (For the more performance-oriented method - see cuboid)
2014-10-05 18:29:04 +02:00
2015-01-03 21:57:30 +01:00
#### parameters
2014-10-05 18:29:04 +02:00
2015-01-03 21:57:30 +01:00
* b - the block id - e.g. 6 for an oak sapling or '6:2' for a birch sapling. Alternatively you can use any one of the `blocks` values e.g. `blocks.sapling.birch`
* w (optional - default 1) - the width of the structure
* h (optional - default 1) - the height of the structure
* d (optional - default 1) - the depth of the structure - NB this is not how deep underground the structure lies - this is how far away (depth of field) from the drone the structure will extend.
2014-01-05 18:20:54 +01:00
2015-01-03 21:57:30 +01:00
#### Example
2014-01-05 18:20:54 +01:00
2015-01-03 21:57:30 +01:00
To create a black structure 4 blocks wide, 9 blocks tall and 1 block long...
box(blocks.wool.black, 4, 9, 1);
2013-12-28 09:44:40 +01:00
2015-01-03 21:57:30 +01:00
... or the following code does the same but creates a variable that can be used for further methods...
var drone = new Drone(self);
drone.box(blocks.wool.black, 4, 9, 1);
![box example 1 ](img/boxex1.png )
### Drone.box0() method
Another convenience method - this one creates 4 walls with no floor or ceiling.
2013-12-18 00:49:00 +01:00
2014-01-05 18:20:54 +01:00
#### Parameters
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
* block - the block id - e.g. 6 for an oak sapling or '6:2' for a birch sapling. Alternatively you can use any one of the `blocks` values e.g. `blocks.sapling.birch`
* width (optional - default 1) - the width of the structure
* height (optional - default 1) - the height of the structure
* length (optional - default 1) - the length of the structure - how far
away (depth of field) from the drone the structure will extend.
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
#### Example
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
To create a stone building with the insided hollowed out 7 wide by 3 tall by 6 long...
box0( blocks.stone, 7, 3, 6);
![example box0 ](img/box0ex1.png )
### Drone.boxa() method
Construct a cuboid using an array of blocks. As the drone moves first along the width axis, then the height (y axis) then the length, each block is picked from the array and placed.
#### Parameters
* blocks - An array of blocks - each block in the array will be placed in turn.
* width
* height
* length
2013-12-18 00:49:00 +01:00
2014-01-05 18:20:54 +01:00
#### Example
2013-12-28 09:44:40 +01:00
2015-01-03 21:57:30 +01:00
Construct a rainbow-colored road 100 blocks long...
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
var rainbowColors = [blocks.wool.red, blocks.wool.orange, blocks.wool.yellow, blocks.wool.lime,
blocks.wool.lightblue, blocks.wool.blue, blocks.wool.purple];
boxa(rainbowColors,7,1,30);
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
![boxa example ](img/boxaex1.png )
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
### Chaining
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
All of the Drone methods return a Drone object, which means methods can be 'chained' together so instead of writing this...
2014-01-18 00:05:36 +01:00
2015-01-03 21:57:30 +01:00
drone = new Drone( self );
drone.fwd( 3 );
drone.left( 2 );
drone.box( blocks.grass ); // create a grass block
drone.up();
drone.box( blocks.grass ); // create another grass block
drone.down();
2014-01-18 00:05:36 +01:00
2015-01-03 21:57:30 +01:00
...you could simply write ...
var drone = new Drone(self).fwd(3).left(2).box(blocks.grass).up().box(blocks.grass).down();
2014-01-18 00:05:36 +01:00
2015-01-03 21:57:30 +01:00
... since each Drone method is also a global function that constructs a drone if none is supplied, you can shorten even further to just...
fwd(3).left(2).box(blocks.grass).up().box(blocks.grass).down()
2014-01-18 00:05:36 +01:00
2015-01-03 21:57:30 +01:00
The Drone object uses a [Fluent Interface][fl] to make ScriptCraft scripts more concise and easier to write and read. Minecraft's in-game command prompt is limited to about 80 characters so chaining drone commands together means more can be done before hitting the command prompt limit. For complex building you should save your commands in a new script file and load it using /js load()
2014-01-18 00:05:36 +01:00
2015-01-03 21:57:30 +01:00
[fl]: http://en.wikipedia.org/wiki/Fluent_interface
2014-02-04 22:36:00 +01:00
2015-01-03 21:57:30 +01:00
### Drone Properties
2014-01-18 00:05:36 +01:00
2015-01-03 21:57:30 +01:00
* x - The Drone's position along the west-east axis (x increases as you move east)
* y - The Drone's position along the vertical axis (y increses as you move up)
* z - The Drone's position along the north-south axis (z increases as you move south)
* dir - The Drone's direction 0 is east, 1 is south , 2 is west and 3 is north.
2014-01-18 00:05:36 +01:00
2015-01-03 21:57:30 +01:00
### Extending Drone
The Drone object can be easily extended - new buidling recipes/blueprints can be added and can become part of a Drone's chain using the *static* method `Drone.extend` .
### Drone.extend() static method
Use this method to add new methods (which also become chainable global functions) to the Drone object.
#### Parameters
* name - The name of the new method e.g. 'pyramid'.
* function - The method body.
Alternatively if you provide just a function as a parameter, then the function name will be used as the new method name. For example the following two approaches are both valid.
#### Example 1 Using name and function as parameters
// submitted by [edonaldson][edonaldson]
2015-01-11 01:29:43 +01:00
var Drone = require('drone');
2015-01-03 21:57:30 +01:00
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();
}
return this.move('pyramid');
2014-02-04 22:36:00 +01:00
});
2015-01-03 21:57:30 +01:00
#### Example 2 Using just a named function as a parameter
2014-01-18 00:05:36 +01:00
2015-01-11 01:29:43 +01:00
var Drone = require('drone');
2015-01-03 21:57:30 +01:00
function pyramid( block,height) {
this.chkpt('pyramid');
for ( var i = height; i > 0; i -= 2) {
this.box(block, i, 1, i).up().right().fwd();
}
return this.move('pyramid');
}
Drone.extend( pyramid );
2014-01-18 00:05:36 +01:00
2015-01-03 21:57:30 +01:00
Once the method is defined (it can be defined in a new pyramid.js file) it can be used like so...
var d = new Drone(self);
d.pyramid(blocks.brick.stone, 12);
2014-01-18 00:05:36 +01:00
2015-01-03 21:57:30 +01:00
... or simply ...
2014-01-05 16:20:29 +01:00
2015-01-03 21:57:30 +01:00
pyramid(blocks.brick.stone, 12);
2014-01-05 16:20:29 +01:00
2015-01-03 21:57:30 +01:00
[edonaldson]: https://github.com/edonaldson
2014-01-05 16:20:29 +01:00
2015-01-03 21:57:30 +01:00
### Drone Constants
2014-01-05 16:20:29 +01:00
2015-01-03 21:57:30 +01:00
#### Drone.PLAYER_STAIRS_FACING
2014-01-05 16:20:29 +01:00
2015-01-03 21:57:30 +01:00
An array which can be used when constructing stairs facing in the Drone's direction...
2014-01-05 16:20:29 +01:00
2015-01-03 21:57:30 +01:00
var d = new Drone(self);
d.box(blocks.stairs.oak + ':' + Drone.PLAYER_STAIRS_FACING[d.dir]);
2014-01-05 16:20:29 +01:00
2015-01-03 21:57:30 +01:00
... will construct a single oak stair block facing the drone.
2014-01-05 16:20:29 +01:00
2015-01-03 21:57:30 +01:00
#### Drone.PLAYER_SIGN_FACING
2014-01-05 16:20:29 +01:00
2015-01-03 21:57:30 +01:00
An array which can be used when placing signs so they face in a given direction. This is used internally by the Drone.sign() method. It should also be used for placing any of the following blocks...
2014-02-04 22:49:12 +01:00
2015-01-03 21:57:30 +01:00
* chest
* ladder
* furnace
* dispenser
2014-01-05 16:20:29 +01:00
2015-01-03 21:57:30 +01:00
By default, chests, dispensers, signs, ladders and furnaces are placed facing towards the drone so to place a chest facing the Drone just use:
2014-01-05 16:20:29 +01:00
2015-01-03 21:57:30 +01:00
drone.box( blocks.chest );
2014-01-05 16:20:29 +01:00
2015-01-03 21:57:30 +01:00
To place a chest facing _away_ from the Drone:
2014-01-05 16:20:29 +01:00
2015-01-03 21:57:30 +01:00
drone.box( blocks.chest + ':' + Drone.PLAYER_SIGN_FACING[(drone.dir + 2) % 4]);
2014-01-05 16:20:29 +01:00
2015-01-03 21:57:30 +01:00
#### Drone.PLAYER_TORCH_FACING
2014-01-05 16:20:29 +01:00
2015-01-03 21:57:30 +01:00
Used when placing torches. By default torches will be placed facing up. If you want to place a torch so that it faces towards the drone:
2014-01-05 16:20:29 +01:00
2015-01-03 21:57:30 +01:00
drone.box( blocks.torch + ':' + Drone.PLAYER_TORCH_FACING[drone.dir]);
2014-01-05 16:20:29 +01:00
2015-01-03 21:57:30 +01:00
If you want to place a torch so it faces _away_ from the drone:
2014-01-05 16:20:29 +01:00
2015-01-03 21:57:30 +01:00
drone.box( blocks.torch + ':' + Drone.PLAYER_TORCH_FACING[(drone.dir + 2) % 4]);
2014-01-05 16:20:29 +01:00
2015-01-03 21:57:30 +01:00
### Drone.times() Method
2014-05-10 19:45:48 +02:00
2015-06-07 15:22:30 +02:00
The `times()` method makes building multiple copies of buildings
2015-01-03 21:57:30 +01:00
easy. It's possible to create rows or grids of buildings without
resorting to `for` or `while` loops.
2014-05-10 19:45:48 +02:00
2015-01-03 21:57:30 +01:00
#### Parameters
2014-05-10 19:45:48 +02:00
2015-03-22 15:05:19 +01:00
* numTimes : The number of times you want to repeat the preceding statements.
2014-05-10 19:45:48 +02:00
2015-06-07 15:22:30 +02:00
#### Limitation
For now, don't use `times()` inside a Drone method implementation – only use it at the in-game prompt as a short-hand workaround for loops.
2015-01-03 21:57:30 +01:00
#### Example
2014-05-18 01:35:26 +02:00
2015-06-07 15:22:30 +02:00
Say you want to do the same thing over and over. You have a couple of options:
2014-05-18 01:35:26 +02:00
2015-06-07 15:22:30 +02:00
* You can use a `for` loop …
2014-05-18 01:35:26 +02:00
2015-06-07 15:22:30 +02:00
d = new Drone(); for ( var i = 0; i < 4 ; i + + ) { d . cottage ( ) . right ( 8 ) ; }
2014-05-18 01:35:26 +02:00
2015-01-03 21:57:30 +01:00
While this will fit on the in-game prompt, it's awkward. You need to
2015-06-07 15:22:30 +02:00
declare a new Drone object first, then write a `for` loop to create the
4 cottages. It's also error prone – even the `for` loop is too much
2015-01-03 21:57:30 +01:00
syntax for what should really be simple.
2014-05-18 01:35:26 +02:00
2015-06-07 15:22:30 +02:00
* You can use a `while` loop …
2015-01-03 21:57:30 +01:00
2015-06-07 15:22:30 +02:00
d = new Drone(); var i=4; while (i--) { d.cottage().right(8); }
2013-12-31 22:09:50 +01:00
2015-06-07 15:22:30 +02:00
… which is slightly shorter but still too much syntax. Each of the
2015-01-03 21:57:30 +01:00
above statements is fine for creating a 1-dimensional array of
structures. But what if you want to create a 2-dimensional or
3-dimensional array of structures? Enter the `times()` method.
2013-12-31 22:09:50 +01:00
2015-01-03 21:57:30 +01:00
The `times()` method lets you repeat commands in a chain any number of
times. So to create 4 cottages in a row you would use the following
2015-06-07 15:22:30 +02:00
statement:
2013-12-31 22:09:50 +01:00
2015-01-03 21:57:30 +01:00
cottage().right(8).times(4);
2013-12-31 22:09:50 +01:00
2015-06-07 15:22:30 +02:00
… which will build a cottage, then move right 8 blocks, then do it
2015-01-03 21:57:30 +01:00
again 4 times over so that at the end you will have 4 cottages in a
2015-06-07 15:22:30 +02:00
row. What's more, the `times()` method can be called more than once in
2015-01-03 21:57:30 +01:00
a chain. So if you wanted to create a *grid* of 20 houses ( 4 x 5 ),
2015-06-07 15:22:30 +02:00
you would do so using the following statement:
2013-12-31 22:09:50 +01:00
2015-01-03 21:57:30 +01:00
cottage().right(8).times(4).fwd(8).left(32).times(5);
2013-12-28 09:44:40 +01:00
2015-06-07 15:22:30 +02:00
… breaking it down …
2013-12-24 23:47:57 +01:00
2015-01-03 21:57:30 +01:00
1. The first 3 calls in the chain ( `cottage()` , `right(8)` , `times(4)` ) build a single row of 4 cottages.
2013-12-31 19:21:40 +01:00
2015-06-07 15:22:30 +02:00
2. The last 3 calls in the chain ( `fwd(8)` , `left(32)` , `times(5)` ) move the drone forward 8 then left 32 blocks (4 x 8) to return to the original X coordinate, then everything in the chain is repeated again 5 times so that in the end, we have a grid of 20 cottages, 4 x 5. Normally this would require a nested loop but the `times()` method does away with the need for loops when repeating builds.
2013-12-31 19:21:40 +01:00
2015-06-07 15:22:30 +02:00
Another example: This statement creates a row of trees 2 by 3:
2013-12-31 19:21:40 +01:00
2015-01-03 21:57:30 +01:00
oak().right(10).times(2).left(20).fwd(10).times(3)
2013-12-31 19:21:40 +01:00
2015-06-07 15:22:30 +02:00
… You can see the results below.
2013-12-31 19:21:40 +01:00
2015-01-03 21:57:30 +01:00
![times example 1 ](img/times-trees.png )
2013-12-31 19:21:40 +01:00
2015-01-03 21:57:30 +01:00
### Drone.arc() method
2013-12-31 21:12:57 +01:00
2015-01-03 21:57:30 +01:00
The arc() method can be used to create 1 or more 90 degree arcs in the
horizontal or vertical planes. This method is called by cylinder() and
cylinder0() and the sphere() and sphere0() methods.
2013-12-31 21:12:57 +01:00
2015-01-03 21:57:30 +01:00
#### Parameters
2013-12-31 21:12:57 +01:00
2015-01-03 21:57:30 +01:00
arc() takes a single parameter - an object with the following named properties...
2013-12-31 21:12:57 +01:00
2015-01-03 21:57:30 +01:00
* radius - The radius of the arc.
* blockType - The type of block to use - this is the block Id only (no meta). See [Data Values][dv].
* meta - The metadata value. See [Data Values][dv].
* orientation (default: 'horizontal' ) - the orientation of the arc - can be 'vertical' or 'horizontal'.
* stack (default: 1 ) - the height or length of the arc (depending on the orientation - if orientation is horizontal then this parameter refers to the height, if vertical then it refers to the length ).
* strokeWidth (default: 1 ) - the width of the stroke (how many blocks) - if drawing nested arcs it's usually a good idea to set strokeWidth to at least 2 so that there are no gaps between each arc. The arc method uses a [bresenham algorithm][bres] to plot points along the circumference.
* fill - If true (or present) then the arc will be filled in.
* quadrants (default: `{topleft:true,topright:true,bottomleft:true,bottomright:true}` - An object with 4 properties indicating which of the 4 quadrants of a circle to draw. If the quadrants property is absent then all 4 quadrants are drawn.
2013-12-31 21:12:57 +01:00
2015-01-03 21:57:30 +01:00
#### Examples
2013-12-31 21:12:57 +01:00
2015-01-03 21:57:30 +01:00
To draw a 1/4 circle (top right quadrant only) with a radius of 10 and
stroke width of 2 blocks ...
2013-12-31 21:12:57 +01:00
2015-01-03 21:57:30 +01:00
arc({blockType: blocks.iron,
meta: 0,
radius: 10,
strokeWidth: 2,
quadrants: { topright: true },
orientation: 'vertical',
stack: 1,
fill: false
} );
2013-12-31 21:12:57 +01:00
2015-01-03 21:57:30 +01:00
![arc example 1 ](img/arcex1.png )
2013-12-31 21:12:57 +01:00
2015-01-03 21:57:30 +01:00
[bres]: http://en.wikipedia.org/wiki/Midpoint_circle_algorithm
[dv]: http://www.minecraftwiki.net/wiki/Data_values
2013-12-31 21:12:57 +01:00
2015-01-03 21:57:30 +01:00
### Drone.bed() method
Creates a bed. The foot of the bed will be at the drone's location and
the head of the bed will extend away from the drone.
2013-12-31 21:12:57 +01:00
#### Example
2015-01-03 21:57:30 +01:00
To create a bed at the in-game prompt, look at a block then type:
2014-02-04 22:36:00 +01:00
2015-01-03 21:57:30 +01:00
```javascript
/js bed()
2014-02-04 22:36:00 +01:00
```
2013-12-31 21:12:57 +01:00
2015-01-03 21:57:30 +01:00
Like most Drone methods, this returns the drone so it can be chained like so:
2013-12-31 21:12:57 +01:00
2015-01-03 21:57:30 +01:00
```javascript
this
.fwd(3)
.bed()
.back(3)
```
### Drone.blocktype() method
2013-12-31 21:12:57 +01:00
2015-01-03 21:57:30 +01:00
Creates the text out of blocks. Useful for large-scale in-game signs.
2013-12-31 21:12:57 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* message - The message to create - (use `\n` for newlines)
* foregroundBlock (default: black wool) - The block to use for the foreground
* backgroundBlock (default: none) - The block to use for the background
2013-12-31 21:12:57 +01:00
2015-01-03 21:57:30 +01:00
#### Example
2013-12-31 21:12:57 +01:00
2015-01-03 21:57:30 +01:00
To create a 2-line high message using glowstone...
2013-12-31 21:12:57 +01:00
2015-01-16 22:20:34 +01:00
blocktype('Hello\nWorld', blocks.glowstone);
2013-12-31 21:12:57 +01:00
2015-01-03 21:57:30 +01:00
![blocktype example][imgbt1]
2013-12-31 21:12:57 +01:00
2015-01-03 21:57:30 +01:00
[imgbt1]: img/blocktype1.png
2013-12-31 21:12:57 +01:00
2015-01-03 21:57:30 +01:00
### Copy & Paste using Drone
2013-12-31 21:12:57 +01:00
2015-01-03 21:57:30 +01:00
A drone can be used to copy and paste areas of the game world.
2013-12-31 21:12:57 +01:00
2015-01-10 12:45:08 +01:00
#### Deprecated
As of January 10 2015 the copy-paste functions in Drone are no longer
supported. Copy/Paste is:
1. Difficult to do correctly in a way which works for both Minecraft 1.7 and 1.8
due to how blocks changed in 1.8
2. Not aligned with the purpose of ScriptCraft's Drone module which is to provide
a simple set of functions for scripting and in-game building.
2015-01-03 21:57:30 +01:00
### Drone.copy() method
2013-12-31 21:12:57 +01:00
2015-01-03 21:57:30 +01:00
Copies an area so it can be pasted elsewhere. The name can be used for
pasting the copied area elsewhere...
2013-12-31 21:12:57 +01:00
2015-01-03 21:57:30 +01:00
#### Parameters
2013-12-31 19:21:40 +01:00
2015-01-03 21:57:30 +01:00
* name - the name to be given to the copied area (used by `paste` )
* width - the width of the area to copy
* height - the height of the area to copy
* length - the length of the area (extending away from the drone) to copy
2013-12-28 09:44:40 +01:00
2015-01-03 21:57:30 +01:00
#### Example
2013-12-24 23:47:57 +01:00
2015-01-03 21:57:30 +01:00
drone.copy('somethingCool',10,5,10 ).right(12 ).paste('somethingCool' );
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
### Drone.paste() method
2013-12-24 23:47:57 +01:00
2015-01-03 21:57:30 +01:00
Pastes a copied area to the current location.
2013-12-24 23:47:57 +01:00
2015-01-03 21:57:30 +01:00
#### Example
2013-12-24 23:47:57 +01:00
2015-01-03 21:57:30 +01:00
To copy a 10x5x10 area (using the drone's coordinates as the starting
point) into memory. the copied area can be referenced using the name
'somethingCool'. The drone moves 12 blocks right then pastes the copy.
2013-12-24 23:47:57 +01:00
2015-01-03 21:57:30 +01:00
drone.copy('somethingCool',10,5,10 )
.right(12 )
.paste('somethingCool' );
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
### Drone.cylinder() method
2013-12-28 09:44:40 +01:00
2015-01-03 21:57:30 +01:00
A convenience method for building cylinders. Building begins radius blocks to the right and forward.
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
#### Parameters
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
* block - the block id - e.g. 6 for an oak sapling or '6:2' for a birch sapling. Alternatively you can use any one of the `blocks` values e.g. `blocks.sapling.birch`
* radius
* height
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
#### Example
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
To create a cylinder of Iron 7 blocks in radius and 1 block high...
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
cylinder(blocks.iron, 7 , 1);
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
![cylinder example ](img/cylinderex1.png )
2014-02-04 22:36:00 +01:00
2015-01-03 21:57:30 +01:00
### Drone.cylinder0() method
2013-12-28 09:44:40 +01:00
2015-01-03 21:57:30 +01:00
A version of cylinder that hollows out the middle.
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
#### Example
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
To create a hollow cylinder of Iron 7 blocks in radius and 1 block high...
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
cylinder0(blocks.iron, 7, 1);
2013-12-28 09:44:40 +01:00
2015-01-03 21:57:30 +01:00
![cylinder0 example ](img/cylinder0ex1.png )
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
### Drone.door() method
2013-12-28 09:44:40 +01:00
2015-01-03 21:57:30 +01:00
create a door - if a parameter is supplied an Iron door is created otherwise a wooden door is created.
2013-12-18 00:49:00 +01:00
2013-12-28 09:44:40 +01:00
#### Parameters
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
* doorType (optional - default wood) - If a parameter is provided then the door is Iron.
2013-12-18 00:49:00 +01:00
2013-12-28 09:44:40 +01:00
#### Example
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
To create a wooden door at the crosshairs/drone's location...
2013-12-24 01:15:17 +01:00
2015-01-03 21:57:30 +01:00
var drone = new Drone(self);
drone.door();
2013-12-24 01:15:17 +01:00
2015-01-03 21:57:30 +01:00
To create an iron door...
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
drone.door( blocks.door_iron );
2014-02-04 22:36:00 +01:00
2015-01-03 21:57:30 +01:00
![iron door ](img/doorex1.png )
2013-12-28 09:44:40 +01:00
2015-01-03 21:57:30 +01:00
### Drone.door_iron() method
2013-12-28 09:44:40 +01:00
2015-01-03 21:57:30 +01:00
create an Iron door.
2013-12-28 09:44:40 +01:00
2015-01-03 21:57:30 +01:00
### Drone.door2() method
2013-12-28 09:44:40 +01:00
2015-01-03 21:57:30 +01:00
Create double doors (left and right side)
2013-12-28 09:44:40 +01:00
2015-01-03 21:57:30 +01:00
#### Parameters
2013-12-28 09:44:40 +01:00
2015-01-03 21:57:30 +01:00
* doorType (optional - default wood) - If a parameter is provided then the door is Iron.
2013-12-28 09:44:40 +01:00
2015-01-03 21:57:30 +01:00
#### Example
2014-02-10 21:55:32 +01:00
2015-01-03 21:57:30 +01:00
To create double-doors at the cross-hairs/drone's location...
2014-02-10 21:55:32 +01:00
2015-01-03 21:57:30 +01:00
drone.door2();
2014-02-10 21:55:32 +01:00
2015-01-03 21:57:30 +01:00
![double doors ](img/door2ex1.png )
2014-02-10 21:55:32 +01:00
2015-01-03 21:57:30 +01:00
### Drone.door2_iron() method
Create double iron doors
### Drone.firework() method
Launches a firework at the drone's location.
2014-02-10 21:55:32 +01:00
#### Example
2015-01-03 21:57:30 +01:00
To launch a firework:
2014-08-23 14:40:50 +02:00
2015-01-03 21:57:30 +01:00
var drone = new Drone(self);
drone.firework();
2014-08-23 14:40:50 +02:00
2015-01-03 21:57:30 +01:00
### Drone.garden() method
2014-08-23 14:40:50 +02:00
2015-01-03 21:57:30 +01:00
places random flowers and long grass (similar to the effect of placing bonemeal on grass)
2014-08-23 14:40:50 +02:00
2015-01-03 21:57:30 +01:00
#### Parameters
2014-02-11 22:10:56 +01:00
2015-01-03 21:57:30 +01:00
* width - the width of the garden
* length - how far from the drone the garden extends
2014-02-11 22:10:56 +01:00
#### Example
2015-01-03 21:57:30 +01:00
To create a garden 10 blocks wide by 5 blocks long...
2014-08-23 14:40:50 +02:00
2015-01-03 21:57:30 +01:00
garden(10,5);
2014-08-23 14:40:50 +02:00
2015-01-03 21:57:30 +01:00
![garden example ](img/gardenex1.png )
2014-08-23 14:40:50 +02:00
2015-01-03 21:57:30 +01:00
### Drone.ladder() method
2014-05-20 01:05:38 +02:00
2015-01-03 21:57:30 +01:00
Creates a ladder extending skyward.
2014-05-20 01:05:38 +02:00
2015-01-03 21:57:30 +01:00
#### Parameters
2014-10-12 19:34:40 +02:00
2015-01-03 21:57:30 +01:00
* height (optional - default 1)
2014-10-12 19:34:40 +02:00
2015-01-03 21:57:30 +01:00
#### Example
2014-10-12 19:34:40 +02:00
2015-01-03 21:57:30 +01:00
To create a ladder extending 10 blocks high:
2014-10-12 19:34:40 +02:00
2015-01-03 21:57:30 +01:00
var drone = new Drone(self);
drone.ladder(10)
2014-10-05 18:29:04 +02:00
2015-01-03 21:57:30 +01:00
At the in-game prompt, look at a block and then type:
2014-10-05 18:29:04 +02:00
2015-01-03 21:57:30 +01:00
/js ladder(10)
2014-10-05 18:29:04 +02:00
2015-01-03 21:57:30 +01:00
A ladder 10 blocks high will be created at the point you were looking at.
2014-10-05 18:29:04 +02:00
2015-01-03 21:57:30 +01:00
#### Since
##### 3.0.3
### Drone Movement
2014-10-05 18:29:04 +02:00
2015-01-03 21:57:30 +01:00
Drones can move freely in minecraft's 3-D world. You control the
Drone's movement using any of the following methods..
2014-10-05 18:29:04 +02:00
2015-01-03 21:57:30 +01:00
* up()
* down()
* left()
* right()
* fwd()
* back()
* turn()
2014-10-18 13:08:00 +02:00
2015-01-03 21:57:30 +01:00
... Each of these methods takes a single optional parameter
`numBlocks` - the number of blocks to move in the given direction. If
no parameter is given, the default is 1.
2014-10-18 13:08:00 +02:00
2015-01-03 21:57:30 +01:00
To change direction use the `turn()` method which also takes a single
optional parameter (numTurns) - the number of 90 degree turns to
make. Turns are always clock-wise. If the drone is facing north, then
drone.turn() will make the turn face east. If the drone is facing east
then drone.turn(2) will make the drone turn twice so that it is facing
west.
2014-10-18 13:08:00 +02:00
2015-01-03 21:57:30 +01:00
### Drone Positional Info
2014-10-18 13:08:00 +02:00
2015-01-03 21:57:30 +01:00
* getLocation() - Returns a native Java Location object for the drone
2014-10-18 13:08:00 +02:00
2015-01-03 21:57:30 +01:00
### Drone Markers
2014-01-04 19:39:49 +01:00
2015-01-03 21:57:30 +01:00
Markers are useful when your Drone has to do a lot of work. You can
set a check-point and return to the check-point using the move()
method. If your drone is about to undertake a lot of work -
e.g. building a road, skyscraper or forest you should set a
check-point before doing so if you want your drone to return to its
current location.
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
A 'start' checkpoint is automatically created when the Drone is first created.
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
Markers are created and returned to using the followng two methods...
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
* chkpt - Saves the drone's current location so it can be returned to later.
* move - moves the drone to a saved location. Alternatively you can provide a Java Location object or x,y,z and direction parameters.
2013-12-25 14:39:04 +01:00
2015-01-03 21:57:30 +01:00
#### Parameters
2013-12-25 14:39:04 +01:00
2015-01-03 21:57:30 +01:00
* name - the name of the checkpoint to save or return to.
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
#### Example
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
drone.chkpt('town-square');
//
// the drone can now go off on a long excursion
//
for ( i = 0; i< 100 ; i + + ) {
drone.fwd(12).box(6);
}
//
// return to the point before the excursion
//
drone.move('town-square');
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
### Drone.prism() method
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
Creates a prism. This is useful for roofs on houses.
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
#### Parameters
2013-12-24 23:47:57 +01:00
2015-01-03 21:57:30 +01:00
* block - the block id - e.g. 6 for an oak sapling or '6:2' for a birch sapling.
Alternatively you can use any one of the `blocks` values e.g. `blocks.sapling.birch`
* width - the width of the prism
* length - the length of the prism (will be 2 time its height)
2013-12-24 23:47:57 +01:00
2015-01-03 21:57:30 +01:00
#### Example
2013-12-24 23:47:57 +01:00
2015-01-03 21:57:30 +01:00
prism(blocks.oak,3,12);
2013-12-24 23:47:57 +01:00
2015-01-03 21:57:30 +01:00
![prism example ](img/prismex1.png )
2013-12-24 23:47:57 +01:00
2015-01-03 21:57:30 +01:00
### Drone.prism0() method
A variation on `prism` which hollows out the inside of the prism. It
uses the same parameters as `prism` .
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
### Drone.rand() method
2014-01-04 19:39:49 +01:00
2015-01-03 21:57:30 +01:00
rand takes either an array (if each blockid has the same chance of occurring) or an object where each property is a blockid and the value is it's weight (an integer)
2014-01-04 19:39:49 +01:00
2015-01-03 21:57:30 +01:00
#### Example
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
place random blocks stone, mossy stone and cracked stone (each block has the same chance of being picked)
2014-01-04 19:39:49 +01:00
2015-01-03 21:57:30 +01:00
rand( [blocks.brick.stone, blocks.brick.mossy, blocks.brick.cracked ],w,d,h)
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
to place random blocks stone has a 50% chance of being picked,
2014-01-04 19:39:49 +01:00
2015-01-03 21:57:30 +01:00
var distribution = {};
distribution[ blocks.brick.stone ] = 5;
distribution[ blocks.brick.mossy ] = 3;
distribution[ blocks.brick.cracked ] = 2;
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
rand( distribution, width, height, depth)
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
regular stone has a 50% chance, mossy stone has a 30% chance and cracked stone has just a 20% chance of being picked.
2013-12-24 01:15:17 +01:00
2015-01-03 21:57:30 +01:00
### Drone.wallsign() method
2014-01-04 19:39:49 +01:00
2015-01-03 21:57:30 +01:00
Creates a wall sign (A sign attached to a wall)
2013-12-24 01:15:17 +01:00
2014-01-04 19:39:49 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* message - can be a string or an array of strings
2013-12-18 00:49:00 +01:00
2014-01-04 19:39:49 +01:00
#### Example
2015-01-03 21:57:30 +01:00
drone.wallsign(['Welcome','to','Scriptopia']);
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
![wall sign ](img/signex2.png )
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
### Drone.signpost() method
2014-01-04 19:39:49 +01:00
2015-01-03 21:57:30 +01:00
Creates a free-standing signpost
2013-12-18 00:49:00 +01:00
2014-01-04 19:39:49 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* message - can be a string or an array of strings
2013-12-18 00:49:00 +01:00
2014-01-04 19:39:49 +01:00
#### Example
2015-01-03 21:57:30 +01:00
drone.signpost(['Hello','World']);
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
![ground sign ](img/signex1.png )
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
### Drone.sign() method
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
Deprecated: Use signpost() or wallsign() methods instead.
2014-01-04 19:39:49 +01:00
2015-01-03 21:57:30 +01:00
Signs must use block 63 (stand-alone signs) or 68 (signs on walls)
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
#### Parameters
2014-12-28 16:07:32 +01:00
2015-01-03 21:57:30 +01:00
* message - can be a string or an array of strings.
* block - can be 63 or 68
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
#### Example
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
To create a free-standing sign...
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
drone.sign(["Hello","World"], blocks.sign_post);
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
![ground sign ](img/signex1.png )
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
... to create a wall mounted sign...
2014-01-04 19:39:49 +01:00
2015-01-03 21:57:30 +01:00
drone.sign(["Welcome","to","Scriptopia"], blocks.sign );
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
![wall sign ](img/signex2.png )
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
### Drone.sphere() method
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
Creates a sphere.
2013-12-18 00:49:00 +01:00
2014-01-04 19:39:49 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* block - The block the sphere will be made of.
* radius - The radius of the sphere.
2014-01-04 19:39:49 +01:00
2015-01-03 21:57:30 +01:00
#### Example
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
To create a sphere of Iron with a radius of 10 blocks...
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
sphere( blocks.iron, 10);
2014-12-28 16:07:32 +01:00
2015-01-03 21:57:30 +01:00
![sphere example ](img/sphereex1.png )
2014-12-28 16:07:32 +01:00
2015-01-03 21:57:30 +01:00
Spheres are time-consuming to make. You *can* make large spheres (250 radius) but expect the
server to be very busy for a couple of minutes while doing so.
2014-12-28 16:07:32 +01:00
2015-01-03 21:57:30 +01:00
### Drone.sphere0() method
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
Creates an empty sphere.
2014-01-04 19:39:49 +01:00
2015-01-03 21:57:30 +01:00
#### Parameters
* block - The block the sphere will be made of.
* radius - The radius of the sphere.
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
#### Example
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
To create a sphere of Iron with a radius of 10 blocks...
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
sphere0( blocks.iron, 10);
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
Spheres are time-consuming to make. You *can* make large spheres (250 radius) but expect the
server to be very busy for a couple of minutes while doing so.
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
### Drone.hemisphere() method
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
Creates a hemisphere. Hemispheres can be either north or south.
2014-01-04 19:39:49 +01:00
2015-01-03 21:57:30 +01:00
#### Parameters
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
* block - the block the hemisphere will be made of.
* radius - the radius of the hemisphere
* northSouth - whether the hemisphere is 'north' or 'south'
2014-01-04 19:39:49 +01:00
2015-01-03 21:57:30 +01:00
#### Example
2014-12-28 16:07:32 +01:00
2015-01-03 21:57:30 +01:00
To create a wood 'north' hemisphere with a radius of 7 blocks...
2014-12-28 16:07:32 +01:00
2015-01-03 21:57:30 +01:00
hemisphere(blocks.oak, 7, 'north');
2014-12-28 16:07:32 +01:00
2015-01-03 21:57:30 +01:00
![hemisphere example ](img/hemisphereex1.png )
2014-12-28 16:07:32 +01:00
2015-01-03 21:57:30 +01:00
### Drone.hemisphere0() method
2014-12-30 19:12:10 +01:00
2015-01-03 21:57:30 +01:00
Creates a hollow hemisphere. Hemispheres can be either north or south.
2014-12-30 19:12:10 +01:00
2015-01-03 21:57:30 +01:00
#### Parameters
2014-12-28 16:07:32 +01:00
2015-01-03 21:57:30 +01:00
* block - the block the hemisphere will be made of.
* radius - the radius of the hemisphere
* northSouth - whether the hemisphere is 'north' or 'south'
2014-12-28 16:07:32 +01:00
2015-01-03 21:57:30 +01:00
#### Example
2014-12-28 16:07:32 +01:00
2015-01-03 21:57:30 +01:00
To create a glass 'north' hemisphere with a radius of 20 blocks...
2014-12-28 16:07:32 +01:00
2015-01-03 21:57:30 +01:00
hemisphere0(blocks.glass, 20, 'north');
2014-12-30 19:12:10 +01:00
2015-01-03 21:57:30 +01:00
![hemisphere example ](img/hemisphereex2.png )
2014-12-30 19:12:10 +01:00
2015-01-03 21:57:30 +01:00
### Drone.stairs() function
2014-12-28 16:07:32 +01:00
2015-01-03 21:57:30 +01:00
The stairs() function will build a flight of stairs
2013-12-18 00:49:00 +01:00
2014-01-04 19:39:49 +01:00
#### Parameters
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
* blockType - should be one of the following:
* blocks.stairs.oak
* blocks.stairs.cobblestone
* blocks.stairs.brick
* blocks.stairs.stone
* blocks.stairs.nether
* blocks.stairs.sandstone
* blocks.stairs.spruce
* blocks.stairs.birch
* blocks.stairs.jungle
* blocks.stairs.quartz
* width - The width of the staircase - default is 1
* height - The height of the staircase - default is 1
2013-12-18 00:49:00 +01:00
2014-01-04 19:39:49 +01:00
#### Example
2015-01-03 21:57:30 +01:00
To build an oak staircase 3 blocks wide and 5 blocks tall:
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
/js stairs(blocks.stairs.oak, 3, 5)
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
Staircases do not have any blocks beneath them.
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
### Drone Trees methods
2014-01-04 19:39:49 +01:00
2015-01-03 21:57:30 +01:00
* oak()
* spruce()
* birch()
* jungle()
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
#### Example
2014-01-04 19:39:49 +01:00
2015-01-03 21:57:30 +01:00
To create 4 trees in a row, point the cross-hairs at the ground then type `/js ` and ...
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
up( ).oak( ).right(8 ).spruce( ).right(8 ).birch( ).right(8 ).jungle( );
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
Trees won't always generate unless the conditions are right. You
should use the tree methods when the drone is directly above the
ground. Trees will usually grow if the drone's current location is
occupied by Air and is directly above an area of grass (That is why
the `up()` method is called first).
2014-12-28 16:07:32 +01:00
2015-01-03 21:57:30 +01:00
![tree example ](img/treeex1.png )
2014-12-28 16:07:32 +01:00
2015-01-03 21:57:30 +01:00
None of the tree methods require parameters. Tree methods will only be
successful if the tree is placed on grass in a setting where trees can
grow.
2014-12-28 16:07:32 +01:00
2015-01-16 22:20:34 +01:00
### Drone.castle() method
Creates a Castle. A castle is just a big wide fort with 4 taller forts at each corner.
See also Drone.fort() method.
#### Parameters
* side - How many blocks wide and long the castle will be (default: 24. Must be greater than 19)
* height - How tall the castle will be (default: 10. Must be geater than 7)
#### Example
At the in-game prompt you can create a castle by looking at a block and typing:
```javascript
/js castle()
```
Alternatively you can create a new Drone object from a Player or Location object and call the castle() method.
```javascript
var d = new Drone(player);
d.castle();
```
![castle example ](img/castleex1.png )
### Drone.chessboard() method
Creates a tile pattern of given block types and size
#### Parameters
* whiteBlock - (optional: default blocks.wool.white)
* blackBlock - (optional: default blocks.wool.black)
* width - width of the chessboard
* length - length of the chessboard
#### Example
At the in-game prompt you can create a chessboard by looking at a block and typing:
```javascript
/js chessboard()
```
Alternatively you can create a new Drone object from a Player or Location object and call the chessboard() method.
```javascript
var d = new Drone(player);
d.chessboard();
```
![chessboard example ](img/chessboardex1.png )
### Drone.cottage() method
Creates a simple but cosy dwelling.
#### Example
At the in-game prompt you can create a cottage by looking at a block and typing:
```javascript
/js cottage()
```
Alternatively you can create a new Drone object from a Player or Location object and call the cottage() method.
```javascript
var d = new Drone(player);
d.cottage();
```
![cottage example ](img/cottageex1.png )
### Drone.cottage_road() method
Creates a tree-lined avenue with cottages on both sides.
#### Parameters
* numberOfCottages: The number of cottages to build in total (optional: default 6)
#### Example
At the in-game prompt you can create a cottage road by looking at a block and typing:
```javascript
/js cottage_road()
```
Alternatively you can create a new Drone object from a Player or Location object and call the cottage_road() method.
```javascript
var d = new Drone(player);
d.cottage_road();
```
![cottage_road example ](img/cottageroadex1.png )
### Drone.dancefloor() method
Create an animated dance floor of colored tiles some of which emit light.
The tiles change color every second creating a strobe-lit dance-floor effect.
See it in action here [http://www.youtube.com/watch?v=UEooBt6NTFo][ytdance]
2015-01-16 22:23:22 +01:00
#### Parameters
2015-01-16 22:20:34 +01:00
* width - how wide the dancefloor should be (optional: default 5)
* length - how long the dancefloor should be (optional: default 5)
* duration - the time duration for which the lights should change (optional: default 30 seconds)
#### Example
At the in-game prompt you can create a dancefloor by looking at a block and typing:
```javascript
/js dancefloor()
```
Alternatively you can create a new Drone object from a Player or Location object and call the dancefloor() method.
```javascript
var d = new Drone(player);
d.dancefloor();
```
[ytdance]: http://www.youtube.com/watch?v=UEooBt6NTFo
![dancefloor example ](img/dancefloorex1.png )
### Drone.fort() method
Constructs a medieval fort.
#### Parameters
* side - How many blocks whide and long the fort will be (default: 18 . Must be greater than 9)
* height - How tall the fort will be (default: 6 . Must be greater than 3)
#### Example
At the in-game prompt you can create a fort by looking at a block and typing:
```javascript
/js fort()
```
Alternatively you can create a new Drone object from a Player or Location object and call the fort() method.
```javascript
var d = new Drone(player);
d.fort();
```
![fort example ](img/fortex1.png )
### Drone.hangtorch() method
Adds a hanging torch to a wall. This method will try to hang a torch
against a wall. It will traverse backwards until it finds a block
adjacent to air and hang the torch. If it can't find a block next to
air it will log a message in the server.
#### Example
At the in-game prompt you can create a hanging torch by looking at a
block and typing:
```javascript
/js hangtorch()
```
Alternatively you can create a new Drone object from a Player or
Location object and call the hangtorch() method.
```javascript
var d = new Drone(player);
d.hangtorch();
```
### Drone.lcdclock() method.
Constructs a large LCD Clock. The clock will display the current time of day.
The clock can be stopped by calling the stopLCD() method of the Drone which created the clock.
#### Parameters
* foregroundBlock (Optional - default is blocks.glowstone)
* backgroundBlock (Optional - default is blocks.wool.black)
* borderBlock (Optional - a border around the LCD display - default none)
#### Example
At the in-game prompt you can create a LCD clock by looking at a block and typing:
```javascript
/js var clock = lcdclock()
/js clock.stopLCD()
```
Alternatively you can create a new Drone object from a Player or Location object and call the lcdclock() method.
```javascript
var d = new Drone(player);
d.lcdclock();
d.stopLCD();
```
![lcdclock example ](img/lcdclockex1.png )
### Drone.logojs() method
Constructs a large Javascript Logo (black JS on Yellow background)
See: https://raw.github.com/voodootikigod/logo.js/master/js.png
#### Parameters
* foregroundBlock (Optional - default is blocks.wool.gray)
* backgroundBlock (Optional - default is blocks.gold)
### Drone.maze() method
Maze generation based on http://rosettacode.org/wiki/Maze_generation#JavaScript
#### Parameters
* width (optional - default 10)
* length (optional - default 10)
#### Example
At the in-game prompt you can create a maze by looking at a block and typing:
```javascript
/js maze()
```
Alternatively you can create a new Drone object from a Player or Location object and call the maze() method.
```javascript
var d = new Drone(player);
d.maze();
```
![maze example ](img/mazeex1.png )
2015-01-03 21:57:30 +01:00
### Drone.rainbow() method
2014-12-28 16:07:32 +01:00
2015-01-03 21:57:30 +01:00
Creates a Rainbow.
2014-12-28 16:07:32 +01:00
2015-01-03 21:57:30 +01:00
#### Parameters
2014-12-28 16:07:32 +01:00
2015-01-03 21:57:30 +01:00
* radius (optional - default:18) - The radius of the rainbow
2014-12-28 16:07:32 +01:00
2015-01-03 21:57:30 +01:00
#### Example
2015-01-16 22:20:34 +01:00
At the in-game prompt you can create a rainbow by looking at a block and typing:
```javascript
/js rainbow()
```
Alternatively you can create a new Drone object from a Player or Location object and call the rainbow() method.
```javascript
var d = new Drone(player);
d.rainbow(30);
```
2014-12-28 16:07:32 +01:00
2015-01-03 21:57:30 +01:00
![rainbow example ](img/rainbowex1.png )
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
### Drone.spiral_stairs() method
2014-01-04 19:39:49 +01:00
2015-01-03 21:57:30 +01:00
Constructs a spiral staircase with slabs at each corner.
2013-12-18 00:49:00 +01:00
2014-01-04 19:39:49 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* stairBlock - The block to use for stairs, should be one of the following...
- 'oak'
- 'spruce'
- 'birch'
- 'jungle'
- 'cobblestone'
- 'brick'
- 'stone'
- 'nether'
- 'sandstone'
- 'quartz'
* flights - The number of flights of stairs to build.
2013-12-24 23:47:57 +01:00
2015-01-03 21:57:30 +01:00
![Spiral Staircase ](img/spiralstair1.png )
2013-12-24 23:47:57 +01:00
2015-01-03 21:57:30 +01:00
#### Example
2014-01-04 19:39:49 +01:00
2015-01-03 21:57:30 +01:00
To construct a spiral staircase 5 floors high made of oak...
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
spiral_stairs('oak', 5);
2013-12-18 00:49:00 +01:00
2015-01-16 22:20:34 +01:00
### Drone.temple() method
Constructs a mayan temple.
#### Parameters
* side - How many blocks wide and long the temple will be (default: 20)
#### Example
At the in-game prompt you can create a temple by looking at a block and typing:
```javascript
/js temple()
```
Alternatively you can create a new Drone object from a Player or Location object and call the temple() method.
```javascript
var d = new Drone(player);
d.temple();
```
![temple example ](img/templeex1.png )
2015-01-25 20:11:37 +01:00
## The at Module
The at module provides a single function `at()` which can be used to schedule
repeating (or non-repeating) tasks to be done at a particular time.
### at() function
The utils.at() function will perform a given task at a given time in the
(minecraft) day.
#### Parameters
* time24hr : The time in 24hr form - e.g. 9:30 in the morning is '09:30' while
9:30 pm is '21:30', midnight is '00:00' and midday is '12:00'
* callback : A javascript function which will be invoked at the given time.
* worlds : (optional) An array of worlds. Each world has its own clock. If no array of worlds is specified, all the server's worlds are used.
* repeat : (optional) true or false, default is true (repeat the task every day)
#### Example
To warn players when night is approaching:
```javascript
var utils = require('utils'),
at = require('at');
function warning(){
utils.players(function( player ) {
echo( player, 'The night is dark and full of terrors!' );
});
}
at('19:00', warning);
```
To run a task only once at the next given time:
```javascript
var utils = require('utils'),
at = require('at');
function wakeup(){
utils.players(function( player ) {
echo( player, "Wake Up Folks!" );
});
}
at('06:00', wakeup, null, false);
```
2015-01-03 21:57:30 +01:00
## Blocks Module
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
You hate having to lookup [Data Values][dv] when you use ScriptCraft's
Drone() functions. So do I. So I created this blocks object which is
a helper object for use in construction.
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
### Examples
2014-01-04 19:39:49 +01:00
2015-01-03 21:57:30 +01:00
box( blocks.oak ); // creates a single oak wood block
box( blocks.sand, 3, 2, 1 ); // creates a block of sand 3 wide x 2 high x 1 long
box( blocks.wool.green, 2 ); // creates a block of green wool 2 blocks wide
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
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. In addition, there's a convenience array `blocks.rainbow`
which is an array of the 7 colors of the rainbow (or closest
approximations).
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
The blocks module is globally exported by the Drone module.
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
## Fireworks Module
2014-02-19 01:15:44 +01:00
2015-01-03 21:57:30 +01:00
The fireworks module makes it easy to create fireworks using
ScriptCraft. The module has a single function `firework` which takes
a `org.bukkit.Location` as its 1 and only parameter.
2014-02-19 01:15:44 +01:00
2015-01-03 21:57:30 +01:00
### Examples
2014-02-19 01:15:44 +01:00
2015-01-03 21:57:30 +01:00
The module also extends the `Drone` object adding a `firework` method
so that fireworks can be created as a part of a Drone chain. For
Example....
2014-01-04 19:39:49 +01:00
2015-01-03 21:57:30 +01:00
/js firework()
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
... creates a single firework, while ....
2014-01-04 19:39:49 +01:00
2015-01-03 21:57:30 +01:00
/js firework().fwd(3).times(5)
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
... creates 5 fireworks in a row. Fireworks have also been added as a
possible option for the `arrow` module. To have a firework launch
where an arrow strikes...
2014-01-04 19:39:49 +01:00
2015-01-03 21:57:30 +01:00
/js arrows.firework()
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
To call the fireworks.firework() function directly, you must provide a
location. For example...
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
/js var fireworks = require('fireworks');
/js fireworks.firework( self.location );
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
![firework example ](img/firework.png )
2014-02-19 01:15:44 +01:00
2015-03-22 15:05:19 +01:00
## 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)
2015-01-24 20:42:52 +01:00
## Classroom Plugin
The `classroom` object contains a couple of utility functions for use
in a classroom setting. The goal of these functions is to make it
easier for tutors to facilitate ScriptCraft for use by students in a
classroom environment. Although granting ScriptCraft access to
students on a shared server is potentially risky (Students can
potentially abuse it), it is slighlty less risky than granting
operator privileges to each student. (Enterprising students will
quickly realise how to grant themselves and others operator privileges
once they have access to ScriptCraft).
The goal of this module is not so much to enforce restrictions
(security or otherwise) but to make it easier for tutors to setup a
shared server so students can learn Javascript. When scripting is
turned on, every player who joins the server will have a dedicated
directory into which they can save scripts. All scripts in such
directories are automatically watched and loaded into a global
variable named after the player.
So for example, if player 'walterh' joins the server, a `walterh`
global variable is created. If a file `greet.js` with the following
content is dropped into the `scriptcraft/players/walterh`
directory...
```javascript
exports.hi = function( player ){
echo( player, 'Hi ' + player.name);
};
```
... then it can be invoked like this: `/js walterh.hi( self )` . This
lets every player/student create their own functions without having
naming collisions.
It's strongly recommended that the
`scriptcraft/players/` directory is shared so that
others can connect to it and drop .js files into their student
directories. On Ubuntu, select the folder in Nautilus (the default
file browser) then right-click and choose *Sharing Options* , check the
*Share this folder* checkbox and the *Allow others to create and
delete files* and *Guest access* checkboxes. Click *Create Share*
button to close the sharing options dialog. Students can then access
the shared folder as follows...
* Windows: Open Explorer, Go to \\{serverAddress}\players\
* Macintosh: Open Finder, Go to smb://{serverAddress}/players/
* Linux: Open Nautilus, Go to smb://{serverAddress}/players/
... where {serverAddress} is the ip address of the server (this is
displayed to whoever invokes the classroom.allowScripting() function.)
### jsp classroom command
The `jsp classroom` command makes it easy for tutors to turn on or off
classroom mode. This command can only be used by server operators. To
turn on classroom mode (enable scripting for all players):
jsp classroom on
To turn off classroom mode (disable scripting for all players):
jsp classroom off
The `jsp classroom` command is provided as an easier way to turn on or
off classroom mode. This should be used in preference to the
classroom.allowScripting() function which is provided only for
programmatically enabling or disabling classroom mode.
### classroom.allowScripting() function
Allow or disallow anyone who connects to the server (or is already
connected) to use ScriptCraft. This function is preferable to granting 'ops' privileges
to every student in a Minecraft classroom environment.
Whenever any file is added/edited or removed from any of the players/
directories the contents are automatically reloaded. This is to
facilitate quick turnaround time for students getting to grips with
Javascript.
#### Parameters
* canScript : true or false
#### Example
To allow all players (and any players who connect to the server) to
use the `js` and `jsp` commands...
/js classroom.allowScripting( true, self )
To disallow scripting (and prevent players who join the server from using the commands)...
/js classroom.allowScripting( false, self )
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.
2015-01-03 21:57:30 +01:00
## Asynchronous Input Module
2014-02-19 01:15:44 +01:00
2015-01-03 21:57:30 +01:00
The `input` module provides a simple way to prompt players for input at the
in-game prompt. In Javascript browser environments the `prompt()` function provides
a way to block execution and ask the user for input. Execution is blocked until the user
provides input using the modal dialog and clicks OK. Unfortunately Minecraft provides no
equivalent modal dialog which can be used to gather player text input. The only way to gather text
input from the player in Minecraft is to do so asynchronously. That is - a prompt message can be
sent to the player but the player is not obliged to provide input immediately, nor does the program
execution block until the player does so.
2014-01-04 19:39:49 +01:00
2015-01-03 21:57:30 +01:00
So ScriptCraft has no `prompt()` implementation because `prompt()` is a synchronous function and
Minecraft's API provides no equivalent functions or classes which can be used to implement this synchronously.
The Minecraft API does however have a 'Conversation' API which allows for prompting of the player and asynchronously gathering text input from the player.
2014-12-28 16:07:32 +01:00
2015-01-03 21:57:30 +01:00
This new `input()` function is best illustrated by example. The following code is for a number-guessing game:
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
```javascript
var input = require('input');
exports.numberguess = function(player){
var randomNumber = Math.ceil(Math.random() * 10);
input( player, 'Think of a number between 1 and 10 (q to quit)', function( guess, guesser, repeat ) {
if ( guess == 'q'){
return;
}
if ( +guess !== randomNumber ) {
if (+guess < randomNumber ) {
echo( guesser, 'Too low - guess again');
}
if (+guess > randomNumber ) {
echo( guesser, 'Too high - guess again');
}
repeat();
} else {
echo( guesser, 'You guessed correctly');
}
});
};
```
2014-01-04 19:39:49 +01:00
2015-01-03 21:57:30 +01:00
The `input()` function takes 3 parameters, the player, a prompt message and a callback which will be invoked when the player has entered some text at the in-game command prompt.
The callback is bound to an object which has the following properties:
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
* sender : The player who input the text
* value : The value of the text which has been input.
* message: The message prompt.
* repeat: A function which when invoked will repeat the original prompt. (this is for flow control)
2014-01-04 19:39:49 +01:00
2015-01-03 21:57:30 +01:00
The callback function as well as being bound to an object with the above properties (so you can use this.value inside your callback to get the value which has just been input), can also take the following parameters (in exact order):
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
* value
* sender
* repeat
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
The `value` parameter will be the same as `this.value` , the `repeat` parameter will be the same as `this.repeat` and so on.
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
## The recipes module
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
The Recipes module provides convenience functions for adding and removing recipes
from the game.
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
### Example
To add an EnderBow to the game (assumes there's an enchanted Item variable called enderBow)...
2014-01-04 19:39:49 +01:00
2015-01-03 21:57:30 +01:00
var recipes = require('recipes');
var items = require('items');
...
var enderBowRecipe = recipes.create( {
result: enderBow,
ingredients: {
E: items.enderPearl(1),
S: items.stick(1),
W: items.string(1)
},
shape: [ 'ESW',
'SEW',
'ESW' ]
} );
// add to server
var addedRecipe = server.addRecipe( enderBowRecipe );
// to remove...
server.removeRemove( addedRecipe );
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
## Http Module
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
For handling http requests. Not to be confused with the more robust
and functional 'http' module bundled with Node.js.
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
### http.request() function
2014-01-04 19:39:49 +01:00
2015-01-03 21:57:30 +01:00
The http.request() function will fetch a web address asynchronously (on a
separate thread)and pass the URL's response to a callback function
which will be executed synchronously (on the main thread). In this
way, http.request() can be used to fetch web content without blocking the
main thread of execution.
2013-12-18 00:49:00 +01:00
2014-01-04 19:39:49 +01:00
#### Parameters
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
* request: The request details either a plain URL e.g. "http://scriptcraft.js/sample.json" or an object with the following properties...
- url: The URL of the request.
- method: Should be one of the standard HTTP methods, GET, POST, PUT, DELETE (defaults to GET).
- params: A Javascript object with name-value pairs. This is for supplying parameters to the server.
* callback: The function to be called when the Web request has completed. This function takes the following parameters...
- responseCode: The numeric response code from the server. If the server did not respond with 200 OK then the response parameter will be undefined.
- response: A string (if the response is of type text) or object containing the HTTP response body.
2013-12-18 00:49:00 +01:00
2014-01-04 19:39:49 +01:00
#### Example
2015-01-03 21:57:30 +01:00
The following example illustrates how to use http.request to make a request to a JSON web service and evaluate its response...
2013-12-18 00:49:00 +01:00
2015-02-16 23:11:41 +01:00
```javascript
var jsResponse;
2015-05-09 15:25:07 +02:00
var http = require('request');
2015-02-16 23:11:41 +01:00
http.request('http://scriptcraftjs.org/sample.json',function(responseCode, responseBody){
jsResponse = JSON.parse( responseBody );
});
```
The following example illustrates a more complex use-case POSTing parameters to a CGI process on a server...
2014-01-04 19:39:49 +01:00
2015-02-16 23:11:41 +01:00
```javascript
var http = require('http');
http.request( {
url: 'http://pixenate.com/pixenate/pxn8.pl',
method: 'POST',
params: {script: '[]'}
},
function( responseCode, responseBody ) {
var jsObj = JSON.parse( responseBody );
});
```
2013-12-24 01:15:17 +01:00
2015-01-03 21:57:30 +01:00
## sc-mqtt module
2014-01-04 19:39:49 +01:00
2015-01-03 21:57:30 +01:00
This module provides a simple way to communicate with devices (such as Arduino)
using the popular lightweight [MQTT protocol][mqtt].
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
### Usage
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
This module can only be used if the separate `sc-mqtt.jar` file is
present in the CraftBukkit classpath. To use this module, you should
...
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
1. Download sc-mqtt.jar from < http: // scriptcraftjs . org / download / extras />
2. Save the file to the same directory where craftbukkit.jar resides.
3. Create a new batch file (windows-only) called
craftbukkit-sc-mqtt.bat and edit it to include the following
command...
2014-02-19 01:15:44 +01:00
2015-01-03 21:57:30 +01:00
```sh
java -classpath sc-mqtt.jar;craftbukkit.jar org.bukkit.craftbukkit.Main
```
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
If you're using Mac OS, create a new craftbukkit-sc-mqtt.command
file and edit it (using TextWrangler or another text editor) ...
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
```sh
java -classpath sc-mqtt.jar:craftbukkit.jar org.bukkit.craftbukkit.Main
```
2014-01-04 19:39:49 +01:00
2015-01-03 21:57:30 +01:00
4. Execute the craftbukkit-sc-mqtt batch file / command file to start
Craftbukkit. You can now begin using this module to send and receive
messages to/from a Net-enabled Arduino or any other device which uses
the [MQTT protocol][mqtt]
```javascript
var mqtt = require('sc-mqtt');
// create a new client
var client = mqtt.client( 'tcp://localhost:1883', 'uniqueClientId' );
// connect to the broker
client.connect( { keepAliveInterval: 15 } );
// publish a message to the broker
client.publish( 'minecraft', 'loaded' );
// subscribe to messages on 'arduino' topic
client.subscribe( 'arduino' );
// do something when an incoming message arrives...
client.onMessageArrived( function( topic, message ) {
console.log( 'Message arrived: topic=' + topic + ', message=' + message );
});
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
```
2014-01-04 19:39:49 +01:00
2015-01-03 21:57:30 +01:00
The `sc-mqtt` module provides a very simple minimal wrapper around the
[Eclipse Paho MQTT Version 3 Client][pahodocs] java-based MQTT
library.
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
[pahodocs]: http://pic.dhe.ibm.com/infocenter/wmqv7/v7r5/index.jsp?topic=/com.ibm.mq.javadoc.doc/WMQMQxrClasses/org/eclipse/paho/client/mqttv3/package-summary.html
[mqtt]: http://mqtt.org/
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
## Signs Module
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
The Signs Module can be used by plugin authors to create interactive
signs - that is - signs which display a list of choices which can be
changed by interacting (right-clicking) with the sign.
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
### signs.menu() function
This function is used to construct a new interactive menu on top of an
existing sign in the game world.
2013-12-18 00:49:00 +01:00
2014-12-28 16:07:32 +01:00
#### Parameters
2014-01-04 19:39:49 +01:00
2015-01-03 21:57:30 +01:00
* Label : A string which will be displayed in the topmost line of the
sign. This label is not interactive.
* options : An array of strings which can be selected on the sign by
right-clicking/interacting.
* callback : A function which will be called whenever a player
interacts (changes selection) on a sign. This callback in turn
takes as its parameter, an object with the following properties...
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
* player : The player who interacted with the sign.
* sign : The [org.bukkit.block.Sign][buksign] which the player interacted with.
* text : The text for the currently selected option on the sign.
* number : The index of the currently selected option on the sign.
* selectedIndex : optional: A number (starting at 0) indicating which
of the options should be selected by default. 0 is the default.
2014-01-04 19:39:49 +01:00
2015-01-03 21:57:30 +01:00
#### Returns
This function does not itself do much. It does however return a
function which when invoked with a given
[org.bukkit.block.Sign][buksign] object, will convert that sign into
an interactive sign.
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
#### Example: Create a sign which changes the time of day.
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
##### plugins/signs/time-of-day.js
```javascript
var utils = require('utils'),
signs = require('signs');
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
var onTimeChoice = function(event){
var selectedIndex = event.number;
// convert to Minecraft time 0 = Dawn, 6000 = midday, 12000 = dusk, 18000 = midnight
var time = selectedIndex * 6000;
event.player.location.world.setTime(time);
};
2014-12-30 15:54:38 +01:00
2015-01-03 21:57:30 +01:00
// signs.menu returns a function which can be called for one or more signs in the game.
var convertToTimeMenu = signs.menu('Time of Day',
['Dawn', 'Midday', 'Dusk', 'Midnight'],
onTimeChoice);
exports.time_sign = function( player ){
var sign = signs.getTargetedBy(player);
if ( !sign ) {
throw new Error('You must look at a sign');
}
convertToTimeMenu(sign);
};
```
2014-12-30 15:54:38 +01:00
2015-01-03 21:57:30 +01:00
To use the above function at the in-game prompt, look at an existing
sign and type...
2014-12-30 15:54:38 +01:00
2015-01-03 21:57:30 +01:00
/js time_sign(self);
2014-12-30 15:54:38 +01:00
2015-01-03 21:57:30 +01:00
... and the sign you're looking at will become an interactive sign
which changes the time each time you interact (right-click) with it.
2014-12-30 15:54:38 +01:00
2015-01-03 21:57:30 +01:00
### signs.getTargetedBy() function
2014-12-30 15:54:38 +01:00
2015-01-03 21:57:30 +01:00
This function takes a [org.bukkit.entity.LivingEntity][bukle] as a
parameter and returns a [org.bukkit.block.Sign][buksign] object which
the entity has targeted. It is a utility function for use by plugin authors.
2014-12-30 15:54:38 +01:00
2015-01-03 21:57:30 +01:00
#### Example
2014-12-30 15:54:38 +01:00
2015-01-03 21:57:30 +01:00
```javascript
var signs = require('signs'),
utils = require('utils');
var player = utils.player('tom1234');
var sign = signs.getTargetedBy( player );
if ( !sign ) {
echo( player, 'Not looking at a sign');
}
```
2014-12-30 15:54:38 +01:00
2015-03-22 15:05:19 +01:00
[buksign]: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/block/Sign.html
[bukle]: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/LivingEntity.html
2014-12-30 15:54:38 +01:00
2015-01-25 20:11:37 +01:00
## The slash Module
This module provides a single function which makes it easy to execute
minecraft commands via javascript.
### The slash() function
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.
#### Examples
Invoke the `/defaultgamemode creative` command (as server).
```javascript
var slash = require('slash');
slash('defaultgamemode creative', server);
```
Set the time of day to Midday and toggle downfall:
```javascript
var slash = require('slash');
slash([
'time set 6000',
'toggledownfall'
], server);
```
2015-01-03 21:57:30 +01:00
## Sounds Module
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
This module is a simple wrapper around the Bukkit Sound class and provides
a simpler way to play sounds. All of the org.bukkit.Sound Enum values are attached.
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
### Usage (Bukkit) :
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
var sounds = require('sounds');
sounds.play( bukkit.sound.VILLAGER_NO , self, 1, 0); // plays VILLAGER_NO sound at full volume and medium pitch
sounds.play( bukkit.sound.VILLAGER_NO , self ); // same as previous statement
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
The play() function takes either a Location object or any object which has a location.
The volume parameter is in the range 0 to 1 and the pitch parameter is in the range 0 to 4.
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
In addition, a play function is provided for each possible sound using the following rules:
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
1. The sound is converted from ALL_CAPS_UNDERSCORE to camelCase so for example there is a sounds.villagerNo() function which will play the VILLAGER_NO sound.
2. Each such function can take 3 parameters: location (which can be either an actual Location object or an object which has a location), volume and pitch
3. Or... each such function can be called without parameters meaning the sound will be played for all online players to hear.
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
sounds.villagerNo(self, 1, 0); // plays VILLAGER_NO sound at full volume and medium pitch at invoker's location
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
sounds.villagerNo(); // plays VILLAGER_NO sound for all players online.
2014-01-04 19:39:49 +01:00
2015-01-03 21:57:30 +01:00
These methods are provided for convenience to help beginners explore sounds using TAB completion.
String class extensions
-----------------------
The following chat-formatting methods are added to the javascript String class..
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
* aqua()
* black()
* blue()
* bold()
* brightgreen()
* darkaqua()
* darkblue()
* darkgray()
* darkgreen()
* purple()
* darkpurple()
* darkred()
* gold()
* gray()
* green()
* italic()
* lightpurple()
* indigo()
* green()
* red()
* pink()
* yellow()
* white()
* strike()
* random()
* magic()
* underline()
* reset()
2014-01-04 19:39:49 +01:00
2015-01-03 21:57:30 +01:00
Example
-------
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
/js var boldGoldText = "Hello World".bold().gold();
/js echo(self, boldGoldText );
2014-01-04 19:39:49 +01:00
2015-01-03 21:57:30 +01:00
< p style = "color:gold;font-weight:bold" > Hello World< / p >
2013-12-18 00:49:00 +01:00
2015-01-17 10:31:14 +01:00
## Teleport Module
This module provides a function to teleport entities (Players or NPCs).
### Parameters
* entity - The player or NPC to be teleported. If of type String, then a player with that name will be teleported.
* destination - The location to which they should be teleported. If not of type Location but is a Player, Block or any
object which has a `location` property then that works too. If of type String, then it's assumed that the destination is the player with that name.
### Example
The following code will teleport each player back to their spawn position.
```javascript
var teleport = require('teleport'),
utils = require('utils'),
players = utils.players(),
i = 0;
for ( ; i < players.length ; i + + ) {
teleport( players[i], players[i].spawnPosition );
}
```
The following code will teleport 'tom' to 'jane's location.
```javascript
var teleport = require('teleport');
teleport('tom' , 'jane');
```
2015-01-03 21:57:30 +01:00
## Utilities Module
2014-05-26 22:03:47 +02:00
2015-01-03 21:57:30 +01:00
The `utils` module is a storehouse for various useful utility
functions which can be used by plugin and module authors. It contains
miscellaneous utility functions and classes to help with programming.
2013-12-24 01:15:17 +01:00
2015-01-03 21:57:30 +01:00
### utils.player() function
2013-12-18 00:49:00 +01:00
2015-01-17 09:45:32 +01:00
The utils.player() function will return a [Player][cmpl] object
2015-01-03 21:57:30 +01:00
with the given name. This function takes a single parameter
2015-01-17 09:45:32 +01:00
`playerName` which can be either a String or a [Player][cmpl] object -
2015-01-03 21:57:30 +01:00
if it's a Player object, then the same object is returned. If it's a
String, then it tries to find the player with that name.
2014-01-04 19:39:49 +01:00
2014-12-28 16:07:32 +01:00
#### Parameters
2013-12-24 01:15:17 +01:00
2015-01-03 21:57:30 +01:00
* playerName : A String or Player object. If no parameter is provided
then player() will try to return the `self` variable . It is
strongly recommended to provide a parameter.
2013-12-18 00:49:00 +01:00
2014-12-28 16:07:32 +01:00
#### Example
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
```javascript
var utils = require('utils');
var name = 'walterh';
var player = utils.player(name);
if ( player ) {
2015-01-17 09:45:32 +01:00
echo(player, 'Got ' + name);
2015-01-03 21:57:30 +01:00
} else {
2015-01-17 09:45:32 +01:00
console.log('No player named ' + name);
2015-01-03 21:57:30 +01:00
}
```
2013-12-24 01:15:17 +01:00
2015-01-03 21:57:30 +01:00
[bkpl]: http://jd.bukkit.org/dev/apidocs/org/bukkit/entity/Player.html
2015-01-17 09:45:32 +01:00
[cmpl]: https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/api/entity/living/humanoid/Player.html
[cmloc]: https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/api/world/position/Location.html
2015-01-03 21:57:30 +01:00
[bkloc]: http://jd.bukkit.org/dev/apidocs/org/bukkit/Location.html
2014-01-04 19:39:49 +01:00
2015-01-11 01:11:44 +01:00
### utils.world( worldName ) function
Returns a World object matching the given name
### utils.blockAt( Location ) function
Returns the Block at the given location.
2015-01-03 21:57:30 +01:00
### utils.locationToJSON() function
2013-12-18 00:49:00 +01:00
2015-01-17 09:45:32 +01:00
utils.locationToJSON() returns a [Location][cmloc] object in JSON form...
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
{ world: 'world5',
x: 56.9324,
y: 103.9954,
z: 43.1323,
yaw: 0.0,
pitch: 0.0
}
2014-01-04 19:39:49 +01:00
2015-01-03 21:57:30 +01:00
This can be useful if you write a plugin that needs to store location data since bukkit's Location object is a Java object which cannot be serialized to JSON by default.
2013-12-18 00:49:00 +01:00
2014-01-04 19:39:49 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
2015-01-17 09:45:32 +01:00
* location: An object of type [Location][cmloc]
2014-01-04 19:39:49 +01:00
2015-01-03 21:57:30 +01:00
#### Returns
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
A JSON object in the above form.
### utils.locationToString() function
2014-01-04 19:39:49 +01:00
2015-01-03 21:57:30 +01:00
The utils.locationToString() function returns a
2015-01-17 09:45:32 +01:00
[Location][cmloc] object in string form...
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
'{"world":"world5",x:56.9324,y:103.9954,z:43.1323,yaw:0.0,pitch:0.0}'
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
... which can be useful if you write a plugin which uses Locations as
keys in a lookup table.
2013-12-18 00:49:00 +01:00
2014-12-28 16:07:32 +01:00
#### Example
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
```javascript
var utils = require('utils');
...
var key = utils.locationToString(player.location);
lookupTable[key] = player.name;
```
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
### utils.locationFromJSON() function
2013-12-18 00:49:00 +01:00
2015-01-17 09:45:32 +01:00
This function reconstructs an [Location][cmloc] object from
2015-01-03 21:57:30 +01:00
a JSON representation. This is the counterpart to the
`locationToJSON()` function. It takes a JSON object of the form
returned by locationToJSON() and reconstructs and returns a bukkit
Location object.
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
### utils.getPlayerPos() function
2014-12-30 15:54:38 +01:00
2015-01-17 09:45:32 +01:00
This function returns the player's [Location][cmloc] (x, y, z, pitch
2015-01-03 21:57:30 +01:00
and yaw) for a named player. If the "player" is in fact a
2015-01-18 22:16:38 +01:00
[BlockCommand][bkbcs] then the attached Block's location is returned.
2014-12-30 15:54:38 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* player : A [org.bukkit.command.CommandSender][bkbcs] (Player or BlockCommandSender) or player name (String).
2014-12-30 15:54:38 +01:00
2015-01-03 21:57:30 +01:00
#### Returns
2014-12-30 15:54:38 +01:00
2015-01-17 09:45:32 +01:00
A [Location][cmloc] object.
2014-12-30 15:54:38 +01:00
2015-01-03 21:57:30 +01:00
[bkbcs]: http://jd.bukkit.org/dev/apidocs/org/bukkit/command/BlockCommandSender.html
[bksndr]: http://jd.bukkit.org/dev/apidocs/index.html?org/bukkit/command/CommandSender.html
### utils.getMousePos() function
2014-12-30 15:54:38 +01:00
2015-01-17 09:45:32 +01:00
This function returns a [Location][cmloc] object (the
2015-01-03 21:57:30 +01:00
x,y,z) of the current block being targeted by the named player. This
is the location of the block the player is looking at (targeting).
2014-12-30 15:54:38 +01:00
#### Parameters
2015-01-03 21:57:30 +01:00
* player : The player whose targeted location you wish to get.
2014-12-30 15:54:38 +01:00
#### Example
2015-01-03 21:57:30 +01:00
The following code will strike lightning at the location the player is looking at...
2014-12-30 15:54:38 +01:00
2015-01-03 21:57:30 +01:00
```javascript
var utils = require('utils');
var playerName = 'walterh';
var targetPos = utils.getMousePos(playerName);
if (targetPos){
2015-01-17 09:45:32 +01:00
if (__plugin.canary){
targetPos.world.makeLightningBolt(targetPos);
}
if (__plugin.bukkit){
targetPos.world.strikeLightning(targetPos);
}
2015-01-03 21:57:30 +01:00
}
```
2014-12-30 15:54:38 +01:00
2015-01-03 21:57:30 +01:00
### utils.foreach() function
2013-12-28 09:44:40 +01:00
2015-01-03 21:57:30 +01:00
The utils.foreach() function is a utility function for iterating over
2015-01-17 09:45:32 +01:00
an array of objects (or a java.util.Collection of objects) and
processing each object in turn. Where utils.foreach() differs from
other similar functions found in javascript libraries, is that
utils.foreach can process the array immediately or can process it
*nicely* by processing one item at a time then delaying processing of
the next item for a given number of server ticks (there are 20 ticks
per second on the minecraft main thread). This method relies on
Bukkit's [org.bukkit.scheduler][sched] package for scheduling
processing of arrays.
2014-12-30 15:54:38 +01:00
2015-01-03 21:57:30 +01:00
[sched]: http://jd.bukkit.org/beta/apidocs/org/bukkit/scheduler/package-summary.html
2013-12-24 01:15:17 +01:00
2014-01-04 19:39:49 +01:00
#### Parameters
2013-12-24 01:15:17 +01:00
2015-01-03 21:57:30 +01:00
* array : The array to be processed - It can be a javascript array, a java array or java.util.Collection
* callback : The function to be called to process each item in the
array. The callback function should have the following signature
`callback(item, index, object, array)` . That is the callback will
be called with the following parameters....
2013-12-24 01:15:17 +01:00
2015-01-03 21:57:30 +01:00
- item : The item in the array
- index : The index at which the item can be found in the array.
- object : Additional (optional) information passed into the foreach method.
- array : The entire array.
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
* context (optional) : An object which may be used by the callback.
2015-01-17 09:45:32 +01:00
* delayInMilliseconds (optional, numeric) : If a delay is specified then the processing will be scheduled so that
2015-01-03 21:57:30 +01:00
each item will be processed in turn with a delay between the completion of each
2015-01-17 09:45:32 +01:00
item and the start of the next. This is recommended for any CPU-intensive process.
2015-01-03 21:57:30 +01:00
* onDone (optional, function) : A function to be executed when all processing
is complete. This parameter is only used when the processing is delayed. (It's optional even if a
delay parameter is supplied).
2013-12-31 22:09:50 +01:00
2015-01-03 21:57:30 +01:00
If called with a delay parameter then foreach() will return
immediately after processing just the first item in the array (all
subsequent items are processed later). If your code relies on the
completion of the array processing, then provide an `onDone` parameter
and put the code there.
2013-12-31 22:09:50 +01:00
2015-01-03 21:57:30 +01:00
#### Example
2013-12-31 22:09:50 +01:00
2015-01-03 21:57:30 +01:00
The following example illustrates how to use foreach for immediate processing of an array...
2013-12-31 22:09:50 +01:00
2015-01-03 21:57:30 +01:00
```javascript
var utils = require('utils');
2015-01-17 09:45:32 +01:00
var players = utils.players();
utils.foreach (players, function( player ) {
echo( player , 'Hi ' + player);
2015-01-03 21:57:30 +01:00
});
```
2013-12-31 22:09:50 +01:00
2015-01-17 09:45:32 +01:00
... The `utils.foreach()` function can work with Arrays or any
Java-style collection. This is important because many objects in the
2015-01-24 20:42:52 +01:00
CanaryMod and Bukkit APIs use Java-style collections.
2015-01-03 21:57:30 +01:00
### utils.nicely() function
2013-12-18 00:49:00 +01:00
2015-01-17 09:45:32 +01:00
The utils.nicely() function is for performing background processing. utils.nicely() lets you
2015-01-03 21:57:30 +01:00
process with a specified delay between the completion of each `next()`
function and the start of the next `next()` function.
`utils.nicely()` is a recursive function - that is - it calls itself
(schedules itself actually) repeatedly until `hasNext` returns false.
2013-12-28 09:44:40 +01:00
2015-01-03 21:57:30 +01:00
#### Parameters
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
* next : A function which will be called if processing is to be done.
* hasNext : A function which is called to determine if the `next`
callback should be invoked. This should return a boolean value -
true if the `next` function should be called (processing is not
complete), false otherwise.
* onDone : A function which is to be called when all processing is complete (hasNext returned false).
2015-01-17 09:45:32 +01:00
* delayInMilliseconds : The delay between each call.
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
#### Example
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
See the source code to utils.foreach for an example of how utils.nicely is used.
2013-12-24 23:47:57 +01:00
2015-01-11 13:27:47 +01:00
### utils.time( world ) function
Returns the timeofday (in minecraft ticks) for the given world. This function is necessary because
canarymod and bukkit differ in how the timeofday is calculated.
See http://minecraft.gamepedia.com/Day-night_cycle#Conversions
### utils.time24( world ) function
Returns the timeofday for the given world using 24 hour notation. (number of minutes)
See http://minecraft.gamepedia.com/Day-night_cycle#Conversions
2015-02-19 21:24:20 +01:00
#### Parameters
* world : the name of the world or world object for which you want to get time
2015-02-21 11:19:51 +01:00
2015-01-03 21:57:30 +01:00
### utils.find() function
The utils.find() function will return a list of all files starting at
a given directory and recursiving trawling all sub-directories.
2013-12-18 00:49:00 +01:00
2014-01-04 19:39:49 +01:00
#### Parameters
2013-12-18 00:49:00 +01:00
2015-01-03 21:57:30 +01:00
* dir : The starting path. Must be a string.
* filter : (optional) A [FilenameFilter][fnfltr] object to return only files matching a given pattern.
[fnfltr]: http://docs.oracle.com/javase/6/docs/api/java/io/FilenameFilter.html
2013-12-18 00:49:00 +01:00
2014-01-04 19:39:49 +01:00
#### Example
2013-12-28 09:44:40 +01:00
2015-01-03 21:57:30 +01:00
```javascript
var utils = require('utils');
var jsFiles = utils.find('./', function(dir,name){
return name.match(/\.js$/);
});
```
### utils.serverAddress() function
2013-12-24 23:47:57 +01:00
2015-01-03 21:57:30 +01:00
The utils.serverAddress() function returns the IP(v4) address of the server.
2013-12-24 23:47:57 +01:00
2015-01-03 21:57:30 +01:00
```javascript
var utils = require('utils');
var serverAddress = utils.serverAddress();
console.log(serverAddress);
```
### utils.array() function
2014-12-28 16:07:32 +01:00
2015-01-03 21:57:30 +01:00
Converts Java collection objects to type Javascript array so they can avail of
all of Javascript's Array goodness.
#### Example
2014-12-28 16:07:32 +01:00
2015-01-03 21:57:30 +01:00
var utils = require('utils');
2015-03-01 00:54:59 +01:00
var worlds = utils.array(server.worldManager.getAllWorlds());
2015-01-03 21:57:30 +01:00
### utils.players() function
2014-12-28 16:07:32 +01:00
2015-01-11 13:27:47 +01:00
This function returns a javascript array of all online players on the
server. You can optionally provide a function which will be invoked
with each player as a parameter. For example, to give each player the
ability to shoot arrows which launch fireworks:
```javascript
require('utils').players( arrows.firework )
```
Any players with a bow will be able to launch fireworks by shooting.
2014-12-28 16:07:32 +01:00
2015-01-03 21:57:30 +01:00
### utils.playerNames() function
2014-12-28 16:07:32 +01:00
2015-01-03 21:57:30 +01:00
This function returns a javascript array of player names (as javascript strings)
2014-12-28 16:07:32 +01:00
2015-01-03 21:57:30 +01:00
### utils.stat() function
2014-12-28 16:07:32 +01:00
2015-01-03 21:57:30 +01:00
This function returns a numeric value for a given player statistic.
2014-12-28 16:07:32 +01:00
2015-01-03 21:57:30 +01:00
#### Parameters
2014-12-28 16:07:32 +01:00
2015-01-03 21:57:30 +01:00
* Player - The player object (optional - if only the statistic name parameter is provided then the statistic object is returned)
* Statistic - A string whose value should be one of the following (CanaryMod)
* ANIMALSBRED
* BOATONECM
* CLIMBONECM
* CROUCHONECM
* DAMAGEDEALT
* DAMAGETAKEN
* DEATHS
* DRIVEONECM
* DROP
* FALLONECM
* FISHCAUGHT
* FLYONECM
* HORSEONECM
* JUMP
* JUNKFISHED
* LEAVEGAME
* MINECARTONECM
* MOBKILLS
* PIGONECM
* PLAYERKILLS
* PLAYONEMINUTE
* SPRINTONECM
* SWIMONECM
* TALKEDTOVILLAGER
* TIMESINCEDEATH
* TRADEDWITHVILLAGER
* TREASUREFISHED
* WALKONECM
2014-12-28 16:07:32 +01:00
2015-01-03 21:57:30 +01:00
See [CanaryMod's Statistic][cmstat] class for an up-to-date list of possible stat values
2014-12-28 16:07:32 +01:00
2015-01-03 21:57:30 +01:00
[cmstat]: https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/api/statistics/Statistics.html
2014-12-28 16:07:32 +01:00
2015-01-03 21:57:30 +01:00
#### Example 1 Getting stats for a player
2014-12-28 16:07:32 +01:00
2015-01-03 21:57:30 +01:00
var utils = require('utils');
var jumpCount = utils.stat( player, 'jump');
2014-12-28 16:07:32 +01:00
2015-01-03 21:57:30 +01:00
#### Example 2 Getting the JUMP statistic object (which can be used elsewhere)
2014-12-28 16:07:32 +01:00
2015-01-03 21:57:30 +01:00
var utils = require('utils');
var JUMPSTAT = utils.stat('jump');
var jumpCount = player.getStat( JUMPSTAT ); // canary-specific code
2014-12-28 16:07:32 +01:00
2015-01-03 21:57:30 +01:00
This function also contains values for each possible stat so you can get at stats like this...
2014-12-28 16:07:32 +01:00
2015-01-03 21:57:30 +01:00
var utils = require('utils');
var JUMPSTAT = utils.stat.JUMP; // Accessing the value
var jumpCount = player.getStat ( JUMPSTAT ); // canary-specific code
2015-01-25 20:11:37 +01:00
## The watcher Module
This module exposes functions for watching for changes to files or directories.
### watcher.watchFile() function
Watches for changes to the given file or directory and calls the function provided
when the file changes.
#### Parameters
* File - the file to watch (can be a file or directory)
* Callback - The callback to invoke when the file has changed. The callback takes the
changed file as a parameter.
#### Example
```javascript
var watcher = require('watcher');
watcher.watchFile( 'test.txt', function( file ) {
console.log( file + ' has changed');
});
```
### watcher.watchDir() function
Watches for changes to the given directory and calls the function provided
when the directory changes. It works by calling watchFile/watchDir for each
file/subdirectory.
#### Parameters
* Dir - the file to watch (can be a file or directory)
* Callback - The callback to invoke when the directory has changed.
The callback takes the changed file as a parameter.
For each change inside the directory the callback will also
be called.
#### Example
```javascript
var watcher = require('watcher');
watcher.watchDir( 'players/_ial', function( dir ) {
console.log( dir + ' has changed');
});
```
### watcher.unwatchFile() function
Removes a file from the watch list.
#### Example
```javascript
var watcher = require('watcher');
watcher.unwatchFile('test.txt');
```
### watcher.unwatchDir() function
Removes a directory from the watch list and all files inside the directory
are also "unwatched"
#### Example
```javascript
var watcher = require('watcher');
watcher.unwatchDir ('players/_ial');
```
Would cause also
```javascript
watcher.unwatchFile (file);
```
for each file inside directory (and unwatchDir for each directory inside it)
2014-01-04 19:39:49 +01:00
## Example Plugin #1 - A simple extension to Minecraft.
2013-12-24 01:15:17 +01:00
2013-12-31 22:09:50 +01:00
A simple minecraft plugin. The most basic module.
2013-12-26 16:38:24 +01:00
2013-12-29 00:02:50 +01:00
### Usage:
2013-12-26 16:38:24 +01:00
2013-12-31 22:09:50 +01:00
At the in-game prompt type ...
/js hello(self)
2013-12-27 23:52:16 +01:00
2013-12-31 22:09:50 +01:00
... and a message `Hello {player-name}` will appear (where
{player-name} is replaced by your own name).
This example demonstrates the basics of adding new functionality which
is only usable by server operators or users with the
scriptcraft.evaluate permission. By default, only ops are granted this
permission.
The `hello` function below is only usable by players with the scriptcraft.evaluate
permission since it relies on the `/js` command to execute.
2013-12-27 23:52:16 +01:00
2013-12-31 22:09:50 +01:00
exports.hello = function(player){
2014-10-05 18:29:04 +02:00
echo( player, 'Hello ' + player.name);
2013-12-31 22:09:50 +01:00
};
2013-12-27 23:52:16 +01:00
2014-01-04 19:39:49 +01:00
## Example Plugin #2 - Making extensions available for all players.
2013-12-27 23:52:16 +01:00
2013-12-31 22:09:50 +01:00
A simple minecraft plugin. Commands for other players.
2013-12-27 23:52:16 +01:00
2013-12-31 22:09:50 +01:00
### Usage:
2013-12-27 23:52:16 +01:00
2013-12-31 22:09:50 +01:00
At the in-game prompt type ...
/jsp hello
2013-12-27 23:52:16 +01:00
2013-12-31 22:09:50 +01:00
... and a message `Hello {player-name}` will appear (where {player-name} is
replaced by your own name).
This example demonstrates the basics of adding new functionality
which is usable all players or those with the scriptcraft.proxy
permission. By default, all players are granted this permission.
This differs from example 1 in that a new 'jsp ' command extension
is defined. Since all players can use the `jsp` command, all players
can use the new extension. Unlike the previous example, the `jsp hello`
command does not evaluate javascript code so this command is much more secure.
2013-12-27 23:52:16 +01:00
2013-12-31 22:09:50 +01:00
command('hello', function (parameters, player) {
2014-10-05 18:29:04 +02:00
echo( player, 'Hello ' + player.name);
2013-12-31 22:09:50 +01:00
});
2013-12-27 23:52:16 +01:00
2014-01-04 19:39:49 +01:00
## Example Plugin #3 - Limiting use of commands to operators only.
2013-12-27 23:52:16 +01:00
2013-12-31 22:09:50 +01:00
A simple minecraft plugin. Commands for operators only.
2013-12-27 23:52:16 +01:00
2013-12-31 22:09:50 +01:00
### Usage:
2013-12-27 23:52:16 +01:00
2013-12-31 22:09:50 +01:00
At the in-game prompt type ...
/jsp op-hello
2013-12-27 23:52:16 +01:00
2013-12-31 22:09:50 +01:00
... and a message `Hello {player-name}` will appear (where {player-name} is
replaced by your own name).
This example demonstrates the basics of adding new functionality
which is usable all players or those with the scriptcraft.proxy
permission. By default, all players are granted this permission. In
this command though, the function checks to see if the player is an
operator and if they aren't will return immediately.
This differs from example 2 in that the function will only print a
message for operators.
2013-12-27 23:52:16 +01:00
2013-12-31 22:09:50 +01:00
command('op-hello', function (parameters, player) {
2014-12-22 16:23:06 +01:00
if ( !isOp(player) ){
2014-10-05 18:29:04 +02:00
echo( player, 'Only operators can do this.');
return;
2013-12-31 22:09:50 +01:00
}
2014-10-05 18:29:04 +02:00
echo( player, 'Hello ' + player.name);
2013-12-31 22:09:50 +01:00
});
2014-01-04 19:39:49 +01:00
## Example Plugin #4 - Using parameters in commands.
2013-12-31 22:09:50 +01:00
A simple minecraft plugin. Handling parameters.
2013-12-27 23:52:16 +01:00
2013-12-31 22:09:50 +01:00
### Usage:
2013-12-27 23:52:16 +01:00
2013-12-31 22:09:50 +01:00
At the in-game prompt type ...
/jsp hello-params Hi
/jsp hello-params Saludos
/jsp hello-params Greetings
2013-12-27 23:52:16 +01:00
2013-12-31 22:09:50 +01:00
... and a message `Hi {player-name}` or `Saludos {player-name}` etc
will appear (where {player-name} is replaced by your own name).
This example demonstrates adding and using parameters in commands.
This differs from example 3 in that the greeting can be changed from
a fixed 'Hello ' to anything you like by passing a parameter.
2013-12-27 23:52:16 +01:00
2014-01-29 20:49:15 +01:00
command( 'hello-params', function ( parameters, player ) {
var salutation = parameters[0] ;
2014-10-05 18:29:04 +02:00
echo( player, salutation + ' ' + player.name );
2013-12-31 22:09:50 +01:00
});
2013-12-27 23:52:16 +01:00
2014-01-04 19:39:49 +01:00
## Example Plugin #5 - Re-use - Using your own and others modules.
2013-12-28 09:44:40 +01:00
2013-12-31 22:09:50 +01:00
A simple minecraft plugin. Using Modules.
2013-12-24 01:15:17 +01:00
2013-12-31 22:09:50 +01:00
### Usage:
2013-12-24 01:15:17 +01:00
2013-12-31 22:09:50 +01:00
At the in-game prompt type ...
/jsp hello-module
... and a message `Hello {player-name}` will appear (where {player-name} is
replaced by your own name).
This example demonstrates the use of modules. In
example-1-hello-module.js we created a new javascript module. In
this example, we use that module...
* We load the module using the `require()` function. Because this
module and the module we require are n the same directory, we
specify `'./example-1-hello-module'` as the path (when loading a
module from the same directory, `./` at the start of the path
indicates that the file should be searched for in the same
directory.
* We assign the loaded module to a variable (`greetings`) and then
use the module's `hello` method to display the message.
Source Code...
var greetings = require('./example-1-hello-module');
2014-01-29 20:49:15 +01:00
command( 'hello-module', function( parameters, player ) {
greetings.hello( player );
2013-12-31 22:09:50 +01:00
});
2014-01-04 19:39:49 +01:00
## Example Plugin #6 - Re-use - Using 'utils' to get Player objects.
2013-12-31 22:09:50 +01:00
A simple minecraft plugin. Finding players by name.
### Usage:
At the in-game prompt type ...
/jsp hello-byname {player-name}
... substituting {player-name} with the name of a player currently
online and a message `Hello ...` will be sent to the named
player.
This example builds on example-5 and also introduces a new concept -
use of shared modules. That is : modules which are not specific to
any one plugin or set of plugins but which can be used by all
plugins. Shared modules should be placed in the
`scriptcraft/modules` directory.
* The utils module is used. Because the 'utils' module is
located in the modules folder we don't need to specify an exact
path, just 'utils' will do.
* The `utils.player()` function is used to obtain a player object
matching the player name. Once a player object is obtained, a
message is sent to that player.
Source Code ...
var utils = require('utils');
var greetings = require('./example-1-hello-module');
2014-01-29 20:49:15 +01:00
command( 'hello-byname', function( parameters, sender ) {
var playerName = parameters[0];
var recipient = utils.player( playerName );
if ( recipient ) {
greetings.hello( recipient );
} else {
2014-10-05 18:29:04 +02:00
echo( sender, 'Player ' + playerName + ' not found.' );
2014-01-29 20:49:15 +01:00
}
2013-12-31 22:09:50 +01:00
});
2014-01-04 19:39:49 +01:00
## Example Plugin #7 - Listening for events, Greet players when they join the game.
2013-12-31 22:09:50 +01:00
A simple event-driven minecraft plugin. How to handle Events.
This example demonstrates event-driven programming. The code below
will display the version of ScriptCraft every time an operator joins
the game. This module is notable from previous modules for the
following reasons...
1. It does not export any functions or variables. That's fine. Not
all modules need export stuff. Code in this module will be
executed when the module is first loaded. Because it is in the
`/scriptcraft/plugins` directory, it will be loaded automatically
when the server starts up.
2015-01-17 09:45:32 +01:00
2. It uses ScriptCraft's `events` module to add a new *Event
Handler*. An *Event Handler* is a function that gets
2013-12-31 22:09:50 +01:00
called whenever a particular *event* happens in the game. The
function defined below will only be executed whenever a player
joins the game. This style of program is sometimes refered to as
*Event-Driven Programming* .
2015-01-17 09:45:32 +01:00
Adding new *Event Handlers* in ScriptCraft is relatively easy. Use one
of the `events` module's functions to add a new event handler. The
events module has many functions - one for each type of event. Each
function takes a single parameter:
2013-12-31 22:09:50 +01:00
2015-01-17 09:45:32 +01:00
* The event handling function (also sometimes refered to as a
'callback'). In ScriptCraft, this function takes a single
parameter, an event object. All of the information about the event
is in the event object.
2013-12-31 22:09:50 +01:00
In the example below, if a player joins the server and is an operator,
then the ScriptCraft plugin information will be displayed to that
player.
2015-01-17 09:45:32 +01:00
```javascript
function onJoin( event ){
if ( isOp(event.player) ) {
echo( event.player, 'Welcome to ' + __plugin );
}
}
events.connection( onJoin );
```
First the onJoin() function is defined, this is our event handler -
the function we wish to be called every time some new player joins the
game. Then we hook up - or register - that function using the
events.connection() function. The events.connection function is the
function responsible for adding new *connection* event handlers - that
is - functions which should be invoked when there's a new *connection*
event in the game. A new *connection* event is fired whenever a player
joins the game. There are many other types of events you can handle in
Minecraft. You can see [a full list of events here][cmEvtList].
[cmEvtList]: #events -helper-module-canary-version
2014-01-04 19:39:49 +01:00
## Arrows Plugin
2013-12-31 22:09:50 +01:00
2015-05-09 15:25:07 +02:00
The arrows mod adds fancy arrows to the game. Arrows which ...
2013-12-31 22:09:50 +01:00
* Launch fireworks.
* Explode on impact.
* Force Lightning to strike where they land.
* Teleport the player to the landing spot.
* Spawn Trees at the landing spot.
### Usage:
* `/js arrows.firework(self)` - A firework launches where the the arrow lands.
* `/js arrows.lightning(self)` - lightning strikes where the arrow lands.
* `/js arrows.teleport(self)` - makes player teleport to where arrow has landed.
* `/js arrows.flourish(self)` - makes a tree grow where the arrow lands.
* `/js arrows.explosive(self)` - makes arrows explode.
* `/js arrows.normal(self)` sets arrow type to normal.
2015-05-09 15:25:07 +02:00
* `/js arrows.sign(self)` turns a targeted sign into an Arrows menu
2013-12-31 22:09:50 +01:00
All of the above functions can take an optional player object or name
as a parameter. For example: `/js arrows.explosive('player23')` makes
player23's arrows explosive.
2014-01-12 12:26:26 +01:00
## Spawn Plugin
Allows in-game operators to easily spawn creatures at current location.
### Usage
/jsp spawn cow
/jsp spawn sheep
/jsp spawn wolf
2014-01-12 13:06:30 +01:00
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
2015-05-09 15:25:07 +02:00
< https: / / hub . spigotmc . org / javadocs / bukkit / org / bukkit / entity / EntityType . html > (CanaryMod)
or < http: / / docs . visualillusionsent . net / CanaryLib / 1 . 0 . 0 / net / canarymod / api / entity / EntityType . html > (Bukkit)
2014-01-12 13:06:30 +01:00
for a list of possible entities (creatures) which can be spawned.
2014-01-12 12:26:26 +01:00
2014-01-04 19:39:49 +01:00
## alias Plugin
2013-12-31 22:09:50 +01:00
The alias module lets players and server admins create their own
per-player or global custom in-game command aliases.
### Examples
To set a command alias which is only visible to the current player
(per-player alias)...
/jsp alias set cw = time set {1} ; weather {2}
... Creates a new custom command only usable by the player who set
it called `cw` (short for set Clock and Weather) which when invoked...
/cw 4000 sun
... will perform the following commands...
/time set 4000
/weather sun
Aliases can use paramters as above. On the right hand side of the `=` , the
`{1}` refers to the first parameter provided with the `cw` alias, `{2}`
refers to the second parameter and so on. So `cw 4000 sun` is converted to
`time set 4000` and `weather sun` .
To set a global command alias usable by all (only operators can create
such an alias)...
/jsp alias global stormy = time 18000; weather storm
2014-01-23 00:57:27 +01:00
To remove an alias ...
2013-12-31 22:09:50 +01:00
2014-01-23 00:57:27 +01:00
/jsp alias remove cw
2013-12-31 22:09:50 +01:00
2014-01-23 00:57:27 +01:00
... removes the 'cw' alias from the appropriate alias map.
2013-12-31 22:09:50 +01:00
To get a list of aliases currently defined...
/jsp alias list
To get help on the `jsp alias` command:
/jsp alias help
Aliases can be used at the in-game prompt by players or in the server
console. Aliases will not be able to avail of command autocompletion
(pressing the TAB key will have no effect).
2013-12-29 00:02:50 +01:00
## Commando Plugin
2013-12-26 16:38:24 +01:00
2013-12-29 00:02:50 +01:00
### Description
2013-12-26 16:38:24 +01:00
commando is a plugin which can be used to add completely new commands
to Minecraft. Normally ScriptCraft only allows for provision of new
commands as extensions to the jsp command. For example, to create a
new simple command for use by all players...
2014-10-05 18:29:04 +02:00
/js command('hi', function(args,player){ echo( player, 'Hi ' + player.name); });
2013-12-26 16:38:24 +01:00
... then players can use this command by typing...
/jsp hi
... A couple of ScriptCraft users have asked for the ability to take
this a step further and allow the global command namespace to be
populated so that when a developer creates a new command using the
'command' function, then the command is added to the global command
namespace so that players can use it simply like this...
/hi
... There are good reasons why ScriptCraft's core `command()` function
does not do this. Polluting the global namespace with commands would
make ScriptCraft a bad citizen in that Plugins should be able to work
together in the same server and - as much as possible - not step on
each others' toes. The CraftBukkit team have very good reasons for
forcing Plugins to declare their commands in the plugin.yml
configuration file. It makes approving plugins easier and ensures that
craftbukkit plugins behave well together. While it is possible to
override other plugins' commands, the CraftBukkit team do not
recommend this. However, as ScriptCraft users have suggested, it
2013-12-27 23:52:16 +01:00
should be at the discretion of server administrators as to when
overriding or adding new commands to the global namespace is good.
2013-12-26 16:38:24 +01:00
So this is where `commando()` comes in. It uses the exact same
signature as the core `command()` function but will also make the
command accessible without the `jsp` prefix so instead of having to
type `/jsp hi` for the above command example, players simply type
`/hi` . This functionality is provided as a plugin rather than as part
of the ScriptCraft core.
2013-12-29 00:02:50 +01:00
### Example hi-command.js
2013-12-26 16:38:24 +01:00
var commando = require('../commando');
2013-12-30 22:33:12 +01:00
commando('hi', function(args,player){
2014-10-05 18:29:04 +02:00
echo( player, 'Hi ' + player.name);
2013-12-26 16:38:24 +01:00
});
...Displays a greeting to any player who issues the `/hi` command.
2013-12-29 00:02:50 +01:00
### Example - timeofday-command.js
2013-12-26 16:38:24 +01:00
var times = {Dawn: 0, Midday: 6000, Dusk: 12000, Midnight:18000};
2013-12-30 22:33:12 +01:00
commando('timeofday', function(params,player){
player.location.world.setTime(times[params[0]]);
2013-12-27 23:52:16 +01:00
},
2013-12-26 16:38:24 +01:00
['Dawn','Midday','Dusk','Midnight']);
... changes the time of day using a new `/timeofday` command (options are Dawn, Midday, Dusk, Midnight)
2013-12-29 00:02:50 +01:00
### Caveats
2013-12-26 16:38:24 +01:00
Since commands registered using commando are really just appendages to
the `/jsp` command and are not actually registered globally (it just
looks like that to the player), you won't be able to avail of tab
completion for the command itself or its parameters (unless you go the
traditional route of adding the `jsp` prefix). This plugin uses the
[PlayerCommandPreprocessEvent][pcppevt] which allows plugins to
intercepts all commands and inject their own commands instead. If
anyone reading this knows of a better way to programmatically add new
global commands for a plugin, please let me know.
[pcppevt]: http://jd.bukkit.org/dev/apidocs/org/bukkit/event/player/PlayerCommandPreprocessEvent.html
2014-01-04 19:39:49 +01:00
## homes Plugin
2013-12-26 16:38:24 +01:00
2013-12-28 23:49:13 +01:00
The homes plugin lets players set a location as home and return to the
location, invite other players to their home and also visit other
player's homes.
This module is a good example of how to create a javascript-based
minecraft mod which provides...
* A programmatic interface (API) and
* A command extension which uses that API to provide new functionality for players.
The module uses the `plugin()` function to specify an object and
methods, and the `command()` function to expose functionality to
players through a new `jsp home` command. This module also
demonstrates how to enable autocompletion for custom commands (to see
this in action, at the in-game prompt or server console prompt type
`jsp home ` then press the TAB key - you should see a list of further
possible options).
The `jsp home` command has the following options...
### Basic options
* `/jsp home set` Will set your current location as your
'home' location to which you can return at any time using the ...
* `/jsp home` ..command will return you to your home, if you have set one.
2014-02-04 21:53:59 +01:00
* `/jsp home {player}` Will take you to the home of {player} (where
{player} is the name of the player whose home you wish to visit.
2013-12-28 23:49:13 +01:00
* `/jsp home delete` Deletes your home location from the location
database. This does not actually remove the home from the world or
change the world in any way. This command is completely
non-destructive and cannot be used for griefing. No blocks will be
destroyed by this command.
### Social options
The following options allow players to open their homes to all or some
players, invite players to their home and see a list of homes they can
visit.
* `/jsp home list` Lists home which you can visit.
* `/jsp home ilist` Lists players who can visit your home.
2014-02-04 21:53:59 +01:00
* `/jsp home invite {player}` Invites the named player to your home.
* `/jsp home uninvite {player}` Uninvites (revokes invitation) the named player to your home.
2013-12-28 23:49:13 +01:00
* `/jsp home public` Opens your home to all players (all players can visit your home).
* `/jsp home private` Makes your home private (no longer visitable by all).
### Administration options
The following administration options can only be used by server operators...
* `/jsp home listall` List all of the homes
2014-02-04 21:53:59 +01:00
* `/jsp home clear {player}` Removes the player's home
2013-12-28 23:49:13 +01:00
location. Again, this command does not destroy any structures in
the world, it simply removes the location from the database. No
blocks are destroyed by this command.
2013-12-31 22:09:50 +01:00
## NumberGuess mini-game:
### Description
This is a very simple number guessing game. Minecraft will ask you to
guess a number between 1 and 10 and you will tell you if you're too
hight or too low when you guess wrong. The purpose of this mini-game
code is to demonstrate use of Bukkit's Conversation API.
### Example
/js Game_NumberGuess.start(self)
Once the game begins, guess a number by typing the `/` character
followed by a number between 1 and 10.
2014-01-12 12:26:26 +01:00
## Cow Clicker Mini-Game
### How to Play
At the in-game prompt type `jsp cowclicker` to start or stop
playing. Right-Click on Cows to score points. No points for killing
cows (hint: use the same keyboard keys you'd use for opening doors).
Every time you click a cow your score increases by 1 point. Your score
is displayed in a side-bar along the right edge of of the screen.
![cow clicker ](img/cowclicker.png )
### Rules
* You can join and leave the Cow Clicker game at any time by typing
`/jsp cowclicker` at the in-game prompt.
* Once you leave the game, your score is reset to zero.
2014-01-12 13:06:30 +01:00
* When you disconnect from the server, your score will be reset to zero.
2014-01-12 12:26:26 +01:00
### Gameplay Mechanics
This is meant as a trivially simple use of the [Bukkit Scoreboard
API][bukscore]. There are many things you'll want to consider when constructing
your own mini-game...
* Is the game itself a long-lived game - that is - should players and
scores be persisted (stored) between server restarts?
* What should happen when a player quits the server - should this also be
understood as quitting the mini-game?
* What should happen when a player who was previously playing the
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
2014-10-05 18:29:04 +02:00
/*********************
## Items module
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
### Usage
items.book(); // returns net.canarymod.api.inventory.ItemType.Book
items.book(2); // returns a new net.canarymod.api.inventory.Item object with an amount 2 (2 books)
items.book( itemType ); // compares itemType parameter to ItemType.Book or an Item of type book
The following functions are provided:
2015-01-11 01:11:44 +01:00
* acaciaDoor()
* acaciaFence()
* acaciaFenceGate()
2014-10-05 18:29:04 +02:00
* acaciaLeaves()
* acaciaLog()
* acaciaSapling()
* acaciaStairs()
* acaciaWood()
2015-01-11 01:11:44 +01:00
* acaciaWoodSlab()
2014-10-05 18:29:04 +02:00
* activatorRail()
* allium()
2015-01-11 01:11:44 +01:00
* andesite()
2014-10-05 18:29:04 +02:00
* anvil()
* apple()
2015-01-11 01:11:44 +01:00
* armorStand()
2014-10-05 18:29:04 +02:00
* arrow()
* azureBluet()
* bakedPotato()
2015-01-11 01:11:44 +01:00
* banner()
2014-10-05 18:29:04 +02:00
* beacon()
* bed()
* bedrock()
2015-01-11 01:11:44 +01:00
* birchDoor()
* birchFence()
* birchFenceGate()
2014-10-05 18:29:04 +02:00
* birchLeaves()
* birchLog()
* birchSapling()
* birchWood()
2015-01-11 01:11:44 +01:00
* birchWoodSlab()
* birchWoodStairs()
2014-10-05 18:29:04 +02:00
* blackCarpet()
* blackGlass()
* blackGlassPane()
* blackStainedClay()
* blazePowder()
* blazeRod()
* blocksRecord()
* blueCarpet()
* blueGlass()
* blueGlassPane()
* blueOrchid()
* blueStainedClay()
* boat()
* bone()
* bonemeal()
* book()
* bookAndQuill()
* bookshelf()
* bottleOEnchanting()
* bow()
* bowl()
* bread()
* brewingStand()
* brickBlock()
2015-01-11 01:11:44 +01:00
* brickSlab()
* brickStairs()
2014-10-05 18:29:04 +02:00
* brownCarpet()
* brownGlass()
* brownGlassPane()
* brownMushroom()
* brownStainedClay()
* bucket()
* burningFurnace()
* cactus()
* cactusGreen()
* cake()
* carrot()
* carrotOnAStick()
* carrots()
* cauldron()
* chainmailBoots()
* chainmailChestplate()
* chainmailHelmet()
* chainmailLeggings()
* charcoal()
* chest()
* chirpRecord()
* clay()
* clayBall()
* clayBrick()
* clownFish()
* coal()
* coalBlock()
* coalOre()
2015-01-11 01:11:44 +01:00
* coarseDirt()
2014-10-05 18:29:04 +02:00
* cobble()
* cobbleSilverFishBlock()
2015-01-11 01:11:44 +01:00
* cobbleSlab()
* cobbleStairs()
2014-10-05 18:29:04 +02:00
* cobblestoneWall()
* cocoaBeans()
* cocoaPlant()
* commandBlock()
* compass()
* cookedChicken()
* cookedClownFish()
* cookedFish()
2015-01-11 01:11:44 +01:00
* cookedMutton()
2014-10-05 18:29:04 +02:00
* cookedPufferFish()
2015-01-11 01:11:44 +01:00
* cookedRabbit()
2014-10-05 18:29:04 +02:00
* cookedSalmon()
* cookie()
* crackedSilverFishBlock()
* crackedStoneBrick()
* creeperHead()
* cyanCarpet()
* cyanDye()
* cyanGlass()
* cyanGlassPane()
* cyanStainedClay()
* dandelionYellow()
2015-01-11 01:11:44 +01:00
* darkOakDoor()
* darkOakFence()
* darkOakFenceGate()
2014-10-05 18:29:04 +02:00
* darkOakLeaves()
* darkOakLog()
* darkOakSapling()
* darkOakStairs()
* darkOakWood()
2015-01-11 01:11:44 +01:00
* darkOakWoodSlab()
2014-10-05 18:29:04 +02:00
* daylightSensor()
* deadBush()
* detectorRail()
* diamond()
* diamondAxe()
* diamondBlock()
* diamondBoots()
* diamondChestplate()
* diamondHelmet()
* diamondHoe()
* diamondHorseArmor()
* diamondLeggings()
* diamondOre()
* diamondPickaxe()
* diamondSpade()
* diamondSword()
2015-01-11 01:11:44 +01:00
* diorite()
2014-10-05 18:29:04 +02:00
* dirt()
* dispenser()
2015-01-11 01:11:44 +01:00
* doubleAcaciaWoodSlab()
* doubleBirchWoodSlab()
* doubleBrickBlockSlab()
* doubleCobbleSlab()
* doubleDarkOakWoodSlab()
2014-10-05 18:29:04 +02:00
* doubleGrass()
2015-01-11 01:11:44 +01:00
* doubleJungleWoodSlab()
* doubleNetherBrickSlab()
* doubleOakWoodSlab()
* doubleOrnateStoneSlab()
* doubleQuartzSlab()
* doubleRedSandstoneSlab()
* doubleSandStoneTrimSlab()
* doubleSandstoneSlab()
* doubleSpruceWoodSlab()
* doubleStoneBricksSlab()
* doubleStoneSlab()
* doubleWoodSlab()
2014-10-05 18:29:04 +02:00
* dropper()
* egg()
* elevenRecord()
* emerald()
* emeraldBlock()
* emeraldOre()
* emptyMap()
* enchantedBook()
* enchantmentTable()
* endPortal()
* endPortalFrame()
* endStone()
* enderChest()
* enderDragonEgg()
* enderPearl()
* eyeofEnder()
* farRecord()
* feather()
* fence()
* fenceGate()
* fermentedSpiderEye()
* fireBlock()
* fireCharge()
* fireworkRocket()
* fireworkStar()
* fishingRod()
* flint()
* flintAndSteel()
* flowerPot()
* furnace()
* ghastTear()
* glass()
* glassBottle()
* glassPane()
* glisteringMelon()
* glowStone()
* glowstoneDust()
* goldAxe()
* goldBlock()
* goldBoots()
* goldChestplate()
* goldHelmet()
* goldHoe()
* goldHorseArmor()
* goldIngot()
* goldLeggings()
* goldNugget()
* goldOre()
* goldPickaxe()
* goldRecord()
* goldSpade()
* goldSword()
* goldenApple()
* goldenCarrot()
2015-01-11 01:11:44 +01:00
* granite()
2014-10-05 18:29:04 +02:00
* grass()
* gravel()
* grayCarpet()
* grayDye()
* grayGlass()
* grayGlassPane()
* grayStainedClay()
* greenCarpet()
* greenGlass()
* greenGlassPane()
* greenRecord()
* greenStainedClay()
* grilledPork()
* gunpowder()
* hardenedClay()
* hayBale()
* heavyWeightedPressurePlate()
* hopper()
* hugeBrownMushroom()
* hugeRedMushroom()
* humanHead()
* ice()
* inkSack()
* ironAxe()
* ironBars()
* ironBlock()
* ironBoots()
* ironChestplate()
* ironDoor()
* ironHelmet()
* ironHoe()
* ironHorseArmor()
* ironIngot()
* ironLeggings()
* ironOre()
* ironPickaxe()
* ironSpade()
* ironSword()
* itemFrame()
* jackOLantern()
* jukebox()
2015-01-11 01:11:44 +01:00
* jungleDoor()
* jungleFence()
* jungleFenceGate()
2014-10-05 18:29:04 +02:00
* jungleLeaves()
* jungleLog()
* jungleSapling()
* jungleWood()
2015-01-11 01:11:44 +01:00
* jungleWoodSlab()
* jungleWoodStairs()
2014-10-05 18:29:04 +02:00
* ladder()
* lapisBlock()
* lapisLazuli()
* lapislazuliOre()
* largeFern()
* lava()
* lavaBucket()
* lavaFlowing()
* lead()
* leather()
* leatherBoots()
* leatherChestplate()
* leatherHelmet()
* leatherLeggings()
* lever()
* lightBlueCarpet()
* lightBlueDye()
* lightBlueGlass()
* lightBlueGlassPane()
* lightBlueStainedClay()
* lightGrayCarpet()
* lightGrayDye()
* lightGrayGlass()
* lightGrayGlassPane()
* lightGrayStainedClay()
* lightWeightedPressurePlate()
* lilac()
* lilypad()
* limeCarpet()
* limeDye()
* limeGlass()
* limeGlassPane()
* limeStainedClay()
* magentaCarpet()
* magentaDye()
* magentaGlass()
* magentaGlassPane()
* magentaStainedClay()
* magmaCream()
* mallRecord()
* map()
* mellohiRecord()
* melon()
* melonSeeds()
* melonSlice()
* milkBucket()
* minecart()
* minecartCommandBlock()
* minecartHopper()
* minecartTNT()
* mobSpawner()
* mossyBrickSilverFishBlock()
* mossyCobble()
* mossyCobbleWall()
* mossyStoneBrick()
* mushroomSoup()
* mycelium()
* nameTag()
* netherBrick()
* netherBrickFence()
2015-01-11 01:11:44 +01:00
* netherBrickStairs()
2014-10-05 18:29:04 +02:00
* netherBricks()
2015-01-11 01:11:44 +01:00
* netherBricksSlab()
2014-10-05 18:29:04 +02:00
* netherQuartz()
* netherQuartzOre()
* netherStar()
* netherWart()
* netherrack()
* noteBlock()
* oakLeaves()
* oakLog()
* oakSapling()
* oakWood()
2015-01-11 01:11:44 +01:00
* oakWoodSlab()
2014-10-05 18:29:04 +02:00
* obsidian()
* orangeCarpet()
* orangeDye()
* orangeGlass()
* orangeGlassPane()
* orangeStainedClay()
* orangeTulip()
* ornateQuartzBlock()
* ornateSilverFishBlock()
* ornateStoneBrick()
2015-01-11 01:11:44 +01:00
* ornateStoneSlab()
2014-10-05 18:29:04 +02:00
* oxeyeDaisy()
* packedIce()
* painting()
* paper()
* peony()
* pineLeaves()
* pineLog()
2015-01-11 01:11:44 +01:00
* pineWoodStairs()
2014-10-05 18:29:04 +02:00
* pinkCarpet()
* pinkDye()
* pinkGlass()
* pinkGlassPane()
* pinkStainedClay()
* pinkTulip()
* piston()
* podzol()
* poisonousPotato()
2015-01-11 01:11:44 +01:00
* polishedAndesite()
* polishedDiorite()
* polishedGranite()
2014-10-05 18:29:04 +02:00
* poppy()
* pork()
* portal()
* potato()
* potatoes()
* potion()
* poweredMinecart()
* poweredRail()
2015-01-11 01:11:44 +01:00
* prismarineCrystals()
* prismarineShard()
2014-10-05 18:29:04 +02:00
* pufferFish()
* pumpkin()
* pumpkinPie()
* pumpkinSeeds()
* purpleCarpet()
* purpleDye()
* purpleGlass()
* purpleGlassPane()
* purpleStainedClay()
* quartzBlock()
* quartzPillarCap()
* quartzPillarHorizontal()
* quartzPillarVertical()
2015-01-11 01:11:44 +01:00
* quartzSlab()
2014-10-05 18:29:04 +02:00
* quartzStairs()
2015-01-11 01:11:44 +01:00
* rabbitFoot()
* rabbitHide()
* rabbitStew()
2014-10-05 18:29:04 +02:00
* rail()
* rawBeef()
* rawChicken()
* rawFish()
2015-01-11 01:11:44 +01:00
* rawMutton()
* rawRabbit()
2014-10-05 18:29:04 +02:00
* rawSalmon()
* redCarpet()
* redGlass()
* redGlassPane()
* redMushroom()
2015-01-11 01:11:44 +01:00
* redSandstone()
* redSandstoneBlank()
* redSandstoneOrnate()
* redSandstoneSlab()
* redSandstoneStairs()
2014-10-05 18:29:04 +02:00
* redStainedClay()
* redStone()
* redTulip()
* redstoneBlock()
* redstoneComparator()
* redstoneLampOff()
* redstoneOre()
* redstoneRepeater()
* redstoneTorchOn()
* reed()
* roseBush()
* roseRed()
* rottenFlesh()
* saddle()
* sand()
2015-01-11 01:11:44 +01:00
* sandStoneTrimSlab()
2014-10-05 18:29:04 +02:00
* sandstone()
* sandstoneBlank()
* sandstoneOrnate()
2015-01-11 01:11:44 +01:00
* sandstoneSlab()
* sandstoneStairs()
2014-10-05 18:29:04 +02:00
* seeds()
* shears()
* shrub()
* sign()
* skeletonHead()
* slimeBall()
* snow()
* snowBall()
* snowBlock()
* soil()
* soulSand()
* spawnEgg()
* spiderEye()
* spiderWeb()
* sponge()
2015-01-11 01:11:44 +01:00
* spruceDoor()
* spruceFence()
* spruceFenceGate()
2014-10-05 18:29:04 +02:00
* spruceSapling()
* spruceWood()
2015-01-11 01:11:44 +01:00
* spruceWoodSlab()
2014-10-05 18:29:04 +02:00
* stalRecord()
* steak()
* stick()
* stickyPiston()
* stone()
* stoneAxe()
* stoneBrick()
* stoneBrickSilverFishBlock()
2015-01-11 01:11:44 +01:00
* stoneBrickStairs()
* stoneBricksSlab()
2014-10-05 18:29:04 +02:00
* stoneButton()
* stoneHoe()
* stonePickaxe()
* stonePlate()
* stoneSilverFishBlock()
2015-01-11 01:11:44 +01:00
* stoneSlab()
2014-10-05 18:29:04 +02:00
* stoneSpade()
* stoneSword()
* storageMinecart()
* stradRecord()
* string()
* sugar()
* sunflower()
* tallFern()
* tallGrass()
* tnt()
* torch()
* trapdoor()
* trappedChest()
* tripwireHook()
* vines()
* waitRecord()
* wardRecord()
* watch()
* water()
* waterBucket()
* waterFlowing()
* wheat()
* whiteCarpet()
* whiteGlass()
* whiteGlassPane()
* whiteStainedClay()
* whiteTulip()
* witherSkeletonHead()
* woodAxe()
* woodDoor()
* woodHoe()
* woodPickaxe()
* woodPlate()
2015-01-11 01:11:44 +01:00
* woodSlab()
2014-10-05 18:29:04 +02:00
* woodSpade()
* woodSword()
* woodenButton()
2015-01-11 01:11:44 +01:00
* woodenStairs()
2014-10-05 18:29:04 +02:00
* woolBlack()
* woolBlue()
* woolBrown()
* woolCyan()
* woolDarkGreen()
* woolGray()
* woolLightBlue()
* woolLightGray()
* woolLightGreen()
* woolMagenta()
* woolOrange()
* woolPink()
* woolPurple()
* woolRed()
* woolWhite()
* woolYellow()
* workbench()
* writtenBook()
* yellowCarpet()
* yellowFlower()
* yellowGlass()
* yellowGlassPane()
* yellowStainedClay()
* zombieHead()
***/