Fixed NPE at #26 after /flairme
This commit is contained in:
parent
4ee38f92cf
commit
ba528112d5
2 changed files with 12 additions and 1 deletions
|
@ -6,7 +6,10 @@ import com.earth2me.essentials.User;
|
||||||
|
|
||||||
public class FlairColourAPI {
|
public class FlairColourAPI {
|
||||||
public static void recolourPlayer(User user, DyeColor dyecolour){
|
public static void recolourPlayer(User user, DyeColor dyecolour){
|
||||||
String name = user._getNickname();
|
String name = "";
|
||||||
|
if ((name = user._getNickname()) == null && (name = user.getDisplayName()) == null){
|
||||||
|
name = user.getName();
|
||||||
|
}
|
||||||
String sanitizedName = "";
|
String sanitizedName = "";
|
||||||
for(int i = 0; i < name.length(); i++){
|
for(int i = 0; i < name.length(); i++){
|
||||||
if (name.charAt(i) == '§'){
|
if (name.charAt(i) == '§'){
|
||||||
|
|
|
@ -66,6 +66,14 @@ public class PortalListener implements Listener{
|
||||||
}else{
|
}else{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (essentials.getUser(player) == null){
|
||||||
|
player.sendMessage("Error! essentials.getUser() returns null!");
|
||||||
|
throw new NullPointerException();
|
||||||
|
}
|
||||||
|
if (woolColour == null){
|
||||||
|
player.sendMessage("Error! Wool colour returns null!");
|
||||||
|
throw new NullPointerException();
|
||||||
|
}
|
||||||
|
|
||||||
FlairColourAPI.recolourPlayer(essentials.getUser(player), woolColour);
|
FlairColourAPI.recolourPlayer(essentials.getUser(player), woolColour);
|
||||||
component.playersToBeFlaired.remove(player.getName());
|
component.playersToBeFlaired.remove(player.getName());
|
||||||
|
|
Loading…
Reference in a new issue