Skip to content
This repository has been archived by the owner on May 3, 2018. It is now read-only.

Dragonet PHP Plugin Scripting

The Evil Man edited this page Jun 25, 2015 · 4 revisions

**Before the plugin system really working, the plugin structure CAN ALWAYS CHANGE! ** Dragonet also support PHP interface. Example script:

<?php
/**
@Name: ExamplePlugin
@Author: Developer's Name
@MainClass: MainClass
*/
//There must be a description section like the code before this line. 

class MainClass{ //Define the main class
    /*
     * PHPPlugin is a Java class extends PluginAdapter which implements Bukkit's Plugin interface.
    */
    /** @var PHPPlugin plugin */
    private $plugin;

    public function onLoad($plugin){
        $this->plugin = $plugin;
    }

    public function onEnable(){
        $plugin->getLogger()->info("Plugin enabled! ");
    }

    public function onDisable(){
        $plugin->getLogger()->info("Plugin disabled! ");
    }

    /**
    @Listener: org.bukkit.event.player.PlayerJoinEvent
    */
    public function onPlayerJoin($event){
        $event->getPlayer()->sendMessage("You have joined this cool server! ");
    }
}
?>
Clone this wiki locally