mirror of
https://github.com/MilkBowl/Vault.git
synced 2024-12-29 04:18:08 +01:00
Merge pull request #301 from iKeirNez/master
Updated Vault API for CommandsEX
This commit is contained in:
commit
16618d1f0c
@ -82,6 +82,7 @@ Github and we'll get to it at our convenience.
|
|||||||
- eWallet (http://dev.bukkit.org/server-mods/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/)
|
||||||
|
- CommandsEX Economy (http://dev.bukkit.org/server-mods/commandsex/)
|
||||||
- McMoney
|
- McMoney
|
||||||
- AEco
|
- AEco
|
||||||
- MultiCurrency
|
- MultiCurrency
|
||||||
|
Binary file not shown.
@ -13,13 +13,12 @@ import org.bukkit.event.server.PluginEnableEvent;
|
|||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
import com.github.zathrus_writer.commandsex.CommandsEX;
|
import com.github.zathrus_writer.commandsex.CommandsEX;
|
||||||
import com.github.zathrus_writer.commandsex.api.EconomyAPI;
|
import com.github.zathrus_writer.commandsex.api.economy.Economy;
|
||||||
|
|
||||||
import net.milkbowl.vault.economy.Economy;
|
|
||||||
import net.milkbowl.vault.economy.EconomyResponse;
|
import net.milkbowl.vault.economy.EconomyResponse;
|
||||||
import net.milkbowl.vault.economy.EconomyResponse.ResponseType;
|
import net.milkbowl.vault.economy.EconomyResponse.ResponseType;
|
||||||
|
|
||||||
public class Economy_CommandsEX implements Economy {
|
public class Economy_CommandsEX implements net.milkbowl.vault.economy.Economy {
|
||||||
private static final Logger log = Logger.getLogger("Minecraft");
|
private static final Logger log = Logger.getLogger("Minecraft");
|
||||||
|
|
||||||
private final String name = "CommandsEX Economy";
|
private final String name = "CommandsEX Economy";
|
||||||
@ -75,7 +74,7 @@ public class Economy_CommandsEX implements Economy {
|
|||||||
if (economy == null){
|
if (economy == null){
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return EconomyAPI.isEnabled();
|
return Economy.isEnabled();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,32 +95,32 @@ public class Economy_CommandsEX implements Economy {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String format(double amount) {
|
public String format(double amount) {
|
||||||
return EconomyAPI.getCurrencySymbol() + amount;
|
return Economy.getCurrencySymbol() + amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String currencyNamePlural() {
|
public String currencyNamePlural() {
|
||||||
return EconomyAPI.getCurrencyPlural();
|
return Economy.getCurrencyPlural();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String currencyNameSingular() {
|
public String currencyNameSingular() {
|
||||||
return EconomyAPI.getCurrencySingular();
|
return Economy.getCurrencySingular();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasAccount(String playerName) {
|
public boolean hasAccount(String playerName) {
|
||||||
return EconomyAPI.hasAccount(playerName);
|
return Economy.hasAccount(playerName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getBalance(String playerName) {
|
public double getBalance(String playerName) {
|
||||||
return EconomyAPI.getBalance(playerName);
|
return Economy.getBalance(playerName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean has(String playerName, double amount) {
|
public boolean has(String playerName, double amount) {
|
||||||
return EconomyAPI.has(playerName, amount);
|
return Economy.has(playerName, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -129,8 +128,8 @@ public class Economy_CommandsEX implements Economy {
|
|||||||
ResponseType rt;
|
ResponseType rt;
|
||||||
String message;
|
String message;
|
||||||
|
|
||||||
if (EconomyAPI.has(playerName, amount)){
|
if (Economy.has(playerName, amount)){
|
||||||
EconomyAPI.withdraw(playerName, amount);
|
Economy.withdraw(playerName, amount);
|
||||||
rt = ResponseType.SUCCESS;
|
rt = ResponseType.SUCCESS;
|
||||||
message = null;
|
message = null;
|
||||||
} else {
|
} else {
|
||||||
@ -138,13 +137,13 @@ public class Economy_CommandsEX implements Economy {
|
|||||||
message = "Not enough money";
|
message = "Not enough money";
|
||||||
}
|
}
|
||||||
|
|
||||||
return new EconomyResponse(amount, EconomyAPI.getBalance(playerName), rt, message);
|
return new EconomyResponse(amount, Economy.getBalance(playerName), rt, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EconomyResponse depositPlayer(String playerName, double amount) {
|
public EconomyResponse depositPlayer(String playerName, double amount) {
|
||||||
EconomyAPI.deposit(playerName, amount);
|
Economy.deposit(playerName, amount);
|
||||||
return new EconomyResponse(amount, EconomyAPI.getBalance(playerName), ResponseType.SUCCESS, "Successfully deposited");
|
return new EconomyResponse(amount, Economy.getBalance(playerName), ResponseType.SUCCESS, "Successfully deposited");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -194,10 +193,10 @@ public class Economy_CommandsEX implements Economy {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean createPlayerAccount(String playerName) {
|
public boolean createPlayerAccount(String playerName) {
|
||||||
if (EconomyAPI.hasAccount(playerName)){
|
if (Economy.hasAccount(playerName)){
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
EconomyAPI.createAccount(playerName);
|
Economy.createAccount(playerName);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user