From 5ef076bda94567cf956ff71b616a644f9a0ee4f6 Mon Sep 17 00:00:00 2001 From: Unknown Date: Sun, 25 Nov 2018 02:06:50 +0000 Subject: [PATCH] Bug Fixes # Fixed comments in the 'config.yml' file creating a new line rather than remaining on the same line. # Fixed ISE when performing the command '/island' or '/is'. # Fixed the displayname on the scoreboard not updating. # Fixed a word mistake in the 'language.yml' file. --- language.yml | 2 +- plugin.yml | 2 +- .../skyblock/command/CommandManager.java | 7 ++++++- .../skyblock/command/commands/VoteCommand.java | 2 +- .../goodandevil/skyblock/config/FileManager.java | 2 +- .../skyblock/scoreboard/Scoreboard.java | 14 +++++++++++--- 6 files changed, 21 insertions(+), 8 deletions(-) diff --git a/language.yml b/language.yml index 0783ca50..9d2635e8 100644 --- a/language.yml +++ b/language.yml @@ -236,7 +236,7 @@ Command: Message: "&bSkyBlock &8| &aInfo&8: &eYou have been demoted to a &dMember&e." Vote: Info: - Message: "Add/Remove a vote for a players Island." + Message: "Add/Remove a vote from a players Island." Invalid: Message: "&bSkyBlock &8| &cError&8: &eInvalid: /island vote " Disabled: diff --git a/plugin.yml b/plugin.yml index a074872d..a0033396 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,6 +1,6 @@ name: SkyBlock main: me.goodandevil.skyblock.Main -version: 25 +version: 26 api-version: 1.13 description: A unique SkyBlock plugin author: GoodAndEvil diff --git a/src/me/goodandevil/skyblock/command/CommandManager.java b/src/me/goodandevil/skyblock/command/CommandManager.java index 16646e32..61753957 100644 --- a/src/me/goodandevil/skyblock/command/CommandManager.java +++ b/src/me/goodandevil/skyblock/command/CommandManager.java @@ -160,7 +160,12 @@ public class CommandManager implements CommandExecutor, TabCompleter { ControlPanel.getInstance().open(player); soundManager.playSound(player, Sounds.CHEST_OPEN.bukkitSound(), 1.0F, 1.0F); } else { - Bukkit.getServer().dispatchCommand(player, "island create"); + Bukkit.getServer().getScheduler().runTask(plugin, new Runnable() { + @Override + public void run() { + Bukkit.getServer().dispatchCommand(player, "island create"); + } + }); } return; diff --git a/src/me/goodandevil/skyblock/command/commands/VoteCommand.java b/src/me/goodandevil/skyblock/command/commands/VoteCommand.java index 975c85c3..c537022d 100644 --- a/src/me/goodandevil/skyblock/command/commands/VoteCommand.java +++ b/src/me/goodandevil/skyblock/command/commands/VoteCommand.java @@ -86,7 +86,7 @@ public class VoteCommand extends SubCommand { if (island.isRole(Role.Member, player.getUniqueId()) || island.isRole(Role.Operator, player.getUniqueId()) || island.isRole(Role.Owner, player.getUniqueId())) { messageManager.sendMessage(player, configLoad.getString("Command.Island.Vote.Island.Member.Message")); soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); - } else if (!playerDataManager.hasPlayerData(player)) { + } else if (playerDataManager.hasPlayerData(player)) { PlayerData playerData = playerDataManager.getPlayerData(player); if (playerData.getIsland() != null && playerData.getIsland().equals(island.getOwnerUUID())) { diff --git a/src/me/goodandevil/skyblock/config/FileManager.java b/src/me/goodandevil/skyblock/config/FileManager.java index b7709f04..02d48a1b 100644 --- a/src/me/goodandevil/skyblock/config/FileManager.java +++ b/src/me/goodandevil/skyblock/config/FileManager.java @@ -204,7 +204,7 @@ public class FileManager { for(String line : lines) { if(line.contains(plugin.getDescription().getName() + "_COMMENT")) { config.append(line.replace("IMPORTANT", "[!]").replace("\n", "").replace(plugin.getDescription().getName() + "_COMMENT_", "#").replaceAll("[0-9]+:", "") + "\n"); - } else { + } else if (line.contains(":")) { config.append(line + "\n"); } } diff --git a/src/me/goodandevil/skyblock/scoreboard/Scoreboard.java b/src/me/goodandevil/skyblock/scoreboard/Scoreboard.java index 938549e0..0e1b191f 100644 --- a/src/me/goodandevil/skyblock/scoreboard/Scoreboard.java +++ b/src/me/goodandevil/skyblock/scoreboard/Scoreboard.java @@ -73,12 +73,12 @@ public class Scoreboard { obj.setDisplaySlot(DisplaySlot.SIDEBAR); - String formatteddisplayName = ChatColor.translateAlternateColorCodes('&', replaceDisplayName(displayName)); + String formattedDisplayName = ChatColor.translateAlternateColorCodes('&', replaceDisplayName(displayName)); - if (formatteddisplayName.length() > 32) { + if (formattedDisplayName.length() > 32) { obj.setDisplayName(ChatColor.RED + "Too long..."); } else { - obj.setDisplayName(formatteddisplayName); + obj.setDisplayName(formattedDisplayName); } for (int i = 0; i < ChatColor.values().length; i++) { @@ -99,6 +99,14 @@ public class Scoreboard { public void run() { if (player.isOnline()) { try { + String formattedDisplayName = ChatColor.translateAlternateColorCodes('&', replaceDisplayName(displayName)); + + if (formattedDisplayName.length() > 32) { + obj.setDisplayName(ChatColor.RED + "Too long..."); + } else { + obj.setDisplayName(formattedDisplayName); + } + for (String displayLine : displayList) { i1--;