use of net.minecraft.world.scores.PlayerTeam in project SpongeCommon by SpongePowered.
the class SpongeTeamBuilder method build.
@Override
public Team build() throws IllegalStateException {
checkState(this.name != null, "Name cannot be null!");
checkState(this.displayName != null, "DisplayName cannot be null!");
final Team team = (Team) new PlayerTeam(null, this.name);
team.setDisplayName(this.displayName);
team.setColor(this.color);
team.setPrefix(this.prefix);
team.setSuffix(this.suffix);
team.setAllowFriendlyFire(this.allowFriendlyFire);
team.setCanSeeFriendlyInvisibles(this.showFriendlyInvisibles);
team.setNameTagVisibility(this.nameTagVisibility.get());
team.setDeathMessageVisibility(this.deathMessageVisibility.get());
team.setCollisionRule(this.collisionRule.get());
for (final Component member : this.members) {
team.addMember(member);
}
return team;
}
use of net.minecraft.world.scores.PlayerTeam in project Denizen-For-Bukkit by DenizenScript.
the class PacketHelperImpl method generateNoCollideTeam.
@Override
public void generateNoCollideTeam(Player player, UUID noCollide) {
removeNoCollideTeam(player, noCollide);
PlayerTeam team = new PlayerTeam(SidebarImpl.dummyScoreboard, Utilities.generateRandomColors(8));
team.getPlayers().add(noCollide.toString());
team.setCollisionRule(Team.CollisionRule.NEVER);
HashMap<UUID, PlayerTeam> map = noCollideTeamMap.computeIfAbsent(player.getUniqueId(), k -> new HashMap<>());
map.put(noCollide, team);
send(player, ClientboundSetPlayerTeamPacket.createAddOrModifyPacket(team, true));
}
use of net.minecraft.world.scores.PlayerTeam in project Denizen-For-Bukkit by DenizenScript.
the class SidebarImpl method remove.
@Override
public void remove() {
for (PlayerTeam team : generatedTeams) {
PacketHelperImpl.send(player, ClientboundSetPlayerTeamPacket.createRemovePacket(team));
}
generatedTeams.clear();
PacketHelperImpl.send(player, new ClientboundSetObjectivePacket(this.obj2, 1));
}
use of net.minecraft.world.scores.PlayerTeam in project Denizen-For-Bukkit by DenizenScript.
the class PacketHelperImpl method removeNoCollideTeam.
@Override
public void removeNoCollideTeam(Player player, UUID noCollide) {
if (noCollide == null || !player.isOnline()) {
noCollideTeamMap.remove(player.getUniqueId());
return;
}
HashMap<UUID, PlayerTeam> map = noCollideTeamMap.get(player.getUniqueId());
if (map == null) {
return;
}
PlayerTeam team = map.remove(noCollide);
if (team != null) {
send(player, ClientboundSetPlayerTeamPacket.createRemovePacket(team));
}
if (map.isEmpty()) {
noCollideTeamMap.remove(player.getUniqueId());
}
}
use of net.minecraft.world.scores.PlayerTeam in project Denizen-For-Bukkit by DenizenScript.
the class SidebarImpl method remove.
@Override
public void remove() {
for (PlayerTeam team : generatedTeams) {
PacketHelperImpl.send(player, ClientboundSetPlayerTeamPacket.createRemovePacket(team));
}
generatedTeams.clear();
PacketHelperImpl.send(player, new ClientboundSetObjectivePacket(this.obj2, 1));
}
Aggregations