Updated Craftconomy hook to latest API changes. Made the pom.xml downloads from the repository.

This commit is contained in:
William Lebel 2013-02-05 14:22:40 -05:00
parent a0e3e42d7d
commit 79bbee126d
2 changed files with 16 additions and 14 deletions

12
pom.xml
View File

@ -231,11 +231,9 @@
<systemPath>${project.basedir}/lib/Craftconomy.jar</systemPath> <systemPath>${project.basedir}/lib/Craftconomy.jar</systemPath>
</dependency> </dependency>
<dependency> <dependency>
<groupId>me.greatmancode</groupId> <groupId>com.greatmancode</groupId>
<artifactId>craftconomy3</artifactId> <artifactId>craftconomy3</artifactId>
<version>3.0.0</version> <version>3.1.0-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/craftconomy3.jar</systemPath>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.crystalyx.bukkit.simplyperms</groupId> <groupId>net.crystalyx.bukkit.simplyperms</groupId>
@ -371,9 +369,13 @@ iConomy 4,5,6 BOSEconomy 6/7, EssentialsEcon, 3Co, MultiConomy, MineConomy, Econ
<id>bukkit-repo</id> <id>bukkit-repo</id>
<url>http://repo.bukkit.org/content/groups/public/</url> <url>http://repo.bukkit.org/content/groups/public/</url>
</repository> </repository>
<repository> <repository>
<id>sdfeconomy-repo</id> <id>sdfeconomy-repo</id>
<url>http://omwah.sdf.org/maven/repo/snapshots/</url> <url>http://omwah.sdf.org/maven/repo/snapshots/</url>
</repository> </repository>
<repository>
<id>greatman-repo</id>
<url>http://repo.greatmancode.com/content/groups/public/</url>
</repository>
</repositories> </repositories>
</project> </project>

View File

@ -105,22 +105,22 @@ public class Economy_Craftconomy3 implements Economy {
@Override @Override
public String format(double amount) { public String format(double amount) {
return Common.getInstance().format(null, Common.getInstance().getCurrencyManager().getCurrency(CurrencyManager.defaultCurrencyID), amount); return Common.getInstance().format(null, Common.getInstance().getCurrencyManager().getDefaultCurrency(), amount);
} }
@Override @Override
public String currencyNameSingular() { public String currencyNameSingular() {
return Common.getInstance().getCurrencyManager().getCurrency(CurrencyManager.defaultCurrencyID).getName(); return Common.getInstance().getCurrencyManager().getDefaultCurrency().getName();
} }
@Override @Override
public String currencyNamePlural() { public String currencyNamePlural() {
return Common.getInstance().getCurrencyManager().getCurrency(CurrencyManager.defaultCurrencyID).getPlural(); return Common.getInstance().getCurrencyManager().getDefaultCurrency().getPlural();
} }
@Override @Override
public double getBalance(String playerName) { public double getBalance(String playerName) {
return Common.getInstance().getAccountManager().getAccount(playerName).getBalance(Common.getInstance().getServerCaller().getDefaultWorld(), Common.getInstance().getCurrencyManager().getCurrency(CurrencyManager.defaultCurrencyID).getName()); return Common.getInstance().getAccountManager().getAccount(playerName).getBalance(Common.getInstance().getServerCaller().getDefaultWorld(), Common.getInstance().getCurrencyManager().getDefaultCurrency().getName());
} }
@Override @Override
@ -131,8 +131,8 @@ public class Economy_Craftconomy3 implements Economy {
double balance; double balance;
Account account = Common.getInstance().getAccountManager().getAccount(playerName); Account account = Common.getInstance().getAccountManager().getAccount(playerName);
if (account.hasEnough(amount, Common.getInstance().getServerCaller().getDefaultWorld(), Common.getInstance().getCurrencyManager().getCurrency(CurrencyManager.defaultCurrencyID).getName())) { if (account.hasEnough(amount, Common.getInstance().getServerCaller().getDefaultWorld(), Common.getInstance().getCurrencyManager().getDefaultCurrency().getName())) {
balance = account.withdraw(amount, Common.getInstance().getServerCaller().getDefaultWorld(), Common.getInstance().getCurrencyManager().getCurrency(CurrencyManager.defaultCurrencyID).getName()); balance = account.withdraw(amount, Common.getInstance().getServerCaller().getDefaultWorld(), Common.getInstance().getCurrencyManager().getDefaultCurrency().getName());
return new EconomyResponse(amount, balance, ResponseType.SUCCESS, ""); return new EconomyResponse(amount, balance, ResponseType.SUCCESS, "");
} else { } else {
return new EconomyResponse(0, getBalance(playerName), ResponseType.FAILURE, "Insufficient funds"); return new EconomyResponse(0, getBalance(playerName), ResponseType.FAILURE, "Insufficient funds");
@ -147,7 +147,7 @@ public class Economy_Craftconomy3 implements Economy {
Account account = Common.getInstance().getAccountManager().getAccount(playerName); Account account = Common.getInstance().getAccountManager().getAccount(playerName);
double balance = account.deposit(amount, Common.getInstance().getServerCaller().getDefaultWorld(), Common.getInstance().getCurrencyManager().getCurrency(CurrencyManager.defaultCurrencyID).getName()); double balance = account.deposit(amount, Common.getInstance().getServerCaller().getDefaultWorld(), Common.getInstance().getCurrencyManager().getDefaultCurrency().getName());
return new EconomyResponse(amount, balance, ResponseType.SUCCESS, null); return new EconomyResponse(amount, balance, ResponseType.SUCCESS, null);
} }
@ -185,7 +185,7 @@ public class Economy_Craftconomy3 implements Economy {
if (Common.getInstance().getAccountManager().exist(Account.BANK_PREFIX + name)) { if (Common.getInstance().getAccountManager().exist(Account.BANK_PREFIX + name)) {
Account account = Common.getInstance().getAccountManager().getAccount(Account.BANK_PREFIX + name); Account account = Common.getInstance().getAccountManager().getAccount(Account.BANK_PREFIX + name);
if (account.hasEnough(amount, Common.getInstance().getServerCaller().getDefaultWorld(), Common.getInstance().getCurrencyManager().getCurrency(CurrencyManager.defaultCurrencyID).getName())) { if (account.hasEnough(amount, Common.getInstance().getServerCaller().getDefaultWorld(), Common.getInstance().getCurrencyManager().getDefaultCurrency().getName())) {
return new EconomyResponse(0, bankBalance(Account.BANK_PREFIX + name).balance, ResponseType.SUCCESS, ""); return new EconomyResponse(0, bankBalance(Account.BANK_PREFIX + name).balance, ResponseType.SUCCESS, "");
} else { } else {
return new EconomyResponse(0, bankBalance(Account.BANK_PREFIX + name).balance, ResponseType.FAILURE, "The bank does not have enough money!"); return new EconomyResponse(0, bankBalance(Account.BANK_PREFIX + name).balance, ResponseType.FAILURE, "The bank does not have enough money!");
@ -267,7 +267,7 @@ public class Economy_Craftconomy3 implements Economy {
ArrayList<String> list = new ArrayList<String>(); ArrayList<String> list = new ArrayList<String>();
Iterator<AccountTable> iterator = accountList.iterator(); Iterator<AccountTable> iterator = accountList.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
list.add(iterator.next().name.replaceFirst(Account.BANK_PREFIX, "")); list.add(iterator.next().getName().replaceFirst(Account.BANK_PREFIX, ""));
} }
return list; return list;