diff options
author | snowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb> | 2011-05-13 22:08:44 +0000 |
---|---|---|
committer | snowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb> | 2011-05-13 22:08:44 +0000 |
commit | 1f3ba98ad6f6193349eb0e4111dff62e1cf28784 (patch) | |
tree | b802bcb53328e8e8296283cbaa0cb849658148cf /Register/src/com/essentials/register/payment/Methods.java | |
parent | c4099dfb2123fd2bd53378dcfd355b43c694677a (diff) | |
download | Essentials-1f3ba98ad6f6193349eb0e4111dff62e1cf28784.tar Essentials-1f3ba98ad6f6193349eb0e4111dff62e1cf28784.tar.gz Essentials-1f3ba98ad6f6193349eb0e4111dff62e1cf28784.tar.lz Essentials-1f3ba98ad6f6193349eb0e4111dff62e1cf28784.tar.xz Essentials-1f3ba98ad6f6193349eb0e4111dff62e1cf28784.zip |
Register included inside Essentials with different packagename to prevent recursion
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1443 e251c2fe-e539-e718-e476-b85c1f46cddb
Diffstat (limited to 'Register/src/com/essentials/register/payment/Methods.java')
-rw-r--r-- | Register/src/com/essentials/register/payment/Methods.java | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/Register/src/com/essentials/register/payment/Methods.java b/Register/src/com/essentials/register/payment/Methods.java new file mode 100644 index 000000000..7cf340940 --- /dev/null +++ b/Register/src/com/essentials/register/payment/Methods.java @@ -0,0 +1,76 @@ +package com.nijikokun.register.payment; + +import com.iConomy.iConomy; +import cosine.boseconomy.BOSEconomy; +import com.earth2me.essentials.Essentials; + +import org.bukkit.plugin.Plugin; +import org.bukkit.plugin.PluginManager; +import org.bukkit.plugin.PluginDescriptionFile; + +public class Methods { + private Method Method = null; + public Plugin method = null; + + public boolean setMethod(Plugin method) { + PluginManager loader = method.getServer().getPluginManager(); + + if(method.isEnabled()) { + PluginDescriptionFile info = method.getDescription(); + String name = info.getName(); + + if(name.equalsIgnoreCase("iconomy")) { + if(method.getClass().getName().equals("com.iConomy.iConomy")) + Method = new MethodiCo5((iConomy)method); + else { Method = new MethodiCo4((com.nijiko.coelho.iConomy.iConomy)method); } + } else if(name.equalsIgnoreCase("boseconomy")) { + Method = new MethodBOSEconomy((BOSEconomy)method); + } else if(name.equalsIgnoreCase("essentials")) { + Method = new MethodEEco((Essentials)method); + } + } + + if(!hasMethod()) { + if(loader.getPlugin("iConomy") != null) { + method = loader.getPlugin("iConomy"); + if(method.getClass().getName().equals("com.iConomy.iConomy")) + Method = new MethodiCo5((iConomy)method); + else { Method = new MethodiCo4((com.nijiko.coelho.iConomy.iConomy)method); } + } else if(loader.getPlugin("BOSEconomy") != null) { + method = loader.getPlugin("BOSEconomy"); + Method = new MethodBOSEconomy((BOSEconomy)method); + } else if(loader.getPlugin("Essentials") != null) { + method = loader.getPlugin("Essentials"); + Method = new MethodEEco((Essentials)method); + } + } + + return hasMethod(); + } + + public boolean checkDisabled(Plugin method) { + PluginDescriptionFile info = method.getDescription(); + String name = info.getName(); + + if(name.equalsIgnoreCase("iconomy")) { + if(method.getClass().getName().equals("com.iConomy.iConomy")) + Method = null; + else { Method = null; } + } else if(name.equalsIgnoreCase("boseconomy")) { + Method = null; + } else if(name.equalsIgnoreCase("essentials")) { + Method = null; + } + + return (Method == null); + } + + public boolean hasMethod() { + return (Method != null); + } + + public Method getMethod() { + return Method; + } + +} |