Fix off-by-one error

This commit is contained in:
Norbi Peti 2018-11-04 22:03:54 +01:00
parent 304f5c562d
commit 71aeafadda
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56

View file

@ -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()