mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-26 12:46:04 +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);
|
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;
|
int age = 0;
|
||||||
if (args.hasFlag('b')) {
|
if (args.hasFlag('b')) {
|
||||||
|
@ -55,10 +55,14 @@ public class Messaging {
|
|||||||
String trimmed = message.trim();
|
String trimmed = message.trim();
|
||||||
String messageColour = StringHelper.parseColors(Setting.MESSAGE_COLOUR.asString());
|
String messageColour = StringHelper.parseColors(Setting.MESSAGE_COLOUR.asString());
|
||||||
if (!trimmed.isEmpty()) {
|
if (!trimmed.isEmpty()) {
|
||||||
if (trimmed.charAt(0) != ChatColor.COLOR_CHAR)
|
if (trimmed.charAt(0) == ChatColor.COLOR_CHAR) {
|
||||||
message = StringHelper.parseColors(Setting.MESSAGE_COLOUR.asString()) + message;
|
ChatColor test = ChatColor.getByChar(trimmed.substring(1, 2));
|
||||||
else
|
if (test == null) {
|
||||||
messageColour = ChatColor.getByChar(message.substring(1, 2)).toString();
|
message = messageColour + message;
|
||||||
|
} else
|
||||||
|
messageColour = test.toString();
|
||||||
|
} else
|
||||||
|
message = messageColour + message;
|
||||||
}
|
}
|
||||||
message = message.replace("[[", StringHelper.parseColors(Setting.HIGHLIGHT_COLOUR.asString()));
|
message = message.replace("[[", StringHelper.parseColors(Setting.HIGHLIGHT_COLOUR.asString()));
|
||||||
message = message.replace("]]", messageColour);
|
message = message.replace("]]", messageColour);
|
||||||
|
Loading…
Reference in New Issue
Block a user