Search in sources :

Example 1 with PacketPlayOutScoreboardTeam

use of net.minecraft.server.v1_12_R1.PacketPlayOutScoreboardTeam in project DragonsOnline by UniverseCraft.

the class PlayerNPC116R3 method spawnFor.

public void spawnFor(Player player) {
    if (isDestroyed)
        return;
    // resync
    location = getEntity().getLocation();
    location.setYaw(originalYaw);
    handle.setCustomNameVisible(false);
    sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, handle), player);
    sync(() -> sendPacket(new PacketPlayOutNamedEntitySpawn(handle), player), 1);
    PacketPlayOutEntityTeleport tp = new PacketPlayOutEntityTeleport();
    setField(tp, "a", getEntityId());
    setField(tp, "b", location.getX());
    setField(tp, "c", location.getY());
    setField(tp, "d", location.getZ());
    setField(tp, "e", getPacketRotation(location.getYaw()));
    setField(tp, "f", getPacketRotation(location.getPitch()));
    setField(tp, "g", handle.isOnGround());
    sync(() -> sendPacket(new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true), player), 2);
    sync(() -> setTablistName(getTablistName()), 2);
    sync(() -> sendPacket(tp, player), 3);
    sync(() -> sendPacket(new PacketPlayOutEntityHeadRotation(handle, getPacketRotation(location.getYaw())), player), 6);
    sync(() -> removeFromTablistFor(player), 20 + (int) Math.ceil(2 * bridge.getPing(player) * 20 / 1000));
    lastSeenLocation.put(player, location.clone());
    // https://www.spigotmc.org/threads/remove-nameplate-of-an-nms-player-entity.436099/ (Phaze)
    ScoreboardTeam team = new ScoreboardTeam(((CraftScoreboard) Bukkit.getScoreboardManager().getMainScoreboard()).getHandle(), player.getName());
    team.setNameTagVisibility(ScoreboardTeamBase.EnumNameTagVisibility.NEVER);
    sendPacket(new PacketPlayOutScoreboardTeam(team, 1), player);
    sendPacket(new PacketPlayOutScoreboardTeam(team, 0), player);
    sendPacket(new PacketPlayOutScoreboardTeam(team, List.of(handle.getName()), 3), player);
}
Also used : PacketPlayOutScoreboardTeam(net.minecraft.server.v1_16_R3.PacketPlayOutScoreboardTeam) PacketPlayOutNamedEntitySpawn(net.minecraft.server.v1_16_R3.PacketPlayOutNamedEntitySpawn) PacketPlayOutEntityMetadata(net.minecraft.server.v1_16_R3.PacketPlayOutEntityMetadata) PacketPlayOutEntityHeadRotation(net.minecraft.server.v1_16_R3.PacketPlayOutEntityHeadRotation) PacketPlayOutPlayerInfo(net.minecraft.server.v1_16_R3.PacketPlayOutPlayerInfo) PacketPlayOutEntityTeleport(net.minecraft.server.v1_16_R3.PacketPlayOutEntityTeleport) PacketPlayOutScoreboardTeam(net.minecraft.server.v1_16_R3.PacketPlayOutScoreboardTeam) ScoreboardTeam(net.minecraft.server.v1_16_R3.ScoreboardTeam)

Example 2 with PacketPlayOutScoreboardTeam

use of net.minecraft.server.v1_12_R1.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_10_R1.PacketPlayOutScoreboardTeam) PacketPlayOutScoreboardTeam(net.minecraft.server.v1_10_R1.PacketPlayOutScoreboardTeam) ScoreboardTeam(net.minecraft.server.v1_10_R1.ScoreboardTeam)

Example 3 with PacketPlayOutScoreboardTeam

use of net.minecraft.server.v1_12_R1.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_12_R1.PacketPlayOutScoreboardTeam) PacketPlayOutScoreboardTeam(net.minecraft.server.v1_12_R1.PacketPlayOutScoreboardTeam) ScoreboardTeam(net.minecraft.server.v1_12_R1.ScoreboardTeam)

Example 4 with PacketPlayOutScoreboardTeam

use of net.minecraft.server.v1_12_R1.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_16_R3.PacketPlayOutScoreboardTeam) ScoreboardTeam(net.minecraft.server.v1_16_R3.ScoreboardTeam) PacketPlayOutScoreboardTeam(net.minecraft.server.v1_16_R3.PacketPlayOutScoreboardTeam)

Example 5 with PacketPlayOutScoreboardTeam

use of net.minecraft.server.v1_12_R1.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_15_R1.PacketPlayOutScoreboardTeam) ScoreboardTeam(net.minecraft.server.v1_15_R1.ScoreboardTeam) PacketPlayOutScoreboardTeam(net.minecraft.server.v1_15_R1.PacketPlayOutScoreboardTeam)

Aggregations

PacketPlayOutScoreboardTeam (net.minecraft.server.v1_16_R3.PacketPlayOutScoreboardTeam)2 ScoreboardTeam (net.minecraft.server.v1_16_R3.ScoreboardTeam)2 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 PacketPlayOutScoreboardTeam (net.minecraft.server.v1_12_R1.PacketPlayOutScoreboardTeam)1 ScoreboardTeam (net.minecraft.server.v1_12_R1.ScoreboardTeam)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 PacketPlayOutEntityMetadata (net.minecraft.server.v1_16_R3.PacketPlayOutEntityMetadata)1 PacketPlayOutEntityTeleport (net.minecraft.server.v1_16_R3.PacketPlayOutEntityTeleport)1 PacketPlayOutNamedEntitySpawn (net.minecraft.server.v1_16_R3.PacketPlayOutNamedEntitySpawn)1 PacketPlayOutPlayerInfo (net.minecraft.server.v1_16_R3.PacketPlayOutPlayerInfo)1 PacketPlayOutScoreboardTeam (net.minecraft.server.v1_8_R3.PacketPlayOutScoreboardTeam)1