mirror of
https://github.com/MilkBowl/Vault.git
synced 2024-11-30 06:23:29 +01:00
Update for CommandsEX API changes
This commit is contained in:
parent
86bd5746fd
commit
ff988e6d4a
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