mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-22 18:45:29 +01:00
Fix NPE
This commit is contained in:
parent
a01d871ae3
commit
fce64e4a96
@ -199,7 +199,7 @@ public class NPCCommands {
|
||||
}
|
||||
|
||||
npc = npcRegistry.createNPC(type, name);
|
||||
String msg = "You created " + StringHelper.wrap(npc.getName()) + " at your location";
|
||||
String msg = "You created [[" + npc.getName() + "]] at your location";
|
||||
|
||||
int age = 0;
|
||||
if (args.hasFlag('b')) {
|
||||
|
@ -55,10 +55,14 @@ public class Messaging {
|
||||
String trimmed = message.trim();
|
||||
String messageColour = StringHelper.parseColors(Setting.MESSAGE_COLOUR.asString());
|
||||
if (!trimmed.isEmpty()) {
|
||||
if (trimmed.charAt(0) != ChatColor.COLOR_CHAR)
|
||||
message = StringHelper.parseColors(Setting.MESSAGE_COLOUR.asString()) + message;
|
||||
else
|
||||
messageColour = ChatColor.getByChar(message.substring(1, 2)).toString();
|
||||
if (trimmed.charAt(0) == ChatColor.COLOR_CHAR) {
|
||||
ChatColor test = ChatColor.getByChar(trimmed.substring(1, 2));
|
||||
if (test == null) {
|
||||
message = messageColour + message;
|
||||
} else
|
||||
messageColour = test.toString();
|
||||
} else
|
||||
message = messageColour + message;
|
||||
}
|
||||
message = message.replace("[[", StringHelper.parseColors(Setting.HIGHLIGHT_COLOUR.asString()));
|
||||
message = message.replace("]]", messageColour);
|
||||
|
Loading…
Reference in New Issue
Block a user