From 6cb02126f45521f3a197367a7d618ffcecdad255 Mon Sep 17 00:00:00 2001 From: Trent Hensler Date: Thu, 1 Mar 2018 22:15:44 -0800 Subject: [PATCH] Check for null role. Resolves: #1047 #1048 #1041 --- .../java/com/massivecraft/factions/util/MiscUtil.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/com/massivecraft/factions/util/MiscUtil.java b/src/main/java/com/massivecraft/factions/util/MiscUtil.java index 6697b3b1..91112c71 100644 --- a/src/main/java/com/massivecraft/factions/util/MiscUtil.java +++ b/src/main/java/com/massivecraft/factions/util/MiscUtil.java @@ -3,6 +3,7 @@ package com.massivecraft.factions.util; import com.massivecraft.factions.Conf; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.P; +import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.zcore.util.TL; import org.bukkit.ChatColor; import org.bukkit.entity.Creature; @@ -13,6 +14,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.List; +import java.util.logging.Level; public class MiscUtil { @@ -88,6 +90,13 @@ public class MiscUtil { List recruit = new ArrayList<>(); for (FPlayer player : players) { + + // Fix for some data being broken when we added the recruit rank. + if (player.getRole() == null) { + player.setRole(Role.NORMAL); + P.p.log(Level.WARNING, String.format("Player %s had null role. Setting them to normal. This isn't good D:", player.getName())); + } + switch (player.getRole()) { case ADMIN: admins.add(player);