Skip to content

Making a script

Sms_Gamer edited this page May 1, 2021 · 3 revisions

Prerequisites

You need to have the plugin installed as well as the language addons you are going to use installed. Look here to learn how to do that.

You also should know how to use the language you desire to use. There are plenty of tutorials online, although this plugin uses them (especially JavaScript) slightly differently mainly due to the quirks of Java.

Load, Enable, Disable, Reload

Load

The load method doesn't exist for scripts. The script itself is run during load. Most things won't be accessible during this period, for example registering of commands or listeners.

Enable

When the server is enabled, it usually tells all the plugins that, include this one. When this one gets enabled, it tells all the scripts to enable as well. It calls the onEnable method and on_enable for Python (both work for Python). Here you can register commands, listeners, and all that fancy jazz.

Disable

This generally happens when the server is being shut down, thus disabling all the plugins. This plugin calls the onDisable method and on_disable for Python. If you're connected to an SQL database, here is where you should probably disconnect.

Reload

This happens when either the server is being reloaded (velocity), or the plugin is being reloaded (via command; PlugMan doesn't count). This is where you should reload the information used by your script.

Registering Commands

Note: WIP

Clone this wiki locally