From 71aeafadda4434423234598c2766d0602fef1a72 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Sun, 4 Nov 2018 22:03:54 +0100 Subject: [PATCH] Fix off-by-one error --- .../buttondevteam/chat/listener/PlayerJoinLeaveListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/buttondevteam/chat/listener/PlayerJoinLeaveListener.java b/src/main/java/buttondevteam/chat/listener/PlayerJoinLeaveListener.java index ec88341..0c57e7c 100644 --- a/src/main/java/buttondevteam/chat/listener/PlayerJoinLeaveListener.java +++ b/src/main/java/buttondevteam/chat/listener/PlayerJoinLeaveListener.java @@ -113,7 +113,7 @@ public class PlayerJoinLeaveListener implements Listener { len = name.length() / clrs.length;*/ val nclar = cp.NameColorLocations().get(); int[] ncl = nclar == null ? null : nclar.stream().mapToInt(Integer::intValue).toArray(); - if (ncl != null && (Arrays.stream(ncl).sum() != name.length() || ncl.length != clrs.length)) + if (ncl != null && (Arrays.stream(ncl).sum() != name.length() || ncl.length != clrs.length + 1)) //+1: Nation color ncl = null; // Reset if name length changed //System.out.println("ncl: "+Arrays.toString(ncl)+" - sum: "+Arrays.stream(ncl).sum()+" - name len: "+name.length()); if (!res.getTown().hasNation()