Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.patrickfreed.iConomyPunga;
- import org.bukkit.event.server.PluginDisableEvent;
- import org.bukkit.event.server.PluginEnableEvent;
- import org.bukkit.event.server.ServerListener;
- import org.bukkit.plugin.Plugin;
- import com.nijikokun.register.payment.Methods;
- public class eConomyPungaPluginListener extends ServerListener {
- private iConomyPunga plugin;
- private Methods Methods = null;
- public eConomyPungaPluginListener(iConomyPunga ico) {
- this.plugin = ico;
- this.Methods = new Methods();
- }
- @SuppressWarnings("static-access")
- @Override
- public void onPluginDisable(PluginDisableEvent event) {
- // Check to see if the plugin thats being disabled is the one we are using
- if (this.Methods != null && this.Methods.hasMethod()) {
- Boolean check = this.Methods.checkDisabled(event.getPlugin());
- if(check) {
- this.plugin.Method = null;
- System.out.println("[iConomyPunga] Payment method was disabled. No longer accepting payments.");
- }
- }
- }
- @SuppressWarnings("static-access")
- @Override
- public void onPluginEnable(PluginEnableEvent event) {
- iConomyPunga iConomyPunga = plugin;
- // Check to see if we need a payment method
- if (!this.Methods.hasMethod()) {
- if(this.Methods.setMethod(event.getPlugin())) {
- // You might want to make this a public variable inside your MAIN class public Method Method = null;
- // then reference it through this.plugin.Method SO that way you CAN use it IN the rest OF your plugin ;)
- iConomyPunga.Method = this.Methods.getMethod();
- System.out.println("[iConomyPunga] Successfully linked with " + this.plugin.Method.getName() + " v." + this.plugin.Method.getVersion());
- }
- }
- Plugin SuperPerms = iConomyPunga.getServer().getPluginManager().getPlugin("PermissionsBukkit");
- Plugin Permissions = iConomyPunga.getServer().getPluginManager().getPlugin("Permissions");
- int doOnce = 0;
- if (SuperPerms != null && SuperPerms.isEnabled()== true && doOnce == 0){
- iConomyPungaEntityListener ipel = new iConomyPungaEntityListener(iConomyPunga);
- ipel.permsmode = "SuperPerms";
- plugin.setupPermissions();
- doOnce = 1;
- }
- if (Permissions != null && Permissions.isEnabled()&& doOnce == 0){
- plugin.setupPermissions();
- doOnce = 1;
- }
- else if (doOnce == 0){
- plugin.setupPermissions();
- doOnce = 1;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement