diff --git a/README.md b/README.md index 5a26a2a..8bfa716 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,7 @@ Github and we'll get to it at our convenience. - iConomy 4 (http://forums.bukkit.org/threads/40/) - iConomy 5 (http://forums.bukkit.org/threads/40/) - iConomy 6 (http://forums.bukkit.org/threads/40/) + - InTime2 - McMoney - Miconomy - MineConomy (http://dev.bukkit.org/server-mods/mineconomy/) diff --git a/lib/InTime2.jar b/lib/InTime2.jar new file mode 100644 index 0000000..b434e0e Binary files /dev/null and b/lib/InTime2.jar differ diff --git a/pom.xml b/pom.xml index f6777ab..bf9b11e 100644 --- a/pom.xml +++ b/pom.xml @@ -77,6 +77,13 @@ Vault currently supports the following: Permissions 3, PEX, GroupManager, bPerms bukkit ${bukkitVersion} + + com.BlackMage.InTime2.InTime2 + InTime2 + 0.3.7 + system + ${project.basedir}/lib/InTime2.jar + com.gmail.bleedobsidian.miconomy MiConomy diff --git a/src/net/milkbowl/vault/Vault.java b/src/net/milkbowl/vault/Vault.java index 43cf97d..037ce20 100644 --- a/src/net/milkbowl/vault/Vault.java +++ b/src/net/milkbowl/vault/Vault.java @@ -56,6 +56,7 @@ import net.milkbowl.vault.economy.plugins.Economy_GoldIsMoney; import net.milkbowl.vault.economy.plugins.Economy_GoldIsMoney2; import net.milkbowl.vault.economy.plugins.Economy_GoldenChestEconomy; import net.milkbowl.vault.economy.plugins.Economy_Gringotts; +import net.milkbowl.vault.economy.plugins.Economy_InTime2; import net.milkbowl.vault.economy.plugins.Economy_McMoney; import net.milkbowl.vault.economy.plugins.Economy_MineConomy; import net.milkbowl.vault.economy.plugins.Economy_MultiCurrency; @@ -255,7 +256,10 @@ public class Vault extends JavaPlugin { hookEconomy("MiConomy", Economy_MiConomy.class, ServicePriority.Normal, "com.gmail.bleedobsidian.miconomy.Main"); // Try to load MiFaConomy - hookEconomy("MineFaConomy", Economy_Minefaconomy.class, ServicePriority.Normal, "me.coniin.plugins.minefaconomy.Minefaconomy"); + hookEconomy("MineFaConomy", Economy_Minefaconomy.class, ServicePriority.Normal, "me.coniin.plugins.minefaconomy.Minefaconomy"); + + // Try to load InTime2 + hookEconomy("InTime2", Economy_InTime2.class, ServicePriority.Normal, "com.BlackMage.InTime2.InTime2"); // Try to load MultiCurrency hookEconomy("MultiCurrency", Economy_MultiCurrency.class, ServicePriority.Normal, "me.ashtheking.currency.Currency", "me.ashtheking.currency.CurrencyList"); diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_InTime2.java b/src/net/milkbowl/vault/economy/plugins/Economy_InTime2.java new file mode 100644 index 0000000..344845f --- /dev/null +++ b/src/net/milkbowl/vault/economy/plugins/Economy_InTime2.java @@ -0,0 +1,214 @@ ++ + /* This file is part of Vault. ++ + ++ + Vault is free software: you can redistribute it and/or modify ++ + it under the terms of the GNU Lesser General Public License as published by ++ + the Free Software Foundation, either version 3 of the License, or ++ + (at your option) any later version. ++ + ++ + Vault is distributed in the hope that it will be useful, ++ + but WITHOUT ANY WARRANTY; without even the implied warranty of ++ + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ + GNU Lesser General Public License for more details. ++ + ++ + You should have received a copy of the GNU Lesser General Public License ++ + along with Vault. If not, see . ++ + */ ++ +package net.milkbowl.vault.economy.plugins; ++ + ++ +import java.util.List; ++ +import java.util.logging.Logger; ++ + ++ +import net.milkbowl.vault.economy.Economy; ++ +import net.milkbowl.vault.economy.EconomyResponse; ++ +import net.milkbowl.vault.economy.EconomyResponse.ResponseType; ++ + ++ +import org.bukkit.Bukkit; ++ +import org.bukkit.event.EventHandler; ++ +import org.bukkit.event.EventPriority; ++ +import org.bukkit.event.Listener; ++ +import org.bukkit.event.server.PluginDisableEvent; ++ +import org.bukkit.event.server.PluginEnableEvent; ++ +import org.bukkit.plugin.Plugin; ++ + ++ +Import com.BlackMage.Intime.Intime ++ + ++ +public class Economy_InTime2 implements Economy { ++ + private static final Logger log = Logger.getLogger("Minecraft"); ++ + ++ + private String name = "InTime2"; ++ + private Plugin plugin = null; ++ + protected Main economy = null; ++ + ++ + public Economy_InTime2(Plugin plugin) { ++ + this.plugin = plugin; ++ + Bukkit.getServer().getPluginManager().registerEvents(new EconomyServerListener(this), plugin); ++ + // Load Plugin in case it was loaded before ++ + if (economy == null) { ++ + Plugin ec = plugin.getServer().getPluginManager().getPlugin("InTime2"); ++ + if (ec != null && ec.isEnabled() && ec.getClass().getName().equals("com.BlackMage.InTime2.InTime2")) { ++ + log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), name)); ++ + } ++ + } ++ + } ++ + ++ + @Override ++ + public boolean isEnabled() { ++ + if (economy == null) { ++ + return false; ++ + } else { ++ + return true; ++ + } ++ + } ++ + ++ + @Override ++ + public String getName() { ++ + return name; ++ + } ++ + ++ + @Override ++ + public String format(double amount) { ++ + return Functions.format(amount); ++ + } ++ + ++ + @Override ++ + public String currencyNameSingular() { ++ + return Functions.currencyName(); ++ + } ++ + ++ + @Override ++ + public String currencyNamePlural() { ++ + return Functions.currencyName(); ++ + } ++ + ++ + @Override ++ + public double getBalance(String playerName) { ++ + return (double) Backend.getMoney(playerName); ++ + } ++ + ++ + @Override ++ + public EconomyResponse withdrawPlayer(String playerName, double amount) { ++ + if (amount < 0) { ++ + return new EconomyResponse(0, 0, ResponseType.FAILURE, "Cannot withdraw negative funds"); ++ + } ++ + ++ + if (Backend.hasEnoughMoney(playerName, amount)) { ++ + int newAmount = Backend.getMoney(playerName) - amount; ++ + Backend.setMoney(playerName, newAmount); ++ + return new EconomyResponse(amount, newAmount, ResponseType.SUCCESS, null); ++ + } else { ++ + return new EconomyResponse(0, Backend.getMoney(playerName), ResponseType.FAILURE, "Insufficient funds"); ++ + } ++ + } ++ + ++ + @Override ++ + public EconomyResponse depositPlayer(String playerName, double amount) { ++ + if (amount < 0) { ++ + return new EconomyResponse(0, 0, ResponseType.FAILURE, "Cannot desposit negative funds"); ++ + } ++ + ++ + int newAmount = Backend.getMoney(playerName) + amount; ++ + Backend.setMoney(playerName, newAmount); ++ + return new EconomyResponse(amount, newAmount, ResponseType.SUCCESS, null); ++ + } ++ + ++ + @Override ++ + public boolean has(String playerName, double amount) { ++ + return getBalance(playerName) >= amount; ++ + } ++ + ++ + @Override ++ + public EconomyResponse createBank(String name, String player) { ++ + ++ + return new EconomyResponse(0, 0, ResponseType.FAILURE, "Banks not supported by InTime2!"); ++ + } ++ + ++ + @Override ++ + public EconomyResponse deleteBank(String name) { ++ + return new EconomyResponse(0, 0, ResponseType.FAILURE, "Banks not supported by InTime2!"); ++ + } ++ + ++ + @Override ++ + public EconomyResponse bankHas(String name, double amount) { ++ + return new EconomyResponse(0, 0, ResponseType.FAILURE, "Banks not supported by InTime2!"); ++ + } ++ + ++ + @Override ++ + public EconomyResponse bankWithdraw(String name, double amount) { ++ + return new EconomyResponse(0, 0, ResponseType.FAILURE, "Banks not supported by InTime2!"); ++ + } ++ + ++ + @Override ++ + public EconomyResponse bankDeposit(String name, double amount) { ++ + return new EconomyResponse(0, 0, ResponseType.FAILURE, "Banks not supported by InTime2!"); ++ + } ++ + ++ + @Override ++ + public EconomyResponse isBankOwner(String name, String playerName) { ++ + return new EconomyResponse(0, 0, ResponseType.FAILURE, "Banks not supported by InTime2!"); ++ + } ++ + ++ + @Override ++ + public EconomyResponse isBankMember(String name, String playerName) { ++ + return new EconomyResponse(0, 0, ResponseType.FAILURE, "Banks not supported by InTime2!"); ++ + } ++ + ++ + @Override ++ + public EconomyResponse bankBalance(String name) { ++ + return new EconomyResponse(0, 0, ResponseType.FAILURE, "Banks not supported by InTime2!"); ++ + } ++ + ++ + @Override ++ + public List getBanks() { ++ + throw new UnsupportedOperationException("Banks not supported by InTime2!"); ++ + } ++ + ++ + @Override ++ + public boolean hasBankSupport() { ++ + return false; ++ + } ++ + ++ + @Override ++ + public boolean hasAccount(String playerName) { ++ + return true; // All players have an account ++ + } ++ + ++ + @Override ++ + public boolean createPlayerAccount(String playerName) { ++ + return true; // All players have an account ++ + } ++ + ++ + @Override ++ + public int fractionalDigits() { ++ + return -1; ++ + } ++ + ++ + @Override ++ + public boolean hasAccount(String playerName, String worldName) { ++ + return hasAccount(playerName); ++ + } ++ + ++ + @Override ++ + public double getBalance(String playerName, String world) { ++ + return getBalance(playerName); ++ + } ++ + ++ + @Override ++ + public boolean has(String playerName, String worldName, double amount) { ++ + return has(playerName, amount); ++ + } ++ + ++ + @Override ++ + public EconomyResponse withdrawPlayer(String playerName, String worldName, double amount) { ++ + return withdrawPlayer(playerName, amount); ++ + } ++ + ++ + @Override ++ + public EconomyResponse depositPlayer(String playerName, String worldName, double amount) { ++ + return depositPlayer(playerName, amount); ++ + } ++ + ++ + @Override ++ + public boolean createPlayerAccount(String playerName, String worldName) { ++ + return createPlayerAccount(playerName); ++ + } ++ +}