From db29352948bd8e97af1e96a393e160c4bd7ad42c Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Sat, 11 Jan 2020 13:37:45 +1300 Subject: [PATCH] Fix some typos, don't use MineSkinAPI name --- .../me/libraryaddict/disguise/DisguiseAPI.java | 2 +- .../me/libraryaddict/disguise/LibsDisguises.java | 2 +- .../disguise/commands/GrabSkinCommand.java | 15 +++++---------- .../disguisetypes/watchers/ShulkerWatcher.java | 3 +-- .../disguise/utilities/mineskin/MineSkinAPI.java | 6 +++--- .../disguise/utilities/translations/LibsMsg.java | 4 +++- 6 files changed, 14 insertions(+), 18 deletions(-) diff --git a/src/main/java/me/libraryaddict/disguise/DisguiseAPI.java b/src/main/java/me/libraryaddict/disguise/DisguiseAPI.java index cc75fb52..fb9a1668 100644 --- a/src/main/java/me/libraryaddict/disguise/DisguiseAPI.java +++ b/src/main/java/me/libraryaddict/disguise/DisguiseAPI.java @@ -38,7 +38,7 @@ public class DisguiseAPI { disguiseName = disguiseName.replace(".", ""); try { - DisguiseConfig.removeCustomDisguise(disguiseInfo); + DisguiseConfig.removeCustomDisguise(disguiseName); DisguiseConfig.addCustomDisguise(disguiseName, disguiseInfo); File disguisesFile = new File("plugins/LibsDisguises/disguises.yml"); diff --git a/src/main/java/me/libraryaddict/disguise/LibsDisguises.java b/src/main/java/me/libraryaddict/disguise/LibsDisguises.java index cc80a057..f82c7094 100644 --- a/src/main/java/me/libraryaddict/disguise/LibsDisguises.java +++ b/src/main/java/me/libraryaddict/disguise/LibsDisguises.java @@ -64,7 +64,7 @@ public class LibsDisguises extends JavaPlugin { if (!ReflectionManager.getMinecraftVersion().startsWith("1.15")) { getLogger().severe("You're using the wrong version of Lib's Disguises for your server! This is " + - "intended for 1.14.4!"); + "intended for 1.15!"); getPluginLoader().disablePlugin(this); return; } diff --git a/src/main/java/me/libraryaddict/disguise/commands/GrabSkinCommand.java b/src/main/java/me/libraryaddict/disguise/commands/GrabSkinCommand.java index a9a4114e..240898c2 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/GrabSkinCommand.java +++ b/src/main/java/me/libraryaddict/disguise/commands/GrabSkinCommand.java @@ -90,18 +90,13 @@ public class GrabSkinCommand implements CommandExecutor { String nName = name; if (nName == null) { - if (profile.getName() != null && profile.getName().length() > 0 && - !DisguiseUtilities.hasGameProfile(profile.getName())) { - nName = profile.getName(); - } else { - int i = 1; + int i = 1; - while (DisguiseUtilities.hasGameProfile("skin" + i)) { - i++; - } - - nName = "skin" + i; + while (DisguiseUtilities.hasGameProfile("skin" + i)) { + i++; } + + nName = "skin" + i; } if (profile.getName() == null || !profile.getName().equals(nName)) { diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/ShulkerWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/ShulkerWatcher.java index 83b8f6af..9d76255a 100644 --- a/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/ShulkerWatcher.java +++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/ShulkerWatcher.java @@ -54,8 +54,7 @@ public class ShulkerWatcher extends InsentientWatcher { @Deprecated public void setColor(AnimalColor color) { - setData(MetaIndex.SHULKER_COLOR, color.getDyeColor().getWoolData()); - sendData(MetaIndex.SHULKER_COLOR); + setColor(color.getDyeColor()); } public void setColor(DyeColor newColor) { diff --git a/src/main/java/me/libraryaddict/disguise/utilities/mineskin/MineSkinAPI.java b/src/main/java/me/libraryaddict/disguise/utilities/mineskin/MineSkinAPI.java index 435dd04e..29a6e12b 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/mineskin/MineSkinAPI.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/mineskin/MineSkinAPI.java @@ -120,7 +120,7 @@ public class MineSkinAPI { return null; } else { callback.onError(LibsMsg.SKIN_API_FAIL_CODE, "" + error.code, - "Your image has the error: " + error.error); + LibsMsg.SKIN_API_IMAGE_HAS_ERROR.get(error.error)); return null; } } else if (connection.getResponseCode() == 400) { @@ -146,7 +146,7 @@ public class MineSkinAPI { } } catch (SocketTimeoutException ex) { - callback.onError(skinUrl == null ? LibsMsg.SKIN_API_TIMEOUT : LibsMsg.SKIN_API_IMAGE_TIMEOUT); + callback.onError(skinUrl == null ? LibsMsg.SKIN_API_TIMEOUT_ERROR : LibsMsg.SKIN_API_IMAGE_TIMEOUT); return null; } catch (Exception ex) { @@ -155,7 +155,7 @@ public class MineSkinAPI { try { if (connection != null && (connection.getResponseCode() == 524 || connection.getResponseCode() == 408 || connection.getResponseCode() == 504 || connection.getResponseCode() == 599)) { - callback.onError(LibsMsg.SKIN_API_TIMEOUT); + callback.onError(LibsMsg.SKIN_API_TIMEOUT_ERROR); return null; } } diff --git a/src/main/java/me/libraryaddict/disguise/utilities/translations/LibsMsg.java b/src/main/java/me/libraryaddict/disguise/utilities/translations/LibsMsg.java index 7e7577dd..67b964ed 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/translations/LibsMsg.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/translations/LibsMsg.java @@ -199,7 +199,9 @@ public enum LibsMsg { SKIN_API_403("mineskin.org denied access to that url"), SKIN_API_404("mineskin.org unable to find an image at that url"), SKIN_API_IMAGE_TIMEOUT(ChatColor.RED + "Error! mineskin.org took too long to connect! Is your image valid?"), - SKIN_API_TIMEOUT(ChatColor.RED + "Error! Took too long to connect to mineskin.org!"), + SKIN_API_TIMEOUT_ERROR(ChatColor.RED + "Error! Took too long to connect to mineskin.org!"), + SKIN_API_TIMEOUT(ChatColor.RED + "Took too long to connect to mineskin.org!"), + SKIN_API_IMAGE_HAS_ERROR("Your image has the error: %s"), SKIN_API_USING_URL(ChatColor.GRAY + "Url provided, now attempting to connect to mineskin.org"), SKIN_API_BAD_FILE_NAME(ChatColor.RED + "Invalid file name provided! File not found!"), SKIN_API_BAD_FILE(ChatColor.RED + "Invalid file provided! Please ensure it is a valid .png skin!"),