2 Commits

3 changed files with 4 additions and 5 deletions

View File

@@ -33,7 +33,7 @@
<dependency>
<groupId>cn.hamster3</groupId>
<artifactId>HamsterCurrency</artifactId>
<version>2.0.6-SNAPSHOT</version>
<version>2.0.7-SNAPSHOT</version>
</dependency>
```

View File

@@ -3,7 +3,7 @@ plugins {
}
group 'cn.hamster3'
version '2.0.6-SNAPSHOT'
version '2.0.7-SNAPSHOT'
repositories {
maven {

View File

@@ -45,14 +45,13 @@ public class PlayerData {
}
}
@SuppressWarnings("ConstantConditions")
public PlayerData(ConfigurationSection config) {
uuid = UUID.fromString(config.getString("uuid"));
OfflinePlayer player = Bukkit.getOfflinePlayer(uuid);
if (player.getName() != null) {
playerName = player.getName();
} else {
playerName = config.getString("playerName");
playerName = config.getString("playerName").replace("\\'", "'");
}
playerCurrencies = new HashMap<>();
ConfigurationSection playerCurrenciesConfig = config.getConfigurationSection("playerCurrencies");
@@ -64,7 +63,7 @@ public class PlayerData {
public JsonObject saveToJson() {
JsonObject object = new JsonObject();
object.addProperty("uuid", uuid.toString());
object.addProperty("playerName", playerName);
object.addProperty("playerName", playerName.replace("'", "\\'"));
JsonObject playerCurrenciesJson = new JsonObject();
for (Map.Entry<String, Double> entry : playerCurrencies.entrySet()) {
playerCurrenciesJson.addProperty(entry.getKey(), entry.getValue());