Api Links

Languages

By default java only supports javascript if you are on the latest version, but its possible to install other scripting languages by downloading their libraries and putting them in the mods folder. For example:

  • ECMAScript(more commenly know as javascript): Should be available if you are on the latest java version. (If you have java 8 and it’s not available, go to your java/jre/lib/ext folder and copy the nashorn.jar to the mods folder)
  • Python: Download the standalone jar from the Jython website and put it in the mods folder.
  • Lua: Download the luaj.zip from the Luaj website and put the lib/luaj-jse.jar into the mods folder.
  • Ruby: Download the jruby.zip from the JRuby website and put the lib/jruby.jar into the mods folder.
  • Php: Download the JavaBridge and php-script.jar from the php-java-bridge website and put them in the mods folder
  • Scala: Download the scala.zip from the Scala website and put the lib/scala-compiler.jar into the mods folder (needs to be 2.11.x or higher)

There are probably more scripting languages available. These are just some examples. You can usually find them by googling: java scriptengine <your language name>

API

If there is any extra functionality you would like feel free to ask for it on the forums or join us on discord
Simple script example

Hooks

Function Event Description
init NpcEvent.InitEvent Called when the npc spawns or respawns
tick NpcEvent.UpdateEvent Called as update tick (once every 10 ticks)
interact NpcEvent.InteractEvent Called when a player interacts with the npc
dialog DialogEvent.OpenEvent Called when a player opens a dialog from the npc
dialog_option DialogEvent.OptionEvent Called when a player selects a dialog option or closes a dialog
damaged NpcEvent.DamagedEvent Called when an npc gets attacked. Can be cancelled
died NpcEvent.DiedEvent Called when an npc gets killed
meleeAttack NpcEvent.MeleeAttackEvent Called when an npc is going to attack
rangedLaunched NpcEvent.RangedLaunchedEvent Called when an npc fires a projectile
target NpcEvent.TargetEvent Called when an npc targets something
targetLost NpcEvent.TargetLostEvent Called when an npc looses his target
kill NpcEvent.KilledEntityEvent Called when an npc kills something
role RoleEvent.* Called by some roles
collide NpcEvent.CollideEvent Called when an npc collides with an entity
timer NpcEvent.TimerEvent Called when a timer finishes

ScriptBlock/ScriptedBlockDoor events:

Function Event Description
init BlockEvent.InitEvent Called when the block is created or loaded
tick BlockEvent.UpdateEvent Called as update tick (once every 10 ticks)
interact BlockEvent.InteractEvent Called when a player interacts with the block
redstone BlockEvent.RedstoneEvent Called when the block receives a new redstone signal
fallenUpon BlockEvent.EntityFallenUponEvent Called when an entity falls upon this block
doorToggle BlockEvent.DoorToggleEvent Called when the scripteddoor gets opened/closed
broken BlockEvent.BreakEvent Called when the block is broken
exploded BlockEvent.ExplodedEvent Called when the block was blown up
rainFilled BlockEvent.RainFillEvent Called when it rains sometimes
neighborChanged BlockEvent.NeighborChangedEvent Called when a neighboring block is changed
clicked BlockEvent.ClickedEvent Called when the block is clicked
harvested BlockEvent.HarvestedEvent Called when a block is destroyed by a player
collide BlockEvent.CollidedEvent Called when an entity collides with the block
timer BlockEvent.TimerEvent Called when a timer finishes

Player events:

Function Event Description
init PlayerEvent.InitEvent Called when the block is created or loaded
tick PlayerEvent.UpdateEvent Called as update tick (once every 10 ticks)
interact PlayerEvent.InteractEvent Called when a player interacts with the block
broken PlayerEvent.BreakEvent Called when a block is broken
toss PlayerEvent.TossEvent Called when a player tosses an item on the ground
containerOpen PlayerEvent.ContainerOpen Called when a player opens a container
containerClosed PlayerEvent.ContainerClosed Called when a player closes a container
died PlayerEvent.DiedEvent Called when a player dies
kill PlayerEvent.KilledEntityEvent Called when a player kills an entity
damaged PlayerEvent.DamagedEvent Called when a player gets damaged
timer PlayerEvent.TimerEvent Called when a timer finishes
login PlayerEvent.LoginEvent Called when a player logs in
logout PlayerEvent.LogoutEvent Called when a player logs out
chat PlayerEvent.ChatEvent Called when a player says something
Ad: