mirror of
https://github.com/MiniDay/HamsterCurrency-Parent.git
synced 2025-08-23 04:35:30 +08:00
fix: 对于无注册存档的玩家现在会为其新建存档了
This commit is contained in:
@@ -5,7 +5,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group 'cn.hamster3'
|
group 'cn.hamster3'
|
||||||
version '2.2.4'
|
version '2.2.5'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
|
@@ -114,7 +114,7 @@ public class FileDataManager implements IDataManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PlayerData getPlayerData(UUID uuid) {
|
public PlayerData getPlayerData(UUID uuid) {
|
||||||
return playerData.get(uuid);
|
return playerData.computeIfAbsent(uuid, PlayerData::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -44,24 +44,24 @@ public class SQLDataManager implements IDataManager {
|
|||||||
Connection connection = datasource.getConnection();
|
Connection connection = datasource.getConnection();
|
||||||
Statement statement = connection.createStatement();
|
Statement statement = connection.createStatement();
|
||||||
statement.execute("CREATE TABLE IF NOT EXISTS " + database + ".hamster_currency_player_data(" +
|
statement.execute("CREATE TABLE IF NOT EXISTS " + database + ".hamster_currency_player_data(" +
|
||||||
"uuid VARCHAR(36) PRIMARY KEY," +
|
"uuid VARCHAR(36) PRIMARY KEY," +
|
||||||
"data TEXT" +
|
"data TEXT" +
|
||||||
") CHARACTER SET = utf8mb4;");
|
") CHARACTER SET = utf8mb4;");
|
||||||
statement.execute("CREATE TABLE IF NOT EXISTS " + database + ".hamster_currency_logs(" +
|
statement.execute("CREATE TABLE IF NOT EXISTS " + database + ".hamster_currency_logs(" +
|
||||||
"uuid VARCHAR(36) NOT NULL," +
|
"uuid VARCHAR(36) NOT NULL," +
|
||||||
"player_name VARCHAR(36) NOT NULL," +
|
"player_name VARCHAR(36) NOT NULL," +
|
||||||
"type VARCHAR(36) NOT NULL," +
|
"type VARCHAR(36) NOT NULL," +
|
||||||
"action VARCHAR(36) NOT NULL," +
|
"action VARCHAR(36) NOT NULL," +
|
||||||
"amount DOUBLE NOT NULL," +
|
"amount DOUBLE NOT NULL," +
|
||||||
"balance DOUBLE NOT NULL," +
|
"balance DOUBLE NOT NULL," +
|
||||||
"time DATETIME NOT NULL," +
|
"time DATETIME NOT NULL," +
|
||||||
"INDEX idx_uuid(uuid)," +
|
"INDEX idx_uuid(uuid)," +
|
||||||
"INDEX idx_name(player_name)" +
|
"INDEX idx_name(player_name)" +
|
||||||
") CHARACTER SET = utf8mb4;");
|
") CHARACTER SET = utf8mb4;");
|
||||||
statement.execute("CREATE TABLE IF NOT EXISTS " + database + ".hamster_currency_settings(" +
|
statement.execute("CREATE TABLE IF NOT EXISTS " + database + ".hamster_currency_settings(" +
|
||||||
"title VARCHAR(64) PRIMARY KEY," +
|
"title VARCHAR(64) PRIMARY KEY," +
|
||||||
"data TEXT" +
|
"data TEXT" +
|
||||||
") CHARACTER SET = utf8mb4;");
|
") CHARACTER SET = utf8mb4;");
|
||||||
|
|
||||||
statement.close();
|
statement.close();
|
||||||
connection.close();
|
connection.close();
|
||||||
@@ -313,7 +313,7 @@ public class SQLDataManager implements IDataManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PlayerData getPlayerData(UUID uuid) {
|
public PlayerData getPlayerData(UUID uuid) {
|
||||||
return playerData.get(uuid);
|
return playerData.computeIfAbsent(uuid, PlayerData::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Reference in New Issue
Block a user