-
Notifications
You must be signed in to change notification settings - Fork 0
Plugin Creator
RedstoneAlmeida edited this page Feb 28, 2022
·
3 revisions
The proxy works with a javascript plugin system, all are interconnected, it is for simple systems, but can be improved with some pull-request
Just create a javascript file in the plugins folder automatically generated by the proxy
See the code below
var name = "Teste"; // plugin name
var version = "0.0.1"; // plugin version
function onEnable()
{
// after proxy and plugin loaded
}
function getName() {
return this.name; // function is required to load plugin
}
function getVersion() {
return this.version; // function is required to load plugin
}
function onEnable()
{
// manager is global variable
// createCommand(commandName, commandFunction)
manager.createCommand("hello", "onHello");
}
// values is array of parameters command
// example "hello ok"
// values contains ok
function onHello(values)
{
print("Hello");
}
Events are simple and practical. See events in events
// event loaded by class name
// if class name is TestEvent, you call "function TestEvent(event)"
function SessionCreateEvent(event)
{
// event.getSessionId() return SessionID
// event.getSession() return Session class
}
function SessionInitializeEvent(event)
{
// event.setServerName(string) defines SessionName
// event.getSessionName()
}
// cancellable example
// if the event is canceled it will not run until the end
function SessionDataPacketSendEvent(event)
{
event.setCancelled(true);
}
function onEnable()
{
manager.createTask("repeat", 5, true); // loop repeat in five seconds interval
}
// handler is to cancel, example handler.cancel(); you cancel task
function repeat(handler)
{
print("I am loop");
}
See:
manager; loader; scheduler