From e2d6f9a09ce5d11e7138d120e6ab2d3c760fb86b Mon Sep 17 00:00:00 2001 From: Taahh Date: Sun, 23 Jan 2022 17:22:17 -0800 Subject: [PATCH 1/5] FS-424 (#11) * Fixes NPE of https://gist.github.com/Wild1145/4dfd2c2fd3c38331d79c5672e700ec74 Added check to check if user is null or not Added check to make sure the stripped strings are not null (tfm tag & guild tag) * Forgot to use variables to substitute Co-authored-by: spacerocket62 --- .../tfguilds/listener/JoinListener.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/me/totalfreedom/tfguilds/listener/JoinListener.java b/src/main/java/me/totalfreedom/tfguilds/listener/JoinListener.java index a01c041..bae6f31 100644 --- a/src/main/java/me/totalfreedom/tfguilds/listener/JoinListener.java +++ b/src/main/java/me/totalfreedom/tfguilds/listener/JoinListener.java @@ -43,13 +43,19 @@ public class JoinListener implements Listener int maxLength = ConfigEntry.GLOBAL_TAG_MAX_LENGTH.getInteger(); String tfmTag = TFGuilds.getPlugin().getTfmBridge().getTag(player); - if (user.displayTag() && tfmTag != null && guild.getTag() != null && maxLength > 0) + if (user != null && user.displayTag() && tfmTag != null && guild.getTag() != null && maxLength > 0) { - int length = GUtil.removeColorCodes(tfmTag).length() + GUtil.removeColorCodes(guild.getTag()).length(); - if (length > maxLength) + String tfmTagStripped = GUtil.removeColorCodes(tfmTag); + String guildTagStripped = GUtil.removeColorCodes(guild.getTag()); + if (tfmTagStripped != null && guildTagStripped != null) { - TFGuilds.getPlugin().getTfmBridge().clearTag(player); + int length = tfmTagStripped.length() + guildTagStripped.length(); + if (length > maxLength) + { + TFGuilds.getPlugin().getTfmBridge().clearTag(player); + } } + } } } From 0ba0e1aeaa4d471b4949c38e7e92df339353e68d Mon Sep 17 00:00:00 2001 From: Paldiu Date: Fri, 28 Jan 2022 17:37:58 -0600 Subject: [PATCH 2/5] Update 2022.01 Update to the guilds plugin includes: - Fixed reflections methods for TFM Bridge to reflect new naming conventions - Added in an entry checker for the configuration file to ensure that the file contains the necessary key value pairs - Minor code QoL improvements - Convert to Paper --- .idea/TFGuilds.iml | 111 +++++------------- .idea/compiler.xml | 2 +- .idea/jarRepositories.xml | 5 + .idea/misc.xml | 2 +- nb-configuration.xml | 2 +- pom.xml | 16 +-- .../me/totalfreedom/tfguilds/TFGuilds.java | 5 +- .../me/totalfreedom/tfguilds/TFMBridge.java | 10 +- .../totalfreedom/tfguilds/config/Config.java | 59 +++++++++- .../tfguilds/config/ConfigEntry.java | 4 + src/main/resources/config.yml | 2 +- src/main/resources/plugin.yml | 2 +- 12 files changed, 116 insertions(+), 104 deletions(-) diff --git a/.idea/TFGuilds.iml b/.idea/TFGuilds.iml index 163e931..e5665da 100644 --- a/.idea/TFGuilds.iml +++ b/.idea/TFGuilds.iml @@ -1,20 +1,15 @@ - - - - SPIGOT + PAPER - + @@ -24,81 +19,33 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml index ec2a0b4..b9600f9 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -11,7 +11,7 @@ - + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml index b008060..e89a848 100644 --- a/.idea/jarRepositories.xml +++ b/.idea/jarRepositories.xml @@ -11,6 +11,11 @@