mirror of
https://github.com/MiniDay/HamsterCurrency-Parent.git
synced 2025-08-23 04:35:30 +08:00
Compare commits
2 Commits
2.0.6-SNAP
...
2.0.7-SNAP
Author | SHA1 | Date | |
---|---|---|---|
e6d95e0ba9 | |||
ca220775b6 |
@@ -33,7 +33,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.hamster3</groupId>
|
<groupId>cn.hamster3</groupId>
|
||||||
<artifactId>HamsterCurrency</artifactId>
|
<artifactId>HamsterCurrency</artifactId>
|
||||||
<version>2.0.6-SNAPSHOT</version>
|
<version>2.0.7-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@@ -3,7 +3,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group 'cn.hamster3'
|
group 'cn.hamster3'
|
||||||
version '2.0.6-SNAPSHOT'
|
version '2.0.7-SNAPSHOT'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
|
@@ -45,14 +45,13 @@ public class PlayerData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("ConstantConditions")
|
|
||||||
public PlayerData(ConfigurationSection config) {
|
public PlayerData(ConfigurationSection config) {
|
||||||
uuid = UUID.fromString(config.getString("uuid"));
|
uuid = UUID.fromString(config.getString("uuid"));
|
||||||
OfflinePlayer player = Bukkit.getOfflinePlayer(uuid);
|
OfflinePlayer player = Bukkit.getOfflinePlayer(uuid);
|
||||||
if (player.getName() != null) {
|
if (player.getName() != null) {
|
||||||
playerName = player.getName();
|
playerName = player.getName();
|
||||||
} else {
|
} else {
|
||||||
playerName = config.getString("playerName");
|
playerName = config.getString("playerName").replace("\\'", "'");
|
||||||
}
|
}
|
||||||
playerCurrencies = new HashMap<>();
|
playerCurrencies = new HashMap<>();
|
||||||
ConfigurationSection playerCurrenciesConfig = config.getConfigurationSection("playerCurrencies");
|
ConfigurationSection playerCurrenciesConfig = config.getConfigurationSection("playerCurrencies");
|
||||||
@@ -64,7 +63,7 @@ public class PlayerData {
|
|||||||
public JsonObject saveToJson() {
|
public JsonObject saveToJson() {
|
||||||
JsonObject object = new JsonObject();
|
JsonObject object = new JsonObject();
|
||||||
object.addProperty("uuid", uuid.toString());
|
object.addProperty("uuid", uuid.toString());
|
||||||
object.addProperty("playerName", playerName);
|
object.addProperty("playerName", playerName.replace("'", "\\'"));
|
||||||
JsonObject playerCurrenciesJson = new JsonObject();
|
JsonObject playerCurrenciesJson = new JsonObject();
|
||||||
for (Map.Entry<String, Double> entry : playerCurrencies.entrySet()) {
|
for (Map.Entry<String, Double> entry : playerCurrencies.entrySet()) {
|
||||||
playerCurrenciesJson.addProperty(entry.getKey(), entry.getValue());
|
playerCurrenciesJson.addProperty(entry.getKey(), entry.getValue());
|
||||||
|
Reference in New Issue
Block a user