Allow use choose the Economy provider

Former-commit-id: a66b2d6a2dd9666b95f059e8d6b1303c36a04c02 [formerly 4bdbd73e12322597a9a7f020dc728475c51dee9b]
Former-commit-id: aa97cd9d8a9e8a531e593106cb2ab604fdb9e053
This commit is contained in:
Ghost_chu committed 2019-06-28 19:40:30 +08:00
1 parent d713ef1e7f
commit cece117d59
5 files changed
+50 -2

No files matched your search

@@ -3,10 +3,12 @@ package org.maxgamer.quickshop.Economy;
import java.util.UUID;
import org.jetbrains.annotations.*;
import org.maxgamer.quickshop.QuickShop;
import org.maxgamer.quickshop.Util.Util;
public class Economy implements EconomyCore {
private EconomyCore core;
private QuickShop plugin = QuickShop.instance;
public Economy(EconomyCore core) {
this.core = core;
@@ -57,4 +59,8 @@ public class Economy implements EconomyCore {
public double getBalance(@NotNull UUID name) {
return core.getBalance(name);
}
public EconomyType getNowUsing() {
return EconomyType.fromID(plugin.getConfig().getInt("economy-type"));
}
}
@@ -0,0 +1,29 @@
package org.maxgamer.quickshop.Economy;
import org.jetbrains.annotations.*;
public enum EconomyType {
UNKNOWN(-1), VAULT(0), RESERVE(1);
private int id;
EconomyType(int id) {
this.id = id;
}
public static EconomyType fromID(int id) {
for (EconomyType type : EconomyType.values()) {
if (type.id == id) {
return type;
}
}
return UNKNOWN;
}
public static int toID(@NotNull EconomyType economyType) {
return economyType.id;
}
public int toID() {
return id;
}
}
@@ -738,6 +738,14 @@ public class QuickShop extends JavaPlugin {
saveConfig();
reloadConfig();
}
if (selectedVersion == 36) {
getConfig().set("economy-type", 0); // Close it for everyone
getConfig().set("config-version", 37);
selectedVersion = 37;
saveConfig();
reloadConfig();
}
}
/** Reloads QuickShops config */
@@ -16,7 +16,7 @@ public enum DisplayType {
return type;
}
}
return null;
return UNKNOWN;
}
public static int toID(@NotNull DisplayType displayType) {
+6 -1
View File
@@ -1,7 +1,7 @@
#Default config: https://github.com/Ghost-chu/QuickShop-Reremake/blob/master/src/main/resources/config.yml
#Do not touch if you not clear know about this
config-version: 36
config-version: 37
#Select the language you want to use, (e.g de), use only supported language codes from the list below.
#If you use a not exist/not support language, plugin will move to use en_US to keep everything working.
@@ -58,6 +58,11 @@ auto-report-errors: true
#false = Only use the OnlinePlayer list, true = A list of all players that have ever joined your server before.
include-offlineplayer-list: false
#What economy provider you want let QuickShop use?
#0=Vault
#1=Reserve
economy-type: 0
database:
mysql: false
host: localhost