summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorementalo <ementalo@e251c2fe-e539-e718-e476-b85c1f46cddb>2011-05-16 20:48:19 +0000
committerementalo <ementalo@e251c2fe-e539-e718-e476-b85c1f46cddb>2011-05-16 20:48:19 +0000
commit139a3a128a154dc6d28f7cf5c8b8c0026808893d (patch)
treed4340eb184edc6dae8342393744ef2f1f82aba5f
parent80f6c58dad107e41669f9c0117c36e3389accc7d (diff)
downloadEssentials-139a3a128a154dc6d28f7cf5c8b8c0026808893d.tar
Essentials-139a3a128a154dc6d28f7cf5c8b8c0026808893d.tar.gz
Essentials-139a3a128a154dc6d28f7cf5c8b8c0026808893d.tar.lz
Essentials-139a3a128a154dc6d28f7cf5c8b8c0026808893d.tar.xz
Essentials-139a3a128a154dc6d28f7cf5c8b8c0026808893d.zip
[trunk] Register 1.5
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1503 e251c2fe-e539-e718-e476-b85c1f46cddb
-rw-r--r--Essentials/src/com/earth2me/essentials/register/payment/Methods.java29
1 files changed, 13 insertions, 16 deletions
diff --git a/Essentials/src/com/earth2me/essentials/register/payment/Methods.java b/Essentials/src/com/earth2me/essentials/register/payment/Methods.java
index 6bef3c6b8..5bd628b7d 100644
--- a/Essentials/src/com/earth2me/essentials/register/payment/Methods.java
+++ b/Essentials/src/com/earth2me/essentials/register/payment/Methods.java
@@ -5,8 +5,8 @@ import java.util.Set;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
-
-/**
+
+/***
* Methods.java
* Controls the getting / setting of methods & the method of payment used.
*
@@ -24,6 +24,7 @@ public class Methods {
this.addMethod("iConomy", new com.earth2me.essentials.register.payment.methods.iCo4());
this.addMethod("iConomy", new com.earth2me.essentials.register.payment.methods.iCo5());
this.addMethod("BOSEconomy", new com.earth2me.essentials.register.payment.methods.BOSE());
+
}
public Set<String> getDependencies() {
@@ -51,23 +52,19 @@ public class Methods {
}
public boolean setMethod(Plugin method) {
- PluginManager manager = method.getServer().getPluginManager();
+ if(hasMethod()) return true;
- if (method != null && method.isEnabled()) {
- Method plugin = this.createMethod(method);
- if (plugin != null) Method = plugin;
- } else {
- for(String name: this.getDependencies()) {
- if(hasMethod()) break;
+ PluginManager manager = method.getServer().getPluginManager();
+ Plugin plugin = null;
- method = manager.getPlugin(name);
- if(method == null) continue;
- if(!method.isEnabled()) manager.enablePlugin(method);
- if(!method.isEnabled()) continue;
+ for(String name: this.getDependencies()) {
+ if(hasMethod()) break;
+ if(method.getDescription().getName().equals(name)) plugin = method; else plugin = manager.getPlugin(name);
+ if(plugin == null) continue;
+ if(!plugin.isEnabled()) continue;
- Method plugin = this.createMethod(method);
- if (plugin != null) Method = plugin;
- }
+ Method current = this.createMethod(plugin);
+ if (current != null) this.Method = current;
}
return hasMethod();