mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-11-23 10:35:15 +01:00
Add an external Vault dependency
This commit is contained in:
parent
e11bed92a3
commit
c86ffb623a
10
pom.xml
10
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>com.acrobot.chestshop</groupId>
|
<groupId>com.acrobot.chestshop</groupId>
|
||||||
<artifactId>chestshop</artifactId>
|
<artifactId>chestshop</artifactId>
|
||||||
<version>3.50</version>
|
<version>3.52</version>
|
||||||
<description>Chest-and-sign shop plugin for Bukkit</description>
|
<description>Chest-and-sign shop plugin for Bukkit</description>
|
||||||
|
|
||||||
<scm>
|
<scm>
|
||||||
@ -28,6 +28,10 @@
|
|||||||
<id>sk89q-repo</id>
|
<id>sk89q-repo</id>
|
||||||
<url>http://maven.sk89q.com/repo/</url>
|
<url>http://maven.sk89q.com/repo/</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>vault-repo</id>
|
||||||
|
<url>http://ci.herocraftonline.com/plugin/repository/everything</url>
|
||||||
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>local_repo</id>
|
<id>local_repo</id>
|
||||||
<url>file://${project.basedir}/repo/</url>
|
<url>file://${project.basedir}/repo/</url>
|
||||||
@ -47,8 +51,8 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.milkbowl.vault</groupId>
|
<groupId>net.milkbowl.vault</groupId>
|
||||||
<artifactId>vault</artifactId>
|
<artifactId>Vault</artifactId>
|
||||||
<version>1.2.24</version>
|
<version>1.2.25-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.iCo6</groupId>
|
<groupId>com.iCo6</groupId>
|
||||||
|
Binary file not shown.
@ -1 +0,0 @@
|
|||||||
b8e1aaf9e9414e3f2b4adee6d4305aa1
|
|
@ -1 +0,0 @@
|
|||||||
de57c0204dbaa90ea5b60b90088861b26191e1ef
|
|
@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<groupId>net.milkbowl.vault</groupId>
|
|
||||||
<artifactId>vault</artifactId>
|
|
||||||
<version>1.2.24</version>
|
|
||||||
<description>POM was created from install:install-file</description>
|
|
||||||
</project>
|
|
@ -1 +0,0 @@
|
|||||||
9866ba9d041ad083790a548d2f83158e
|
|
@ -1 +0,0 @@
|
|||||||
39304372447ce440dac7d8197fd5bf9b324b2ce8
|
|
@ -1,12 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<metadata>
|
|
||||||
<groupId>net.milkbowl.vault</groupId>
|
|
||||||
<artifactId>vault</artifactId>
|
|
||||||
<versioning>
|
|
||||||
<release>1.2.24</release>
|
|
||||||
<versions>
|
|
||||||
<version>1.2.24</version>
|
|
||||||
</versions>
|
|
||||||
<lastUpdated>20130308180430</lastUpdated>
|
|
||||||
</versioning>
|
|
||||||
</metadata>
|
|
@ -1 +0,0 @@
|
|||||||
d1cea699e9cae09d3e5f25cd2e09867e
|
|
@ -1 +0,0 @@
|
|||||||
ec52ab7e0c962ecbbbbd4b11ae0d334ce769d69c
|
|
@ -1,74 +0,0 @@
|
|||||||
package com.Acrobot.ChestShop.Economy;
|
|
||||||
|
|
||||||
import com.nijikokun.register.payment.forChestShop.Method;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Acrobot
|
|
||||||
*/
|
|
||||||
public class Register extends EconomyManager {
|
|
||||||
public Method method;
|
|
||||||
|
|
||||||
public Register(Method method) {
|
|
||||||
this.method = method;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean transactionCanFail() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasAccount(String player) {
|
|
||||||
return method.hasAccount(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean add(String player, double amount) {
|
|
||||||
return method.getAccount(player).add(amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean subtract(String player, double amount) {
|
|
||||||
return method.getAccount(player).subtract(amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasEnough(String player, double amount) {
|
|
||||||
return method.getAccount(player).hasEnough(amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
public double balance(String player) {
|
|
||||||
return method.getAccount(player).balance();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasBankSupport() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean bankExists(String bank) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean bankAdd(String bank, double amount) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean bankSubtract(String bank, double amount) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean bankHasEnough(String bank, double amount) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double bankBalance(String bank) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isBankOwner(String player, String bank) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isBankMember(String player, String bank) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String format(double amount) {
|
|
||||||
return method.format(amount);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,102 +0,0 @@
|
|||||||
package com.Acrobot.ChestShop.Economy;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Acrobot
|
|
||||||
*/
|
|
||||||
public class Vault extends EconomyManager {
|
|
||||||
private static net.milkbowl.vault.economy.Economy vaultPlugin;
|
|
||||||
|
|
||||||
public boolean transactionCanFail() {
|
|
||||||
return getPluginName().equals("Gringotts") || getPluginName().equals("GoldIsMoney") || getPluginName().equals("MultiCurrency");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasAccount(String player) {
|
|
||||||
return vaultPlugin.hasAccount(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean add(String player, double amount) {
|
|
||||||
return vaultPlugin.depositPlayer(player, amount).transactionSuccess();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean subtract(String player, double amount) {
|
|
||||||
return vaultPlugin.withdrawPlayer(player, amount).transactionSuccess();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasEnough(String player, double amount) {
|
|
||||||
return vaultPlugin.has(player, amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
public double balance(String player) {
|
|
||||||
return vaultPlugin.getBalance(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasBankSupport() {
|
|
||||||
return vaultPlugin.hasBankSupport() && !getPluginName().startsWith("iConomy");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean bankExists(String bank) {
|
|
||||||
bank = bank.toLowerCase();
|
|
||||||
List<String> banks = vaultPlugin.getBanks();
|
|
||||||
for (String entry : banks) {
|
|
||||||
if (bank.equals(entry.toLowerCase())) return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean bankAdd(String bank, double amount) {
|
|
||||||
return vaultPlugin.bankDeposit(bank, amount).transactionSuccess();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean bankSubtract(String bank, double amount) {
|
|
||||||
return vaultPlugin.bankWithdraw(bank, amount).transactionSuccess();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean bankHasEnough(String bank, double amount) {
|
|
||||||
return vaultPlugin.bankHas(bank, amount).transactionSuccess();
|
|
||||||
}
|
|
||||||
|
|
||||||
public double bankBalance(String bank) {
|
|
||||||
return vaultPlugin.bankBalance(bank).amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isBankOwner(String player, String bank) {
|
|
||||||
return vaultPlugin.isBankOwner(bank, player).transactionSuccess();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isBankMember(String player, String bank) {
|
|
||||||
return vaultPlugin.isBankMember(bank, player).transactionSuccess();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String format(double amount) {
|
|
||||||
return vaultPlugin.format(amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getPluginName() {
|
|
||||||
if (vaultPlugin == null) {
|
|
||||||
return "";
|
|
||||||
} else {
|
|
||||||
return vaultPlugin.getName();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Vault getVault() {
|
|
||||||
RegisteredServiceProvider<net.milkbowl.vault.economy.Economy> rsp = Bukkit.getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
|
|
||||||
|
|
||||||
if (rsp == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
vaultPlugin = rsp.getProvider();
|
|
||||||
|
|
||||||
if (vaultPlugin == null) {
|
|
||||||
return null;
|
|
||||||
} else {
|
|
||||||
return new Vault();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,7 @@
|
|||||||
|
package com.Acrobot.ChestShop.Listeners.Economy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Acrobot
|
||||||
|
*/
|
||||||
|
public class RegisterListener {
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
package com.Acrobot.ChestShop.Listeners.Economy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Acrobot
|
||||||
|
*/
|
||||||
|
public class VaultListener {
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user