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 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
@ -196,4 +196,4 @@ public class ExamplePlugin extends JavaPlugin {
}
}
}
```
```

Binary file not shown.

Binary file not shown.

View File

@ -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

175
pom.xml
View File

@ -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>
@ -14,11 +14,11 @@
<version>1.1-R2</version>
</dependency>
<dependency>
<groupId>org.tyrannyofheaven.bukkit</groupId>
<artifactId>zPermissions</artifactId>
<version>0.9.5-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/zPermissions-0.9.5.jar</systemPath>
<groupId>org.tyrannyofheaven.bukkit</groupId>
<artifactId>zPermissions</artifactId>
<version>0.9.5-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/zPermissions-0.9.5.jar</systemPath>
</dependency>
<dependency>
<groupId>me.ic3d.eco</groupId>
@ -28,11 +28,11 @@
<systemPath>${project.basedir}/lib/3co.jar</systemPath>
</dependency>
<dependency>
<groupId>is.currency</groupId>
<artifactId>Currency</artifactId>
<version>0.3</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/CurrencyCore.jar</systemPath>
<groupId>is.currency</groupId>
<artifactId>Currency</artifactId>
<version>0.3</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/CurrencyCore.jar</systemPath>
</dependency>
<dependency>
<groupId>cosine.boseconomy.BOSEconomy</groupId>
@ -112,12 +112,12 @@
<systemPath>${project.basedir}/lib/mChat.jar</systemPath>
</dependency>
<dependency>
<groupId>in.mDev</groupId>
<artifactId>mChatSuite</artifactId>
<version>DEV</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/mChatSuite-DEV.jar</systemPath>
</dependency>
<groupId>in.mDev</groupId>
<artifactId>mChatSuite</artifactId>
<version>DEV</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/mChatSuite-DEV.jar</systemPath>
</dependency>
<dependency>
<groupId>me.mjolnir.mineconomy.MineConomy</groupId>
<artifactId>MineConomy</artifactId>
@ -146,53 +146,46 @@
<scope>system</scope>
<systemPath>${project.basedir}/lib/PermissionsBukkit-1.2.jar</systemPath>
</dependency>
<dependency>
<groupId>com.palmergames.bukkit.towny.Towny</groupId>
<artifactId>Towny</artifactId>
<version>0.77.1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/Towny.jar</systemPath>
</dependency>
<dependency>
<groupId>ru.tehkode</groupId>
<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>
<version>2.6.3</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/bpermissions2.jar</systemPath>
</dependency>
<dependency>
<groupId>com.dthielke.starburst</groupId>
<artifactId>Starburst</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/Starburst.jar</systemPath>
</dependency>
<dependency>
<groupId>com.nijikokun.register</groupId>
<artifactId>Register</artifactId>
<scope>system</scope>
<systemPath>${project.basedir}/lib/Register.jar</systemPath>
<version>1.5</version>
</dependency>
<dependency>
<groupId>me.greatman.Craftconomy</groupId>
<artifactId>Craftconomy</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/Craftconomy.jar</systemPath>
</dependency>
<dependency>
<groupId>com.palmergames.bukkit.towny.Towny</groupId>
<artifactId>Towny</artifactId>
<version>0.77.1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/Towny.jar</systemPath>
</dependency>
<dependency>
<groupId>ru.tehkode</groupId>
<artifactId>PermissionsEx</artifactId>
<version>1.18</version>
</dependency>
<dependency>
<groupId>de.bananaco.permissions.Permissions</groupId>
<artifactId>bPermissions2</artifactId>
<version>2.6.3</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/bpermissions2.jar</systemPath>
</dependency>
<dependency>
<groupId>com.dthielke.starburst</groupId>
<artifactId>Starburst</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/Starburst.jar</systemPath>
</dependency>
<dependency>
<groupId>com.nijikokun.register</groupId>
<artifactId>Register</artifactId>
<scope>system</scope>
<systemPath>${project.basedir}/lib/Register.jar</systemPath>
<version>1.5</version>
</dependency>
<dependency>
<groupId>me.greatman.Craftconomy</groupId>
<artifactId>Craftconomy</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/Craftconomy.jar</systemPath>
</dependency>
</dependencies>
<build>
<resources>
@ -238,26 +231,26 @@
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<id>install-javadocs</id>
<goals>
<goal>javadoc</goal>
</goals>
</execution>
<execution>
<id>install-javadocs</id>
<goals>
<goal>javadoc</goal>
</goals>
</execution>
</executions>
<configuration>
<outputDirectory>/var/www/javadoc</outputDirectory>
<reportOutputDirectory>/var/www/javadoc</reportOutputDirectory>
<destDir>vault</destDir>
<show>public</show>
<windowtitle>Vault</windowtitle>
<verbose>false</verbose>
<author>true</author>
<version>true</version>
<bottom>
<outputDirectory>/var/www/javadoc</outputDirectory>
<reportOutputDirectory>/var/www/javadoc</reportOutputDirectory>
<destDir>vault</destDir>
<show>public</show>
<windowtitle>Vault</windowtitle>
<verbose>false</verbose>
<author>true</author>
<version>true</version>
<bottom>
<![CDATA[<b>MilkBukkit, 2011</b>]]>
</bottom>
<excludePackageNames>net.milkbowl.vault.chat.*:net.milkbowl.vault.economy.*:net.milkbowl.vault.permission.*</excludePackageNames>
</bottom>
<excludePackageNames>net.milkbowl.vault.chat.*:net.milkbowl.vault.economy.*:net.milkbowl.vault.permission.*</excludePackageNames>
</configuration>
</plugin>
</plugins>
@ -283,14 +276,14 @@ iConomy 4,5,6 BOSEconomy 6/7, EssentialsEcon, 3Co, MultiConomy, MineConomy, Econ
<system>jenkins</system>
<url>http://ci.milkbowl.net/job/Vault/</url>
</ciManagement>
<repositories>
<repository>
<id>bukkit-repo</id>
<url>http://repo.bukkit.org/content/groups/public/</url>
</repository>
<repository>
<id>tehkode-repo</id>
<url>http://repo.tehkode.ru/repository/repo/</url>
</repository>
</repositories>
<repositories>
<repository>
<id>bukkit-repo</id>
<url>http://repo.bukkit.org/content/groups/public/</url>
</repository>
<repository>
<id>tehkode-repo</id>
<url>http://repo.tehkode.ru/repository/repo/</url>
</repository>
</repositories>
</project>

View File

@ -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