summaryrefslogtreecommitdiffstats
path: root/EssentialsiConomyBridge5/src/com/iConomy/iConomy.java
diff options
context:
space:
mode:
authorxeology <xeology@e251c2fe-e539-e718-e476-b85c1f46cddb>2011-05-03 04:29:37 +0000
committerxeology <xeology@e251c2fe-e539-e718-e476-b85c1f46cddb>2011-05-03 04:29:37 +0000
commita46bc7448b7defe971139567233d0bc80f69d4ad (patch)
tree28f73fa6bba1b83db632170e9b9bb203676de1df /EssentialsiConomyBridge5/src/com/iConomy/iConomy.java
parent897810fe411deeae8135109e250424d91aa66170 (diff)
downloadEssentials-a46bc7448b7defe971139567233d0bc80f69d4ad.tar
Essentials-a46bc7448b7defe971139567233d0bc80f69d4ad.tar.gz
Essentials-a46bc7448b7defe971139567233d0bc80f69d4ad.tar.lz
Essentials-a46bc7448b7defe971139567233d0bc80f69d4ad.tar.xz
Essentials-a46bc7448b7defe971139567233d0bc80f69d4ad.zip
Working with ico 5.0 plugins. Not sure about banks . . no plugins to test it with . . . yet! Reverse compatability broken, ico decided to switch packages.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1327 e251c2fe-e539-e718-e476-b85c1f46cddb
Diffstat (limited to 'EssentialsiConomyBridge5/src/com/iConomy/iConomy.java')
-rw-r--r--EssentialsiConomyBridge5/src/com/iConomy/iConomy.java96
1 files changed, 96 insertions, 0 deletions
diff --git a/EssentialsiConomyBridge5/src/com/iConomy/iConomy.java b/EssentialsiConomyBridge5/src/com/iConomy/iConomy.java
new file mode 100644
index 000000000..725e7e5fb
--- /dev/null
+++ b/EssentialsiConomyBridge5/src/com/iConomy/iConomy.java
@@ -0,0 +1,96 @@
+package com.iConomy;
+
+import com.earth2me.essentials.Essentials;
+import com.earth2me.essentials.api.Economy;
+import com.iConomy.system.Account;
+import org.bukkit.plugin.java.JavaPlugin;
+import com.iConomy.system.Bank;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.bukkit.plugin.Plugin;
+import org.bukkit.plugin.PluginManager;
+
+
+/**
+ * This is not iConomy and I take NO credit for iConomy!
+ * This is FayConomy, a iConomy Essentials Eco bridge!
+ * @author Xeology
+ */
+public class iConomy extends JavaPlugin
+{
+ public static Bank Bank=null;
+ public static boolean Banking = true;
+ public static boolean BankingMultiple = true;
+ private static final Logger logger = Logger.getLogger("Minecraft");
+
+ @Override
+ public void onDisable()
+ {
+ }
+
+ @Override
+ public void onEnable()
+ {
+ Bank=new Bank("hello");
+ PluginManager pm = this.getServer().getPluginManager();
+ Plugin p = pm.getPlugin("Essentials");
+ if (p != null)
+ {
+ if (!pm.isPluginEnabled(p))
+ {
+ pm.enablePlugin(p);
+ }
+ }
+
+ String version = this.getDescription().getDescription().replaceAll(".*: ", "");
+ if (!version.equals(Essentials.getStatic().getDescription().getVersion()))
+ {
+ logger.log(Level.WARNING, "Version mismatch! Please update all Essentials jars to the same version.");
+ }
+ Essentials.getStatic().setIConomyFallback(false);
+
+
+
+ logger.info("Loaded " + this.getDescription().getDescription() + " by " + Essentials.AUTHORS);
+ logger.info("Make sure you don't have iConomy installed, if you use this.");
+ }
+
+ //Fake bank
+ public static Bank getBank()
+ {
+ return Bank;
+ }
+
+ public static String format(double amount)
+ {
+ return Economy.format(amount);
+ }
+
+ public static String format(String account)
+ {
+ return getAccount(account).getHoldings().toString();
+ }
+
+ public static String format(String bank, String account)
+ {
+ return (new Bank(bank)).getAccount(account).getHoldings().toString();
+ }
+
+ public static Account getAccount(String name)
+ {
+ return Bank.getAccount(name);
+
+ }
+
+ public static boolean hasAccount(String name)
+ {
+ if (!existCheck.exist(name))
+ {
+ if (!Economy.accountExist(name))
+ {
+ Economy.newAccount(name);
+ }
+ }
+ return true;
+ }
+}