Server Scripts

Server Scritpts

Server Scripts are written in Ruby and executed by JRuby.

Server Scripts are <script-name>.minescript files in the ./plugins/minescript/ServerScript/ folder.

Server Scripts can be executed by command: /runscript <script-name> [arg0] [arg1]...

Server Scripts have:

  • Full Ruby syntax support
  • A reference to the running server: server
  • A reference to the running player: player
  • Args are passed with String[]: args
  • Most important: Your Imagination

Some examples:

1
2
3
4
server.getOnlinePlayers.each{|p|p.setFireTicks(500)}
java_import org.bukkit.GameMode
player.setGameMode(GameMode::CREATIVE) unless player.nil?
java.lang.System.out.println(args[0]) unless args.nil?

A special server script: onEnable.minescript will be executed automatically when the plugin enables.

And onDisable.minescript will be executed automatically when the plugin disables.

If you have any problems about scripts, or you would like to share your experiences with others, please use the forum


Comments

Posts Quoted:
Reply
Clear All Quotes