mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-03 14:38:51 +00:00
fix nullcheck
This commit is contained in:
1 file changed
+6
-6
@@ -87,17 +87,17 @@ public class ChannelListCommand extends BaseCommand {
|
|||||||
|
|
||||||
private void makeList(Iterator<ChatChannel> iterator, TextComponent.Builder list) {
|
private void makeList(Iterator<ChatChannel> iterator, TextComponent.Builder list) {
|
||||||
String listSeparator = carbonChat.getLanguage().getString("channel-list-separator");
|
String listSeparator = carbonChat.getLanguage().getString("channel-list-separator");
|
||||||
Component listSeparatorComponent = TextComponent.of(listSeparator);
|
Component listSeparatorComponent;
|
||||||
|
if (listSeparator != null) {
|
||||||
|
listSeparatorComponent = TextComponent.of(listSeparator);
|
||||||
|
} else {
|
||||||
|
listSeparatorComponent = TextComponent.of(", ");
|
||||||
|
}
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
ChatChannel channel = iterator.next();
|
ChatChannel channel = iterator.next();
|
||||||
list.append(TextComponent.of(channel.getName()));
|
list.append(TextComponent.of(channel.getName()));
|
||||||
|
|
||||||
if (iterator.hasNext()) {
|
if (iterator.hasNext()) {
|
||||||
if (listSeparator != null) {
|
|
||||||
list.append(TextComponent.of(listSeparator));
|
|
||||||
} else {
|
|
||||||
list.append(listSeparatorComponent);
|
list.append(listSeparatorComponent);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user