mirror of
https://github.com/TotalFreedomMC/TFGuilds.git
synced 2024-12-21 23:45:04 +00:00
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 <spacerocket62@gmail.com>
This commit is contained in:
parent
1c0d802b73
commit
e2d6f9a09c
1 changed files with 10 additions and 4 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue