ScriptCraft
ScriptCraft lets you create your own mods using Javascript. ScriptCraft uses the CommonJS module system (the same module loading system used by Node.js) so managing your code will be easier. You can also run Javascript code on the in-game command prompt or extend the game by writing plugins that use the Bukkit API in javascript.
Examples:
At the command prompt type:
/js 1 + 1
> 2
... Any javascript code can be evaluated at the in-game command prompt.
/js alert( 'Hello ' + self.name )
> Hello walterh
... Special bukkit variables are available via javascript , for example the server
object is the instance of org.bukkit.Server . Writing event handlers in ScriptCraft is relatively easy...
events.blockBreak( function( event ) {
echo(event.player, 'You broke a block!' );
});
events.playerJoin( function( event ) {
echo( event.player, 'Welcome to the server!' );
});
... Any bukkit event can be handled. The above code prints the name of any player who breaks a block in the game. ScriptCraft comes with some built-in functions to make building easier...
/js box( blocks.wool.black, 4, 9 , 1)
... creates a 2001 Monolith 4 blocks wide by 9 blocks high by 1 block long.
The full bukkit API can be used via javascript to write new mods. Yes - you can write bukkit plugins in javascript! See ScriptCraft on GitHub for more information. Full documentation is available on the github docs page.
A Youtube Video demonstrating Exploding Arrows in ScriptCraft A Youtube video demonstrating a mini-game (SnowBall Fight)
[11:53:20 ERROR]: [scriptcraft] No JavaScript Engine available. ScriptCraft will not work without Javascript.
How do I fix this error/install a JS engine?
guys, im in html and js very good. i just need to know how to make dehydratation. i dont know "mc javascript". how i can add delay time to wait to start dehydratation? how i add effects?
thanks.
In reply to Forge_User_62261398:
Take a look at the Young Person's Guide to Programming in Minecraft, and the API Reference. Both are avaialable here https://github.com/walterhiggins/ScriptCraft/tree/development/docs
This is one the best minecraft plugins I've ever seen.
Anything you can do with Java you can do it with JavaScript using this plugin, writing less lines and making it easier to read and mantain.
Never abandon this project, Walter.
Do you have a IRC channel?
Do you have a IRC channel on esper.net?
Awesome plugin. I'm pretty familiar with the Bukkit API and am currently learning JavaScript, so this is perfect for adding in features to my server quickly, thanks.
@broluigi
Yes. ScriptCraft itself is just a Java plugin that houses Javascript plugins so you can use all of the plugman commands.
does this plugin work with plugman
- Removed advertising of another plugin - Eyamaz
What is easer teaching javascript or default java?
@siemaeniu500
You can write javascript scripts and put them in the /scriptcraft/plugins/ folder.
For example: save the above code in a file called blockbrk.js and drop it in the scriptcraft/plugins folder and every time a player breaks a block they're sent a message.
I can write scripts like in plugin"Skript"? And load it from file?
@ThoLav
I'm not sure it will work (I haven't tried it myself) but you could try listening for this event...
http://jd.bukkit.org/beta/apidocs/org/bukkit/event/player/AsyncPlayerChatEvent.html
All events are cancelable so you could cancel it or change the message sent.
Walter
Hey Walter,
is there a way to catch a message from plugins to a player? For example a WorldGuard message?
I want to script my own plot management, using WG in background, but I want to have the possibility to suppress the WG messages and send my own changed/translated message to player.
@walterhiggins
Hey Walter,
thanks for your information.
<<reply 2057497="">>
Usage: /jsp command command-params
If you type /jsp without a command it throws the Usage error you see above. I should probably make this a warning rather than an error/exception.
Thanks.
Walter
Hey Walter,
I'm getting this error when I type /jsp without parameters!
http://pastebin.com/nczvYcL3
@kgame
Take a look at this: https://forums.bukkit.org/threads/ignore-cancelled-events.61155/
Essentially, if [event].isCancelled() is true, then just don't let the handler do anything.
@EventHandler(ignoreCancelled = true)
How to set this attribute at events.on