Null check holograms (although they shouldn't be null in this location...)

This commit is contained in:
fullwall 2024-07-10 10:04:31 +08:00
parent 8571f3e163
commit ec51df24b5
2 changed files with 3 additions and 3 deletions

View File

@ -510,7 +510,7 @@ public class CommandTrait extends Trait {
@Override
public String toString() {
return name().charAt(0) + name().substring(1).toLowerCase(Locale.US);
return name().charAt(0) + name().substring(1).toLowerCase(Locale.ROOT);
}
}

View File

@ -786,7 +786,7 @@ public class HologramTrait extends Trait {
spawnHologram(npc, offset);
spawnWaitTicks = 5;
}
if (!hologram.isSpawned())
if (hologram == null || !hologram.isSpawned())
return;
render0(npc, offset);
}
@ -837,7 +837,7 @@ public class HologramTrait extends Trait {
public static class TabCompletions implements CompletionsProvider {
@Override
public Collection<String> getCompletions(CommandContext args, CommandSender sender, NPC npc) {
if (args.length() > 1 && npc != null && LINE_ARGS.contains(args.getString(1).toLowerCase(Locale.US))) {
if (args.length() > 1 && npc != null && LINE_ARGS.contains(args.getString(1).toLowerCase(Locale.ROOT))) {
HologramTrait ht = npc.getOrAddTrait(HologramTrait.class);
return IntStream.range(0, ht.getLines().size()).mapToObj(Integer::toString)
.collect(Collectors.toList());