mirror of
https://github.com/MiniDay/HamsterCurrency-Parent.git
synced 2025-08-22 20:25:30 +08:00
Compare commits
3 Commits
2.0.7-SNAP
...
2.0.8-SNAP
Author | SHA1 | Date | |
---|---|---|---|
870a3789f2 | |||
eff200634d | |||
59f1e02a6c |
@@ -0,0 +1,3 @@
|
|||||||
|
plugins {
|
||||||
|
id 'java'
|
||||||
|
}
|
||||||
|
@@ -3,7 +3,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group 'cn.hamster3'
|
group 'cn.hamster3'
|
||||||
version '2.0.7-SNAPSHOT'
|
version '2.0.8-SNAPSHOT'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
@@ -19,7 +19,7 @@ dependencies {
|
|||||||
// https://mvnrepository.com/artifact/org.jetbrains/annotations
|
// https://mvnrepository.com/artifact/org.jetbrains/annotations
|
||||||
compileOnly group: 'org.jetbrains', name: 'annotations', version: '22.0.0'
|
compileOnly group: 'org.jetbrains', name: 'annotations', version: '22.0.0'
|
||||||
compileOnly "cn.hamster3:HamsterService-Bukkit:2.6.2-SNAPSHOT"
|
compileOnly "cn.hamster3:HamsterService-Bukkit:2.6.2-SNAPSHOT"
|
||||||
compileOnly "cn.hamster3:HamsterAPI:2.4.0-SNAPSHOT"
|
compileOnly "cn.hamster3:HamsterAPI:2.4.3-SNAPSHOT"
|
||||||
compileOnly "com.github.MilkBowl:VaultAPI:1.7"
|
compileOnly "com.github.MilkBowl:VaultAPI:1.7"
|
||||||
compileOnly "org.black_ixx:PlayerPoints:2.1.3"
|
compileOnly "org.black_ixx:PlayerPoints:2.1.3"
|
||||||
compileOnly "me.clip:placeholderapi:2.10.9"
|
compileOnly "me.clip:placeholderapi:2.10.9"
|
||||||
|
@@ -2,6 +2,7 @@ package cn.hamster3.currency.command;
|
|||||||
|
|
||||||
import cn.hamster3.api.command.CommandExecutor;
|
import cn.hamster3.api.command.CommandExecutor;
|
||||||
import cn.hamster3.currency.core.IDataManager;
|
import cn.hamster3.currency.core.IDataManager;
|
||||||
|
import cn.hamster3.currency.core.Message;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
@@ -11,7 +12,7 @@ public class ReloadCommand extends CommandExecutor {
|
|||||||
private final IDataManager dataManager;
|
private final IDataManager dataManager;
|
||||||
|
|
||||||
public ReloadCommand(IDataManager dataManager) {
|
public ReloadCommand(IDataManager dataManager) {
|
||||||
super("reload", "重载服务器");
|
super("reload", "重载服务器", "currency.reload");
|
||||||
this.dataManager = dataManager;
|
this.dataManager = dataManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -20,6 +21,11 @@ public class ReloadCommand extends CommandExecutor {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPermissionMessage() {
|
||||||
|
return Message.notHasPermission.toString();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
dataManager.reloadConfig();
|
dataManager.reloadConfig();
|
||||||
|
@@ -28,7 +28,6 @@ public class SQLDataManager implements IDataManager {
|
|||||||
private final HashSet<PlayerData> playerData;
|
private final HashSet<PlayerData> playerData;
|
||||||
private final HashSet<CurrencyType> currencyTypes;
|
private final HashSet<CurrencyType> currencyTypes;
|
||||||
|
|
||||||
@SuppressWarnings("ConstantConditions")
|
|
||||||
public SQLDataManager(HamsterCurrency plugin) throws SQLException, ClassNotFoundException {
|
public SQLDataManager(HamsterCurrency plugin) throws SQLException, ClassNotFoundException {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
parser = new JsonParser();
|
parser = new JsonParser();
|
||||||
@@ -40,11 +39,11 @@ public class SQLDataManager implements IDataManager {
|
|||||||
statement.execute("CREATE TABLE IF NOT EXISTS hamster_currency_player_data(" +
|
statement.execute("CREATE TABLE IF NOT EXISTS hamster_currency_player_data(" +
|
||||||
"uuid VARCHAR(36) PRIMARY KEY," +
|
"uuid VARCHAR(36) PRIMARY KEY," +
|
||||||
"data TEXT" +
|
"data TEXT" +
|
||||||
");");
|
") CHARACTER SET = utf8mb4;");
|
||||||
statement.execute("CREATE TABLE IF NOT EXISTS hamster_currency_settings(" +
|
statement.execute("CREATE TABLE IF NOT EXISTS hamster_currency_settings(" +
|
||||||
"title VARCHAR(64) PRIMARY KEY," +
|
"title VARCHAR(64) PRIMARY KEY," +
|
||||||
"data TEXT" +
|
"data TEXT" +
|
||||||
");");
|
") CHARACTER SET = utf8mb4;");
|
||||||
|
|
||||||
statement.close();
|
statement.close();
|
||||||
}
|
}
|
||||||
@@ -69,7 +68,7 @@ public class SQLDataManager implements IDataManager {
|
|||||||
getLogUtils().error(e, "插件上传 pluginConfig 至数据库时遇到了一个异常: ");
|
getLogUtils().error(e, "插件上传 pluginConfig 至数据库时遇到了一个异常: ");
|
||||||
}
|
}
|
||||||
loadConfig(config);
|
loadConfig(config);
|
||||||
ServiceMessageAPI.sendMessage("HamsterCurrency", "uploadConfigToSQL");
|
ServiceMessageAPI.sendServiceMessage("HamsterCurrency", "uploadConfigToSQL");
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("SwitchStatementWithTooFewBranches")
|
@SuppressWarnings("SwitchStatementWithTooFewBranches")
|
||||||
@@ -100,7 +99,6 @@ public class SQLDataManager implements IDataManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("ConstantConditions")
|
|
||||||
private void loadConfig(FileConfiguration config) {
|
private void loadConfig(FileConfiguration config) {
|
||||||
getLogUtils().info("加载配置文件...");
|
getLogUtils().info("加载配置文件...");
|
||||||
currencyTypes.clear();
|
currencyTypes.clear();
|
||||||
@@ -154,7 +152,7 @@ public class SQLDataManager implements IDataManager {
|
|||||||
data.saveToJson().toString()
|
data.saveToJson().toString()
|
||||||
));
|
));
|
||||||
getLogUtils().info("已保存玩家 %s 的存档数据.", data.getUuid());
|
getLogUtils().info("已保存玩家 %s 的存档数据.", data.getUuid());
|
||||||
ServiceMessageAPI.sendMessage("HamsterCurrency", "savedPlayerData", data.getUuid().toString());
|
ServiceMessageAPI.sendServiceMessage("HamsterCurrency", "savedPlayerData", data.getUuid().toString());
|
||||||
}
|
}
|
||||||
statement.close();
|
statement.close();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
@@ -207,7 +205,7 @@ public class SQLDataManager implements IDataManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reloadConfig() {
|
public void reloadConfig() {
|
||||||
ServiceMessageAPI.sendMessage("HamsterCurrency", "reload");
|
ServiceMessageAPI.sendServiceMessage("HamsterCurrency", "reload");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -260,7 +258,7 @@ public class SQLDataManager implements IDataManager {
|
|||||||
getLogUtils().error(e, "保存玩家 %s 的存档数据时出错!", data.getUuid());
|
getLogUtils().error(e, "保存玩家 %s 的存档数据时出错!", data.getUuid());
|
||||||
}
|
}
|
||||||
getLogUtils().info("已保存玩家 %s 的存档数据.", data.getUuid());
|
getLogUtils().info("已保存玩家 %s 的存档数据.", data.getUuid());
|
||||||
ServiceMessageAPI.sendMessage(
|
ServiceMessageAPI.sendServiceMessage(
|
||||||
"HamsterCurrency",
|
"HamsterCurrency",
|
||||||
"savedPlayerData",
|
"savedPlayerData",
|
||||||
data.getUuid().toString()
|
data.getUuid().toString()
|
||||||
|
@@ -38,6 +38,8 @@ permissions:
|
|||||||
default: op
|
default: op
|
||||||
currency.set:
|
currency.set:
|
||||||
default: op
|
default: op
|
||||||
|
currency.reload:
|
||||||
|
default: op
|
||||||
currency.look:
|
currency.look:
|
||||||
default: true
|
default: true
|
||||||
currency.look.other:
|
currency.look.other:
|
||||||
|
@@ -12,7 +12,6 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
|
|
||||||
implementationShade
|
implementationShade
|
||||||
implementation.extendsFrom implementationShade
|
implementation.extendsFrom implementationShade
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user