Skip to content

Commit

Permalink
fix: team names containing dots are not properly saved, resulting in …
Browse files Browse the repository at this point in the history
…invalid arena file
  • Loading branch information
Misat11 committed Jun 20, 2024
1 parent 91bbb28 commit f928366
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions plugin/src/main/java/org/screamingsandals/bedwars/game/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,7 @@ public static Game loadGame(File file, boolean firstAttempt) {
Team t = new Team();
t.newColor = team.getBoolean("isNewColor", false);
t.color = TeamColor.valueOf(MiscUtils.convertColorToNewFormat(team.getString("color"), t));
t.name = teamN;
t.name = team.getString("actualName", teamN);
t.bed = MiscUtils.readLocationFromString(game.world, team.getString("bed"));
t.maxPlayers = team.getInt("maxPlayers");
t.spawn = MiscUtils.readLocationFromString(game.world, team.getString("spawn"));
Expand Down Expand Up @@ -1208,11 +1208,13 @@ public void saveToConfig() {
configMap.set("customPrefix", customPrefix);
if (!teams.isEmpty()) {
for (Team t : teams) {
configMap.set("teams." + t.name + ".isNewColor", t.isNewColor());
configMap.set("teams." + t.name + ".color", t.color.name());
configMap.set("teams." + t.name + ".maxPlayers", t.maxPlayers);
configMap.set("teams." + t.name + ".bed", MiscUtils.setLocationToString(t.bed));
configMap.set("teams." + t.name + ".spawn", MiscUtils.setLocationToString(t.spawn));
String name = t.name.replace('.', '_').replace(' ', '_');
configMap.set("teams." + name + ".isNewColor", t.isNewColor());
configMap.set("teams." + name + ".color", t.color.name());
configMap.set("teams." + name + ".maxPlayers", t.maxPlayers);
configMap.set("teams." + name + ".bed", MiscUtils.setLocationToString(t.bed));
configMap.set("teams." + name + ".spawn", MiscUtils.setLocationToString(t.spawn));
configMap.set("teams." + name + ".actualName", t.name);
}
}
List<Map<String, Object>> nS = new ArrayList<>();
Expand Down

0 comments on commit f928366

Please sign in to comment.