This repository was archived by the owner on Jul 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Getting an instance of PlotSquared
boy0001 edited this page Oct 29, 2014
·
8 revisions
import com.intellectualcrafters.plot.api.PlotAPI;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.plugin.PluginManager;
public class Main extends JavaPlugin {
public PlotAPI api;
@Override
public void onEnable() {
PluginManager manager = Bukkit.getServer().getPluginManager();
final Plugin plotsquared = manager.getPlugin("PlotSquared");
// Disable the plugin if PlotSquared is not installed
// If you move any PlotSquared related tasks to en external class you
// wouldn't have to disable the plugin if PlotSquared wasn't installed
if(plotsquared != null && !plotsquared.isEnabled()) {
sendMessage(null, "&c[PlotApproval] Could not find PlotSquared! Disabling plugin...");
manager.disablePlugin(this);
return;
}
// Do PlotSquared related stuff
api = new PlotAPI(this);
// You can now use this api object to do powerful things.
}
}