1.4.3 beta 2 (bug fix issue requests)

This commit is contained in:
Tyler Murphy 2022-05-04 09:28:38 -04:00
parent f4954efb39
commit 664c0d9ad5
3 changed files with 11 additions and 11 deletions

View file

@ -37,8 +37,7 @@ public class Stop implements ICommand {
return; return;
} }
if(Game.status == Status.STARTING || Game.status == Status.PLAYING) { if(Game.status == Status.STARTING || Game.status == Status.PLAYING) {
if(announceMessagesToNonPlayers) Bukkit.broadcastMessage(abortPrefix + message("STOP")); Game.broadcastMessage(abortPrefix + message("STOP"));
else Game.broadcastMessage(abortPrefix + message("STOP"));
Game.stop(WinType.NONE); Game.stop(WinType.NONE);
} else { } else {
sender.sendMessage(errorPrefix + message("GAME_NOT_INPROGRESS")); sender.sendMessage(errorPrefix + message("GAME_NOT_INPROGRESS"));

View file

@ -176,11 +176,10 @@ public class ConfigManager {
} }
public boolean getBoolean(String path){ public boolean getBoolean(String path){
boolean value = config.getBoolean(path); if(!config.contains(path)){
if(!value){
return defaultConfig.getBoolean(path); return defaultConfig.getBoolean(path);
} else { } else {
return true; return config.getBoolean(path);
} }
} }
@ -209,7 +208,7 @@ public class ConfigManager {
while((c = reader.read()) != -1){ while((c = reader.read()) != -1){
textBuilder.append((char) c); textBuilder.append((char) c);
} }
String yamlString = textBuilder.toString(); String yamlString = new String(textBuilder.toString().getBytes(), StandardCharsets.UTF_8);
Map<String, Object> temp = config.getValues(true); Map<String, Object> temp = config.getValues(true);
for(Map.Entry<String, Object> entry: temp.entrySet()){ for(Map.Entry<String, Object> entry: temp.entrySet()){
if(entry.getValue() instanceof Integer || entry.getValue() instanceof Double || entry.getValue() instanceof String || entry.getValue() instanceof Boolean || entry.getValue() instanceof List){ if(entry.getValue() instanceof Integer || entry.getValue() instanceof Double || entry.getValue() instanceof String || entry.getValue() instanceof Boolean || entry.getValue() instanceof List){
@ -239,18 +238,20 @@ public class ConfigManager {
} }
replace = replace.substring(0, replace.length()-2); replace = replace.substring(0, replace.length()-2);
replace = replace + "]"; replace = replace + "]";
replace = new String(replace.getBytes(), StandardCharsets.UTF_8);
} else { } else {
replace = entry.getValue().toString(); replace = new String(entry.getValue().toString().getBytes(), StandardCharsets.UTF_8);
} }
if(entry.getValue() instanceof String){ if(entry.getValue() instanceof String){
replace = "\"" + replace + "\""; replace = "\"" + replace + "\"";
} }
StringBuilder builder = new StringBuilder(yamlString); StringBuilder builder = new StringBuilder(yamlString);
builder.replace(start+1, end, replace); builder.replace(start+1, end, replace);
yamlString = builder.toString(); yamlString = new String(builder.toString().getBytes(), StandardCharsets.UTF_8);
} }
} }
PrintWriter out = new PrintWriter(file); OutputStream os = new FileOutputStream(file);
PrintWriter out = new PrintWriter(new OutputStreamWriter(os, StandardCharsets.UTF_8), true);
out.print(yamlString); out.print(yamlString);
out.close(); out.close();
} catch (IOException e){ } catch (IOException e){

View file

@ -171,6 +171,7 @@ public class Game {
} }
worldBorder.resetWorldborder("hideandseek_"+spawnWorld); worldBorder.resetWorldborder("hideandseek_"+spawnWorld);
for(Player player : Board.getPlayers()) { for(Player player : Board.getPlayers()) {
player.teleport(new Location(Bukkit.getWorld(lobbyWorld), lobbyPosition.getX(),lobbyPosition.getY(),lobbyPosition.getZ()));
Board.createLobbyBoard(player); Board.createLobbyBoard(player);
player.setGameMode(GameMode.ADVENTURE); player.setGameMode(GameMode.ADVENTURE);
Board.addHider(player); Board.addHider(player);
@ -179,7 +180,6 @@ public class Game {
player.getInventory().setItem(lobbyItemStartPosition, lobbyStartItem); player.getInventory().setItem(lobbyItemStartPosition, lobbyStartItem);
if(lobbyLeaveItem != null) if(lobbyLeaveItem != null)
player.getInventory().setItem(lobbyItemLeavePosition, lobbyLeaveItem); player.getInventory().setItem(lobbyItemLeavePosition, lobbyLeaveItem);
player.teleport(new Location(Bukkit.getWorld(lobbyWorld), lobbyPosition.getX(),lobbyPosition.getY(),lobbyPosition.getZ()));
for(PotionEffect effect : player.getActivePotionEffects()){ for(PotionEffect effect : player.getActivePotionEffects()){
player.removePotionEffect(effect.getType()); player.removePotionEffect(effect.getType());
} }
@ -259,6 +259,7 @@ public class Game {
public static void join(Player player){ public static void join(Player player){
if(Game.status == Status.STANDBY) { if(Game.status == Status.STANDBY) {
player.teleport(new Location(Bukkit.getWorld(lobbyWorld), lobbyPosition.getX(),lobbyPosition.getY(),lobbyPosition.getZ()));
player.getInventory().clear(); player.getInventory().clear();
if(lobbyStartItem != null && (!lobbyItemStartAdmin || player.hasPermission("hideandseek.start"))) if(lobbyStartItem != null && (!lobbyItemStartAdmin || player.hasPermission("hideandseek.start")))
player.getInventory().setItem(lobbyItemStartPosition, lobbyStartItem); player.getInventory().setItem(lobbyItemStartPosition, lobbyStartItem);
@ -267,7 +268,6 @@ public class Game {
Board.addHider(player); Board.addHider(player);
if(announceMessagesToNonPlayers) Bukkit.broadcastMessage(messagePrefix + message("GAME_JOIN").addPlayer(player)); if(announceMessagesToNonPlayers) Bukkit.broadcastMessage(messagePrefix + message("GAME_JOIN").addPlayer(player));
else Game.broadcastMessage(messagePrefix + message("GAME_JOIN").addPlayer(player)); else Game.broadcastMessage(messagePrefix + message("GAME_JOIN").addPlayer(player));
player.teleport(new Location(Bukkit.getWorld(lobbyWorld), lobbyPosition.getX(),lobbyPosition.getY(),lobbyPosition.getZ()));
player.setGameMode(GameMode.ADVENTURE); player.setGameMode(GameMode.ADVENTURE);
Board.createLobbyBoard(player); Board.createLobbyBoard(player);
Board.reloadLobbyBoards(); Board.reloadLobbyBoards();