From 1f3ba98ad6f6193349eb0e4111dff62e1cf28784 Mon Sep 17 00:00:00 2001 From: snowleo Date: Fri, 13 May 2011 22:08:44 +0000 Subject: 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 --- .../com/essentials/register/payment/Methods.java | 76 ++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 Register/src/com/essentials/register/payment/Methods.java (limited to 'Register/src/com/essentials/register/payment/Methods.java') 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; + } + +} -- cgit v1.2.3