Compare commits

...

2 Commits

Author SHA1 Message Date
fullwall 5533961066 EXPERIMENTAL: trial not updating scoreboard every tick 2024-04-22 17:40:12 +08:00
fullwall b09a8bae56 Null check hologram entity 2024-04-22 16:14:54 +08:00
3 changed files with 15 additions and 13 deletions

View File

@ -592,7 +592,8 @@ public class HologramTrait extends Trait {
@Override
public Collection<Entity> getEntities() {
return hologram != null ? ImmutableList.of(hologram.getEntity()) : Collections.emptyList();
return hologram != null && hologram.getEntity() != null ? ImmutableList.of(hologram.getEntity())
: Collections.emptyList();
}
@Override

View File

@ -42,13 +42,13 @@ public class ScoreboardTrait extends Trait {
metadata = CitizensAPI.getLocationLookup().<Boolean> registerMetadata("scoreboard", (meta, event) -> {
for (NPC npc : CitizensAPI.getNPCRegistry()) {
ScoreboardTrait trait = npc.getTraitNullable(ScoreboardTrait.class);
if (trait == null) {
if (trait == null)
continue;
}
Team team = trait.getTeam();
if (team == null || meta.has(event.getPlayer().getUniqueId(), team.getName())) {
if (team == null || meta.has(event.getPlayer().getUniqueId(), team.getName()))
continue;
}
NMS.sendTeamPacket(event.getPlayer(), team, 0);
meta.set(event.getPlayer().getUniqueId(), team.getName(), true);
}
@ -232,9 +232,9 @@ public class ScoreboardTrait extends Trait {
if (!changed)
return;
for (Player player : Bukkit.getOnlinePlayers()) {
if (player.hasMetadata("NPC")) {
if (player.hasMetadata("NPC"))
continue;
}
if (metadata.has(player.getUniqueId(), team.getName())) {
NMS.sendTeamPacket(player, team, 2);
} else {
@ -242,6 +242,13 @@ public class ScoreboardTrait extends Trait {
metadata.set(player.getUniqueId(), team.getName(), true);
}
}
changed = false;
}
public enum TeamPacketMode {
ADD,
REMOVE,
UPDATE;
}
private static boolean SUPPORT_COLLIDABLE_SETOPTION = true;

View File

@ -106,12 +106,6 @@ public class FoxTrait extends Trait {
this.type = type;
}
public enum FoxModifier {
FACEPLANTED,
INTERESTED,
POUNCING;
}
@Command(
aliases = { "npc" },
usage = "fox --type type --sleeping [true|false] --sitting [true|false] --crouching [true|false] --interested [true|false] --pouncing [true|false] --faceplanted [true|false]",