craftConomy 2.1 support - re-adds banks

This commit is contained in:
Sleaker 2012-02-08 21:53:10 -08:00
parent c6ee3ef964
commit a56e4808b9
6 changed files with 173 additions and 109 deletions

View File

@ -77,11 +77,11 @@ Github and we'll get to it at our convenience.
- iConomy 5 (http://forums.bukkit.org/threads/40/) - iConomy 5 (http://forums.bukkit.org/threads/40/)
- iConomy 6 (http://forums.bukkit.org/threads/40/) - iConomy 6 (http://forums.bukkit.org/threads/40/)
- 3co (http://forums.bukkit.org/threads/22461/) - 3co (http://forums.bukkit.org/threads/22461/)
- CurrencyCore - CurrencyCore (http://dev.bukkit.org/server-mods/currency/)
- CraftConomy - CraftConomy (http://dev.bukkit.org/server-mods/craftconomy/)
- MineConomy - MineConomy (http://dev.bukkit.org/server-mods/mineconomy/)
- EconXP - EconXP (http://dev.bukkit.org/server-mods/econxp/)
- eWallet - eWallet (http://dev.bukkit.org/server-mods/ewallet/)
- MuliCurrency - MuliCurrency
- Essentials Economy (http://forums.bukkit.org/threads/15312/) - Essentials Economy (http://forums.bukkit.org/threads/15312/)
@ -89,7 +89,7 @@ Github and we'll get to it at our convenience.
- Permissions Ex (http://forums.bukkit.org/threads/18140/) - Permissions Ex (http://forums.bukkit.org/threads/18140/)
- Permissions 3 (http://forums.bukkit.org/threads/18430/) - Permissions 3 (http://forums.bukkit.org/threads/18430/)
- bPermissions - bPermissions
- bPermissions 2 - bPermissions 2 (http://dev.bukkit.org/server-mods/bpermissions/)
- PermissionsBukkit - PermissionsBukkit
- zPermissions - zPermissions
- SuperPerms - SuperPerms

Binary file not shown.

Binary file not shown.

View File

@ -1,6 +1,6 @@
name: Vault name: Vault
main: net.milkbowl.vault.Vault main: net.milkbowl.vault.Vault
version: 1.2.8-b${BUILD_NUMBER} version: 1.2.9-b${BUILD_NUMBER}
authors: [cereal, Sleaker, mung3r] authors: [cereal, Sleaker, mung3r]
website: http://dev.bukkit.org/server-mods/vault website: http://dev.bukkit.org/server-mods/vault
load: startup load: startup

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>net.milkbowl.vault</groupId> <groupId>net.milkbowl.vault</groupId>
<artifactId>Vault</artifactId> <artifactId>Vault</artifactId>
<version>1.2.8-SNAPSHOT</version> <version>1.2.9-SNAPSHOT</version>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
@ -158,13 +158,6 @@
<artifactId>PermissionsEx</artifactId> <artifactId>PermissionsEx</artifactId>
<version>1.18</version> <version>1.18</version>
</dependency> </dependency>
<dependency>
<groupId>com.herocraftonline.HeroTitles</groupId>
<artifactId>HeroTitles</artifactId>
<scope>system</scope>
<version>0.0.1</version>
<systemPath>${project.basedir}/lib/HeroTitles.jar</systemPath>
</dependency>
<dependency> <dependency>
<groupId>de.bananaco.permissions.Permissions</groupId> <groupId>de.bananaco.permissions.Permissions</groupId>
<artifactId>bPermissions2</artifactId> <artifactId>bPermissions2</artifactId>

View File

@ -1,10 +1,13 @@
package net.milkbowl.vault.economy.plugins; package net.milkbowl.vault.economy.plugins;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.logging.Logger; import java.util.logging.Logger;
import me.greatman.Craftconomy.Account; import me.greatman.Craftconomy.Account;
import me.greatman.Craftconomy.AccountHandler; import me.greatman.Craftconomy.AccountHandler;
import me.greatman.Craftconomy.Bank;
import me.greatman.Craftconomy.BankHandler;
import me.greatman.Craftconomy.Craftconomy; import me.greatman.Craftconomy.Craftconomy;
import me.greatman.Craftconomy.CurrencyHandler; import me.greatman.Craftconomy.CurrencyHandler;
import me.greatman.Craftconomy.utils.Config; import me.greatman.Craftconomy.utils.Config;
@ -126,52 +129,120 @@ public class Economy_Craftconomy implements Economy {
@Override @Override
public EconomyResponse createBank(String name, String player) { public EconomyResponse createBank(String name, String player) {
return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "Craftconomy does not support Banks."); boolean success = BankHandler.create(name, player);
if (success) {
return new EconomyResponse(0, 0, ResponseType.SUCCESS, "");
}
return new EconomyResponse(0, 0, ResponseType.FAILURE, "Unable to create that bank account.");
} }
@Override @Override
public EconomyResponse deleteBank(String name) { public EconomyResponse deleteBank(String name) {
return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "Craftconomy does not support Banks."); boolean success = BankHandler.delete(name);
if (success) {
return new EconomyResponse(0, 0, ResponseType.SUCCESS, "");
}
return new EconomyResponse(0, 0, ResponseType.FAILURE, "Unable to create that bank account.");
} }
@Override @Override
public EconomyResponse bankHas(String name, double amount) { public EconomyResponse bankHas(String name, double amount) {
return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "Craftconomy does not support Banks.");
if (BankHandler.exists(name))
{
Bank bank = BankHandler.getBank(name);
if (bank.hasEnough(amount))
return new EconomyResponse(0, 0, ResponseType.SUCCESS, "");
else
return new EconomyResponse(0, bank.getDefaultBalance(), ResponseType.FAILURE, "The bank does not have enough money!");
}
return new EconomyResponse(0, 0, ResponseType.FAILURE, "That bank does not exist!");
} }
@Override @Override
public EconomyResponse bankWithdraw(String name, double amount) { public EconomyResponse bankWithdraw(String name, double amount) {
return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "Craftconomy does not support Banks."); EconomyResponse er = bankHas(name, amount);
if (!er.transactionSuccess())
return er;
else
{
if (BankHandler.exists(name))
{
Bank bank = BankHandler.getBank(name);
double balance = bank.substractMoney(amount);
return new EconomyResponse(0, balance, ResponseType.SUCCESS, "");
}
return new EconomyResponse(0, 0, ResponseType.FAILURE, "That bank does not exist!");
}
} }
@Override @Override
public EconomyResponse bankDeposit(String name, double amount) { public EconomyResponse bankDeposit(String name, double amount) {
return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "Craftconomy does not support Banks."); if (BankHandler.exists(name))
{
Bank bank = BankHandler.getBank(name);
double balance = bank.addMoney(amount);
return new EconomyResponse(0, balance, ResponseType.SUCCESS, "");
}
return new EconomyResponse(0, 0, ResponseType.FAILURE, "That bank does not exist!");
} }
@Override @Override
public EconomyResponse isBankOwner(String name, String playerName) { public EconomyResponse isBankOwner(String name, String playerName) {
return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "Craftconomy does not support Banks."); if (BankHandler.exists(name))
{
Bank bank = BankHandler.getBank(name);
if (bank.getOwner().equals(playerName))
{
return new EconomyResponse(0, bank.getDefaultBalance(), ResponseType.SUCCESS, "");
}
return new EconomyResponse(0, 0, ResponseType.FAILURE, "This player is not the owner of the bank!");
}
return new EconomyResponse(0, 0, ResponseType.FAILURE, "That bank does not exist!");
} }
@Override @Override
public EconomyResponse isBankMember(String name, String playerName) { public EconomyResponse isBankMember(String name, String playerName) {
return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "Craftconomy does not support Banks."); EconomyResponse er = isBankOwner(name,playerName);
if (er.transactionSuccess())
return er;
else
{
if (BankHandler.exists(name))
{
Bank bank = BankHandler.getBank(name);
Iterator<String> iterator = bank.getMembers().iterator();
while(iterator.hasNext())
{
if (iterator.next().equals(playerName))
return new EconomyResponse(0,bank.getDefaultBalance(), ResponseType.SUCCESS, "");
}
}
return new EconomyResponse(0, 0, ResponseType.FAILURE, "This player is not a member of the bank!");
}
} }
@Override @Override
public EconomyResponse bankBalance(String name) { public EconomyResponse bankBalance(String name) {
return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "Craftconomy does not support Banks."); if (BankHandler.exists(name))
{
return new EconomyResponse(0, BankHandler.getBank(name).getDefaultBalance(), ResponseType.SUCCESS, "");
}
return new EconomyResponse(0, 0, ResponseType.FAILURE, "That bank does not exist!");
} }
@Override @Override
public List<String> getBanks() { public List<String> getBanks() {
throw new UnsupportedOperationException("Craftconomy does not support listing of bank accounts"); return BankHandler.listBanks();
} }
@Override @Override
public boolean hasBankSupport() { public boolean hasBankSupport() {
return false; return true;
} }
@Override @Override