Search in sources :

Example 6 with PacketPlayOutScoreboardTeam

use of net.minecraft.server.v1_16_R3.PacketPlayOutScoreboardTeam in project Citizens2 by CitizensDev.

the class NMSImpl method sendTeamPacket.

@Override
public void sendTeamPacket(Player recipient, Team team, int mode) {
    Preconditions.checkNotNull(recipient);
    Preconditions.checkNotNull(team);
    if (TEAM_FIELD == null) {
        TEAM_FIELD = NMS.getGetter(team.getClass(), "team");
    }
    try {
        ScoreboardTeam nmsTeam = (ScoreboardTeam) TEAM_FIELD.invoke(team);
        sendPacket(recipient, new PacketPlayOutScoreboardTeam(nmsTeam, mode));
    } catch (Throwable e) {
        e.printStackTrace();
    }
}
Also used : PacketPlayOutScoreboardTeam(net.minecraft.server.v1_11_R1.PacketPlayOutScoreboardTeam) PacketPlayOutScoreboardTeam(net.minecraft.server.v1_11_R1.PacketPlayOutScoreboardTeam) ScoreboardTeam(net.minecraft.server.v1_11_R1.ScoreboardTeam)

Example 7 with PacketPlayOutScoreboardTeam

use of net.minecraft.server.v1_16_R3.PacketPlayOutScoreboardTeam in project PaperDev by Kamillaova.

the class CraftScoreboardManager method setPlayerBoard.

// CraftBukkit method
public void setPlayerBoard(CraftPlayer player, org.bukkit.scoreboard.Scoreboard bukkitScoreboard) throws IllegalArgumentException {
    Validate.isTrue(bukkitScoreboard instanceof CraftScoreboard, "Cannot set player scoreboard to an unregistered Scoreboard");
    CraftScoreboard scoreboard = (CraftScoreboard) bukkitScoreboard;
    net.minecraft.server.v1_12_R1.Scoreboard oldboard = getPlayerBoard(player).getHandle();
    net.minecraft.server.v1_12_R1.Scoreboard newboard = scoreboard.getHandle();
    EntityPlayer entityplayer = player.getHandle();
    if (oldboard == newboard) {
        return;
    }
    if (scoreboard == mainScoreboard) {
        playerBoards.remove(player);
    } else {
        playerBoards.put(player, (CraftScoreboard) scoreboard);
    }
    // Old objective tracking
    HashSet<ScoreboardObjective> removed = new HashSet<ScoreboardObjective>();
    for (int i = 0; i < 3; ++i) {
        ScoreboardObjective scoreboardobjective = oldboard.getObjectiveForSlot(i);
        if (scoreboardobjective != null && !removed.contains(scoreboardobjective)) {
            entityplayer.playerConnection.sendPacket(new PacketPlayOutScoreboardObjective(scoreboardobjective, 1));
            removed.add(scoreboardobjective);
        }
    }
    // Old team tracking
    Iterator<?> iterator = oldboard.getTeams().iterator();
    while (iterator.hasNext()) {
        ScoreboardTeam scoreboardteam = (ScoreboardTeam) iterator.next();
        entityplayer.playerConnection.sendPacket(new PacketPlayOutScoreboardTeam(scoreboardteam, 1));
    }
    // The above is the reverse of the below method.
    server.getPlayerList().sendScoreboard((ScoreboardServer) newboard, player.getHandle());
}
Also used : ScoreboardObjective(net.minecraft.server.v1_12_R1.ScoreboardObjective) PacketPlayOutScoreboardObjective(net.minecraft.server.v1_12_R1.PacketPlayOutScoreboardObjective) Scoreboard(net.minecraft.server.v1_12_R1.Scoreboard) PacketPlayOutScoreboardTeam(net.minecraft.server.v1_12_R1.PacketPlayOutScoreboardTeam) PacketPlayOutScoreboardObjective(net.minecraft.server.v1_12_R1.PacketPlayOutScoreboardObjective) EntityPlayer(net.minecraft.server.v1_12_R1.EntityPlayer) HashSet(java.util.HashSet) ScoreboardTeam(net.minecraft.server.v1_12_R1.ScoreboardTeam) PacketPlayOutScoreboardTeam(net.minecraft.server.v1_12_R1.PacketPlayOutScoreboardTeam)

Example 8 with PacketPlayOutScoreboardTeam

use of net.minecraft.server.v1_16_R3.PacketPlayOutScoreboardTeam in project Citizens2 by CitizensDev.

the class NMSImpl method sendTeamPacket.

@Override
public void sendTeamPacket(Player recipient, Team team, int mode) {
    Preconditions.checkNotNull(recipient);
    Preconditions.checkNotNull(team);
    if (TEAM_FIELD == null) {
        TEAM_FIELD = NMS.getField(team.getClass(), "team");
    }
    try {
        ScoreboardTeam nmsTeam = (ScoreboardTeam) TEAM_FIELD.get(team);
        sendPacket(recipient, new PacketPlayOutScoreboardTeam(nmsTeam, mode));
    } catch (Throwable e) {
        e.printStackTrace();
    }
}
Also used : PacketPlayOutScoreboardTeam(net.minecraft.server.v1_8_R3.PacketPlayOutScoreboardTeam) PacketPlayOutScoreboardTeam(net.minecraft.server.v1_8_R3.PacketPlayOutScoreboardTeam) ScoreboardTeam(net.minecraft.server.v1_8_R3.ScoreboardTeam)

Example 9 with PacketPlayOutScoreboardTeam

use of net.minecraft.server.v1_16_R3.PacketPlayOutScoreboardTeam in project Citizens2 by CitizensDev.

the class NMSImpl method sendTeamPacket.

@Override
public void sendTeamPacket(Player recipient, Team team, int mode) {
    Preconditions.checkNotNull(recipient);
    Preconditions.checkNotNull(team);
    if (TEAM_FIELD == null) {
        TEAM_FIELD = NMS.getGetter(team.getClass(), "team");
    }
    try {
        ScoreboardTeam nmsTeam = (ScoreboardTeam) TEAM_FIELD.invoke(team);
        sendPacket(recipient, new PacketPlayOutScoreboardTeam(nmsTeam, mode));
    } catch (Throwable e) {
        e.printStackTrace();
    }
}
Also used : PacketPlayOutScoreboardTeam(net.minecraft.server.v1_14_R1.PacketPlayOutScoreboardTeam) ScoreboardTeam(net.minecraft.server.v1_14_R1.ScoreboardTeam) PacketPlayOutScoreboardTeam(net.minecraft.server.v1_14_R1.PacketPlayOutScoreboardTeam)

Example 10 with PacketPlayOutScoreboardTeam

use of net.minecraft.server.v1_16_R3.PacketPlayOutScoreboardTeam in project Citizens2 by CitizensDev.

the class NMSImpl method sendTeamPacket.

@Override
public void sendTeamPacket(Player recipient, Team team, int mode) {
    Preconditions.checkNotNull(recipient);
    Preconditions.checkNotNull(team);
    if (TEAM_FIELD == null) {
        TEAM_FIELD = NMS.getGetter(team.getClass(), "team");
    }
    try {
        ScoreboardTeam nmsTeam = (ScoreboardTeam) TEAM_FIELD.invoke(team);
        sendPacket(recipient, new PacketPlayOutScoreboardTeam(nmsTeam, mode));
    } catch (Throwable e) {
        e.printStackTrace();
    }
}
Also used : PacketPlayOutScoreboardTeam(net.minecraft.server.v1_13_R2.PacketPlayOutScoreboardTeam) ScoreboardTeam(net.minecraft.server.v1_13_R2.ScoreboardTeam) PacketPlayOutScoreboardTeam(net.minecraft.server.v1_13_R2.PacketPlayOutScoreboardTeam)

Aggregations

PacketPlayOutScoreboardTeam (net.minecraft.server.v1_12_R1.PacketPlayOutScoreboardTeam)2 ScoreboardTeam (net.minecraft.server.v1_12_R1.ScoreboardTeam)2 PacketPlayOutScoreboardTeam (net.minecraft.server.v1_16_R3.PacketPlayOutScoreboardTeam)2 ScoreboardTeam (net.minecraft.server.v1_16_R3.ScoreboardTeam)2 HashSet (java.util.HashSet)1 PacketPlayOutScoreboardTeam (net.minecraft.server.v1_10_R1.PacketPlayOutScoreboardTeam)1 ScoreboardTeam (net.minecraft.server.v1_10_R1.ScoreboardTeam)1 PacketPlayOutScoreboardTeam (net.minecraft.server.v1_11_R1.PacketPlayOutScoreboardTeam)1 ScoreboardTeam (net.minecraft.server.v1_11_R1.ScoreboardTeam)1 EntityPlayer (net.minecraft.server.v1_12_R1.EntityPlayer)1 PacketPlayOutScoreboardObjective (net.minecraft.server.v1_12_R1.PacketPlayOutScoreboardObjective)1 Scoreboard (net.minecraft.server.v1_12_R1.Scoreboard)1 ScoreboardObjective (net.minecraft.server.v1_12_R1.ScoreboardObjective)1 PacketPlayOutScoreboardTeam (net.minecraft.server.v1_13_R2.PacketPlayOutScoreboardTeam)1 ScoreboardTeam (net.minecraft.server.v1_13_R2.ScoreboardTeam)1 PacketPlayOutScoreboardTeam (net.minecraft.server.v1_14_R1.PacketPlayOutScoreboardTeam)1 ScoreboardTeam (net.minecraft.server.v1_14_R1.ScoreboardTeam)1 PacketPlayOutScoreboardTeam (net.minecraft.server.v1_15_R1.PacketPlayOutScoreboardTeam)1 ScoreboardTeam (net.minecraft.server.v1_15_R1.ScoreboardTeam)1 PacketPlayOutEntityHeadRotation (net.minecraft.server.v1_16_R3.PacketPlayOutEntityHeadRotation)1