Hooking into ProperWeather [Updated for R5+]

What can be changed in ProperWeather?

Thanks to new ProperWeather's API which is available since 0.6, you can now change few things in ProperWeather. What can be done with this API:

  • Adding custom weather
  • Custom WeatherSystem ( main class which takes care about a lot of things(see source for details)

Main skeleton of your PW API implementation

To implement ProperWeather's API, you first need to get into bukkit's classpath somehow. Your implementation needs to behave like standard bukkit plugin: [ MyPlugin.java ]

package sk.tomsik68.pw.test;

import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.server.PluginDisableEvent;
import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import sk.tomsik68.pw.plugin.ProperWeather;

public class MyPlugin extends JavaPlugin implements Listener {

	public MyPlugin() {
	}

	public void setupBridge() {
		Plugin test = getServer().getPluginManager().getPlugin("ProperWeather");
		if (test != null && test instanceof ProperWeather) {
			ProperWeather pw = (ProperWeather) test;
			System.out.println("[MyPlugin] Hooked into ProperWeather");
			// register custom Weathers/WeatherSystems (see other pages for description)
		}
	}
	@EventHandler
	public void onPluginEnable(PluginEnableEvent event){
		setupBridge();
	}
	public void onPluginDisable(PluginDisableEvent event){
		setupBridge();
	}
	public void onDisable() {
	}
	public void onEnable() {
		getServer().getPluginManager().registerEvents(this, this);
	}
}

After that see some of these pages. I'll only work with MyPlugin.setupBridge() there.


Comments

Posts Quoted:
Reply
Clear All Quotes