mirror of
https://github.com/MilkBowl/Vault.git
synced 2024-11-30 14:33:30 +01:00
craftConomy 2.1 support - re-adds banks
This commit is contained in:
parent
c6ee3ef964
commit
a56e4808b9
12
README.md
12
README.md
@ -77,11 +77,11 @@ Github and we'll get to it at our convenience.
|
||||
- iConomy 5 (http://forums.bukkit.org/threads/40/)
|
||||
- iConomy 6 (http://forums.bukkit.org/threads/40/)
|
||||
- 3co (http://forums.bukkit.org/threads/22461/)
|
||||
- CurrencyCore
|
||||
- CraftConomy
|
||||
- MineConomy
|
||||
- EconXP
|
||||
- eWallet
|
||||
- CurrencyCore (http://dev.bukkit.org/server-mods/currency/)
|
||||
- CraftConomy (http://dev.bukkit.org/server-mods/craftconomy/)
|
||||
- MineConomy (http://dev.bukkit.org/server-mods/mineconomy/)
|
||||
- EconXP (http://dev.bukkit.org/server-mods/econxp/)
|
||||
- eWallet (http://dev.bukkit.org/server-mods/ewallet/)
|
||||
- MuliCurrency
|
||||
- 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 3 (http://forums.bukkit.org/threads/18430/)
|
||||
- bPermissions
|
||||
- bPermissions 2
|
||||
- bPermissions 2 (http://dev.bukkit.org/server-mods/bpermissions/)
|
||||
- PermissionsBukkit
|
||||
- zPermissions
|
||||
- SuperPerms
|
||||
|
Binary file not shown.
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
name: Vault
|
||||
main: net.milkbowl.vault.Vault
|
||||
version: 1.2.8-b${BUILD_NUMBER}
|
||||
version: 1.2.9-b${BUILD_NUMBER}
|
||||
authors: [cereal, Sleaker, mung3r]
|
||||
website: http://dev.bukkit.org/server-mods/vault
|
||||
load: startup
|
||||
|
9
pom.xml
9
pom.xml
@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>net.milkbowl.vault</groupId>
|
||||
<artifactId>Vault</artifactId>
|
||||
<version>1.2.8-SNAPSHOT</version>
|
||||
<version>1.2.9-SNAPSHOT</version>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
@ -158,13 +158,6 @@
|
||||
<artifactId>PermissionsEx</artifactId>
|
||||
<version>1.18</version>
|
||||
</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>
|
||||
<groupId>de.bananaco.permissions.Permissions</groupId>
|
||||
<artifactId>bPermissions2</artifactId>
|
||||
|
@ -1,10 +1,13 @@
|
||||
package net.milkbowl.vault.economy.plugins;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import me.greatman.Craftconomy.Account;
|
||||
import me.greatman.Craftconomy.AccountHandler;
|
||||
import me.greatman.Craftconomy.Bank;
|
||||
import me.greatman.Craftconomy.BankHandler;
|
||||
import me.greatman.Craftconomy.Craftconomy;
|
||||
import me.greatman.Craftconomy.CurrencyHandler;
|
||||
import me.greatman.Craftconomy.utils.Config;
|
||||
@ -126,52 +129,120 @@ public class Economy_Craftconomy implements Economy {
|
||||
|
||||
@Override
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
public List<String> getBanks() {
|
||||
throw new UnsupportedOperationException("Craftconomy does not support listing of bank accounts");
|
||||
return BankHandler.listBanks();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasBankSupport() {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user