Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package me.patrickfreed.iConomyPunga;
  2.  
  3. import org.bukkit.event.server.PluginDisableEvent;
  4. import org.bukkit.event.server.PluginEnableEvent;
  5. import org.bukkit.event.server.ServerListener;
  6. import org.bukkit.plugin.Plugin;
  7.  
  8. import com.nijikokun.register.payment.Methods;
  9.    
  10. public class eConomyPungaPluginListener extends ServerListener {
  11.     private iConomyPunga plugin;
  12.     private Methods Methods = null;
  13.  
  14.     public eConomyPungaPluginListener(iConomyPunga ico) {
  15.         this.plugin = ico;
  16.         this.Methods = new Methods();
  17.  }
  18.  
  19.  @SuppressWarnings("static-access")
  20. @Override
  21.  public void onPluginDisable(PluginDisableEvent event) {
  22.      // Check to see if the plugin thats being disabled is the one we are using
  23.      if (this.Methods != null && this.Methods.hasMethod()) {
  24.          Boolean check = this.Methods.checkDisabled(event.getPlugin());
  25.  
  26.          if(check) {
  27.              this.plugin.Method = null;
  28.              System.out.println("[iConomyPunga] Payment method was disabled. No longer accepting payments.");
  29.          }
  30.      }
  31.  }
  32.  
  33.  @SuppressWarnings("static-access")
  34. @Override
  35.  public void onPluginEnable(PluginEnableEvent event) {
  36.      iConomyPunga iConomyPunga = plugin;
  37.      // Check to see if we need a payment method
  38.      if (!this.Methods.hasMethod()) {
  39.          if(this.Methods.setMethod(event.getPlugin())) {
  40.              // You might want to make this a public variable inside your MAIN class public Method Method = null;
  41.              // then reference it through this.plugin.Method SO that way you CAN use it IN the rest OF your plugin ;)
  42.              iConomyPunga.Method = this.Methods.getMethod();
  43.              System.out.println("[iConomyPunga] Successfully linked with " + this.plugin.Method.getName() + " v." + this.plugin.Method.getVersion());
  44.          }
  45.      }
  46.      Plugin SuperPerms = iConomyPunga.getServer().getPluginManager().getPlugin("PermissionsBukkit");
  47.      Plugin Permissions = iConomyPunga.getServer().getPluginManager().getPlugin("Permissions");
  48.      int doOnce = 0;
  49.      if (SuperPerms != null && SuperPerms.isEnabled()== true && doOnce == 0){
  50.         iConomyPungaEntityListener ipel = new iConomyPungaEntityListener(iConomyPunga);
  51.             ipel.permsmode = "SuperPerms";
  52.                 plugin.setupPermissions();
  53.                 doOnce = 1;
  54.      }
  55.      if (Permissions != null && Permissions.isEnabled()&& doOnce == 0){
  56.          plugin.setupPermissions();
  57.          doOnce = 1;
  58.      }
  59.      else if (doOnce == 0){
  60.          plugin.setupPermissions();
  61.          doOnce = 1;
  62.      }
  63.  
  64.  }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement