remove packet as it is no longer needed
This commit is contained in:
parent
bbd0f84e68
commit
817a962c37
2 changed files with 1 additions and 10 deletions
|
@ -6,11 +6,9 @@ import com.mojang.authlib.properties.Property;
|
||||||
import me.night.nullvalkyrie.enums.MinerType;
|
import me.night.nullvalkyrie.enums.MinerType;
|
||||||
import me.night.nullvalkyrie.util.Skin;
|
import me.night.nullvalkyrie.util.Skin;
|
||||||
import me.night.nullvalkyrie.util.Util;
|
import me.night.nullvalkyrie.util.Util;
|
||||||
import net.minecraft.network.protocol.game.ClientboundPlayerInfoUpdatePacket;
|
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.server.network.ServerGamePacketListenerImpl;
|
|
||||||
import org.apache.commons.codec.binary.Base64;
|
import org.apache.commons.codec.binary.Base64;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
@ -18,7 +16,6 @@ import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.craftbukkit.v1_19_R2.CraftServer;
|
import org.bukkit.craftbukkit.v1_19_R2.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_19_R2.CraftWorld;
|
import org.bukkit.craftbukkit.v1_19_R2.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.v1_19_R2.entity.CraftPlayer;
|
|
||||||
import org.bukkit.entity.ArmorStand;
|
import org.bukkit.entity.ArmorStand;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
@ -140,9 +137,6 @@ public class CryptoMiner {
|
||||||
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
||||||
ServerLevel w = ((CraftWorld) player.getLocation().getWorld()).getHandle();
|
ServerLevel w = ((CraftWorld) player.getLocation().getWorld()).getHandle();
|
||||||
ServerPlayer miner = new ServerPlayer(server, w, gameProfile);
|
ServerPlayer miner = new ServerPlayer(server, w, gameProfile);
|
||||||
// TODO: fixing could not add to tab list
|
|
||||||
ServerGamePacketListenerImpl pc = ((CraftPlayer) player).getHandle().connection;
|
|
||||||
pc.send(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, miner));
|
|
||||||
World world = miner.getBukkitEntity().getWorld();
|
World world = miner.getBukkitEntity().getWorld();
|
||||||
List<Location> locs = new ArrayList<>();
|
List<Location> locs = new ArrayList<>();
|
||||||
for (int x = (int) stand.getLocation().getX() - 3; x <= stand.getLocation().getX() + 2; x++) {
|
for (int x = (int) stand.getLocation().getX() - 3; x <= stand.getLocation().getX() + 2; x++) {
|
||||||
|
@ -156,9 +150,8 @@ public class CryptoMiner {
|
||||||
locs.remove(world.getBlockAt(stand.getLocation().subtract(0, -1, 0)).getLocation());
|
locs.remove(world.getBlockAt(stand.getLocation().subtract(0, -1, 0)).getLocation());
|
||||||
if (locs.size() != 0) {
|
if (locs.size() != 0) {
|
||||||
Location closest = locs.get(0);
|
Location closest = locs.get(0);
|
||||||
for (Location location : locs) {
|
for (Location location : locs)
|
||||||
if (location.distance(stand.getLocation()) < closest.distance(stand.getLocation())) closest = location;
|
if (location.distance(stand.getLocation()) < closest.distance(stand.getLocation())) closest = location;
|
||||||
}
|
|
||||||
ArrayList<ItemStack> items = new ArrayList<>();
|
ArrayList<ItemStack> items = new ArrayList<>();
|
||||||
ThreadLocalRandom random = ThreadLocalRandom.current();
|
ThreadLocalRandom random = ThreadLocalRandom.current();
|
||||||
if (closest.getBlock().getType() == this.getType()) {
|
if (closest.getBlock().getType() == this.getType()) {
|
||||||
|
|
|
@ -51,7 +51,6 @@ public class NPCManager {
|
||||||
public static void addNPCPacket(ServerPlayer npc) {
|
public static void addNPCPacket(ServerPlayer npc) {
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
ServerGamePacketListenerImpl pc = ((CraftPlayer) player).getHandle().connection;
|
ServerGamePacketListenerImpl pc = ((CraftPlayer) player).getHandle().connection;
|
||||||
pc.send(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, npc));
|
|
||||||
pc.send(new ClientboundAddPlayerPacket(npc));
|
pc.send(new ClientboundAddPlayerPacket(npc));
|
||||||
pc.send(new ClientboundRotateHeadPacket(npc, (byte) (npc.getBukkitYaw() * 256 / 360)));
|
pc.send(new ClientboundRotateHeadPacket(npc, (byte) (npc.getBukkitYaw() * 256 / 360)));
|
||||||
SynchedEntityData watcher = npc.getEntityData();
|
SynchedEntityData watcher = npc.getEntityData();
|
||||||
|
@ -71,7 +70,6 @@ public class NPCManager {
|
||||||
public static void addJoinPacket(Player player) {
|
public static void addJoinPacket(Player player) {
|
||||||
for (ServerPlayer npc : NPCs) {
|
for (ServerPlayer npc : NPCs) {
|
||||||
ServerGamePacketListenerImpl pc = ((CraftPlayer) player).getHandle().connection;
|
ServerGamePacketListenerImpl pc = ((CraftPlayer) player).getHandle().connection;
|
||||||
pc.send(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, npc));
|
|
||||||
pc.send(new ClientboundAddPlayerPacket(npc));
|
pc.send(new ClientboundAddPlayerPacket(npc));
|
||||||
pc.send(new ClientboundRotateHeadPacket(npc, (byte) (npc.getBukkitYaw() * 256 / 360)));
|
pc.send(new ClientboundRotateHeadPacket(npc, (byte) (npc.getBukkitYaw() * 256 / 360)));
|
||||||
SynchedEntityData watcher = npc.getEntityData();
|
SynchedEntityData watcher = npc.getEntityData();
|
||||||
|
|
Loading…
Reference in a new issue