Beispiel #1
0
 @EventHandler(priority = EventPriority.MONITOR)
 public void onPluginEnable(PluginEnableEvent event) {
   if (event.getPlugin().getDescription().getName().equals("Register")
       && packageExists("com.nijikokun.register.payment.Methods")) {
     if (!Methods.hasMethod()) {
       try {
         Method m = Methods.class.getMethod("addMethod", Methods.class);
         m.setAccessible(true);
         m.invoke(null, "Vault", new net.milkbowl.vault.VaultEco());
         if (!Methods.setPreferred("Vault")) {
           log.info("Unable to hook register");
         } else {
           log.info("[Vault] - Successfully injected Vault methods into Register.");
         }
       } catch (SecurityException e) {
         log.info("Unable to hook register");
       } catch (NoSuchMethodException e) {
         log.info("Unable to hook register");
       } catch (IllegalArgumentException e) {
         log.info("Unable to hook register");
       } catch (IllegalAccessException e) {
         log.info("Unable to hook register");
       } catch (InvocationTargetException e) {
         log.info("Unable to hook register");
       }
     }
   }
 }
Beispiel #2
0
 /** @return true, if there is at least one payment method! */
 public boolean hasPaymentMethods() {
   return Methods.hasMethod();
 }