Update Economy_InTime2.java

Remove all '+ +' annotations
This commit is contained in:
boozaa 2014-01-18 13:09:08 +01:00
parent 114c24c64e
commit e49f3c2f12

View File

@ -13,202 +13,202 @@
+ + You should have received a copy of the GNU Lesser General Public License
+ + along with Vault. If not, see <http://www.gnu.org/licenses/>.
+ + */
+ +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<String> 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);
+ + }
+ +}
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<String> 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);
}
}