EXPERIMENTAL: trial not updating scoreboard every tick
This commit is contained in:
parent
b09a8bae56
commit
5533961066
|
@ -42,13 +42,13 @@ public class ScoreboardTrait extends Trait {
|
||||||
metadata = CitizensAPI.getLocationLookup().<Boolean> registerMetadata("scoreboard", (meta, event) -> {
|
metadata = CitizensAPI.getLocationLookup().<Boolean> registerMetadata("scoreboard", (meta, event) -> {
|
||||||
for (NPC npc : CitizensAPI.getNPCRegistry()) {
|
for (NPC npc : CitizensAPI.getNPCRegistry()) {
|
||||||
ScoreboardTrait trait = npc.getTraitNullable(ScoreboardTrait.class);
|
ScoreboardTrait trait = npc.getTraitNullable(ScoreboardTrait.class);
|
||||||
if (trait == null) {
|
if (trait == null)
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
Team team = trait.getTeam();
|
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;
|
continue;
|
||||||
}
|
|
||||||
NMS.sendTeamPacket(event.getPlayer(), team, 0);
|
NMS.sendTeamPacket(event.getPlayer(), team, 0);
|
||||||
meta.set(event.getPlayer().getUniqueId(), team.getName(), true);
|
meta.set(event.getPlayer().getUniqueId(), team.getName(), true);
|
||||||
}
|
}
|
||||||
|
@ -232,9 +232,9 @@ public class ScoreboardTrait extends Trait {
|
||||||
if (!changed)
|
if (!changed)
|
||||||
return;
|
return;
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
if (player.hasMetadata("NPC")) {
|
if (player.hasMetadata("NPC"))
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
if (metadata.has(player.getUniqueId(), team.getName())) {
|
if (metadata.has(player.getUniqueId(), team.getName())) {
|
||||||
NMS.sendTeamPacket(player, team, 2);
|
NMS.sendTeamPacket(player, team, 2);
|
||||||
} else {
|
} else {
|
||||||
|
@ -242,6 +242,13 @@ public class ScoreboardTrait extends Trait {
|
||||||
metadata.set(player.getUniqueId(), team.getName(), true);
|
metadata.set(player.getUniqueId(), team.getName(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
changed = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum TeamPacketMode {
|
||||||
|
ADD,
|
||||||
|
REMOVE,
|
||||||
|
UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean SUPPORT_COLLIDABLE_SETOPTION = true;
|
private static boolean SUPPORT_COLLIDABLE_SETOPTION = true;
|
||||||
|
|
Loading…
Reference in New Issue