forked from BLOCKFANTASY/LOOHP-Limbo
Minecraft 1.19.4
This commit is contained in:
@@ -99,10 +99,14 @@ public class Channel implements AutoCloseable {
|
||||
}
|
||||
packet = write.getPacket();
|
||||
byte[] packetByte = packet.serializePacket();
|
||||
writePacketRaw(packetByte);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void writePacketRaw(byte[] packetByte) throws IOException {
|
||||
DataTypeIO.writeVarInt(output, packetByte.length);
|
||||
output.write(packetByte);
|
||||
output.flush();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -404,12 +404,12 @@ public class ClientConnection extends Thread {
|
||||
int state = 0;
|
||||
for (int i = 0; i < data.length; i++) {
|
||||
if (!properties.isReducedDebugInfo()) {
|
||||
Limbo.getInstance().getConsole().sendMessage(String.valueOf(i) + ": " + data[i]);
|
||||
Limbo.getInstance().getConsole().sendMessage(i + ": " + data[i]);
|
||||
}
|
||||
|
||||
switch (state) {
|
||||
default:
|
||||
Limbo.getInstance().getConsole().sendMessage(String.valueOf(i) + ": ignore data: State: " + String.valueOf(state));
|
||||
Limbo.getInstance().getConsole().sendMessage(i + ": ignore data: State: " + state);
|
||||
break;
|
||||
case 0:
|
||||
host = data[i];
|
||||
@@ -437,7 +437,7 @@ public class ClientConnection extends Thread {
|
||||
}
|
||||
}
|
||||
if (state != 6) {
|
||||
throw new IllegalStateException("Illegal bungee state: " + String.valueOf(state));
|
||||
throw new IllegalStateException("Illegal bungee state: " + state);
|
||||
}
|
||||
|
||||
if (!properties.isReducedDebugInfo()) {
|
||||
@@ -580,12 +580,12 @@ public class ClientConnection extends Thread {
|
||||
ByteArrayOutputStream brandOut = new ByteArrayOutputStream();
|
||||
DataTypeIO.writeString(new DataOutputStream(brandOut), properties.getServerModName(), StandardCharsets.UTF_8);
|
||||
sendPluginMessage(BRAND_ANNOUNCE_CHANNEL, brandOut.toByteArray());
|
||||
|
||||
|
||||
SkinResponse skinresponce = (isVelocityModern || isBungeeGuard || isBungeecord) && forwardedSkin != null ? forwardedSkin : MojangAPIUtils.getSkinFromMojangServer(player.getName());
|
||||
PlayerSkinProperty skin = skinresponce != null ? new PlayerSkinProperty(skinresponce.getSkin(), skinresponce.getSignature()) : null;
|
||||
PacketPlayOutPlayerInfo info = new PacketPlayOutPlayerInfo(EnumSet.of(PlayerInfoAction.ADD_PLAYER, PlayerInfoAction.UPDATE_GAME_MODE, PlayerInfoAction.UPDATE_LISTED, PlayerInfoAction.UPDATE_LATENCY, PlayerInfoAction.UPDATE_DISPLAY_NAME), player.getUniqueId(), new PlayerInfoData.PlayerInfoDataAddPlayer(player.getName(), true, Optional.ofNullable(skin), properties.getDefaultGamemode(), 0, false, Optional.empty()));
|
||||
sendPacket(info);
|
||||
|
||||
|
||||
Set<PlayerAbilityFlags> flags = new HashSet<>();
|
||||
if (properties.isAllowFlight()) {
|
||||
flags.add(PlayerAbilityFlags.FLY);
|
||||
@@ -598,21 +598,21 @@ public class ClientConnection extends Thread {
|
||||
|
||||
String str = (properties.isLogPlayerIPAddresses() ? inetAddress.getHostName() : "<ip address withheld>") + ":" + clientSocket.getPort() + "|" + player.getName() + "(" + player.getUniqueId() + ")";
|
||||
Limbo.getInstance().getConsole().sendMessage("[/" + str + "] <-> Player had connected to the Limbo server!");
|
||||
|
||||
|
||||
player.playerInteractManager.update();
|
||||
|
||||
|
||||
PacketPlayOutDeclareCommands declare = DeclareCommands.getDeclareCommandsPacket(player);
|
||||
if (declare != null) {
|
||||
sendPacket(declare);
|
||||
}
|
||||
|
||||
|
||||
PacketPlayOutSpawnPosition spawnPos = new PacketPlayOutSpawnPosition(BlockPosition.from(worldSpawn), worldSpawn.getPitch());
|
||||
sendPacket(spawnPos);
|
||||
|
||||
PacketPlayOutPositionAndLook positionLook = new PacketPlayOutPositionAndLook(worldSpawn.getX(), worldSpawn.getY(), worldSpawn.getZ(), worldSpawn.getYaw(), worldSpawn.getPitch(), 1, false);
|
||||
|
||||
PacketPlayOutPositionAndLook positionLook = new PacketPlayOutPositionAndLook(worldSpawn.getX(), worldSpawn.getY(), worldSpawn.getZ(), worldSpawn.getYaw(), worldSpawn.getPitch(), 1);
|
||||
Limbo.getInstance().getUnsafe().a(player, new Location(world, worldSpawn.getX(), worldSpawn.getY(), worldSpawn.getZ(), worldSpawn.getYaw(), worldSpawn.getPitch()));
|
||||
sendPacket(positionLook);
|
||||
|
||||
|
||||
player.getDataWatcher().update();
|
||||
PacketPlayOutEntityMetadata show = new PacketPlayOutEntityMetadata(player, false, Player.class.getDeclaredField("skinLayers"));
|
||||
sendPacket(show);
|
||||
@@ -667,14 +667,14 @@ public class ClientConnection extends Thread {
|
||||
CheckedBiConsumer<PlayerMoveEvent, Location, IOException> processMoveEvent = (event, originalTo) -> {
|
||||
if (event.isCancelled()) {
|
||||
Location returnTo = event.getFrom();
|
||||
PacketPlayOutPositionAndLook cancel = new PacketPlayOutPositionAndLook(returnTo.getX(), returnTo.getY(), returnTo.getZ(), returnTo.getYaw(), returnTo.getPitch(), 1, false);
|
||||
PacketPlayOutPositionAndLook cancel = new PacketPlayOutPositionAndLook(returnTo.getX(), returnTo.getY(), returnTo.getZ(), returnTo.getYaw(), returnTo.getPitch(), 1);
|
||||
sendPacket(cancel);
|
||||
} else {
|
||||
Location to = event.getTo();
|
||||
Limbo.getInstance().getUnsafe().a(player, to);
|
||||
// If an event handler used setTo, let's make sure we tell the player about it.
|
||||
if (!originalTo.equals(to)) {
|
||||
PacketPlayOutPositionAndLook pos = new PacketPlayOutPositionAndLook(to.getX(), to.getY(), to.getZ(), to.getYaw(), to.getPitch(), 1, false);
|
||||
PacketPlayOutPositionAndLook pos = new PacketPlayOutPositionAndLook(to.getX(), to.getY(), to.getZ(), to.getYaw(), to.getPitch(), 1);
|
||||
sendPacket(pos);
|
||||
}
|
||||
PacketPlayOutUpdateViewPosition response = new PacketPlayOutUpdateViewPosition((int) player.getLocation().getX() >> 4, (int) player.getLocation().getZ() >> 4);
|
||||
|
||||
+2
-2
@@ -70,9 +70,9 @@ public class PacketPlayOutPlayerAbilities extends PacketOut {
|
||||
|
||||
DataOutputStream output = new DataOutputStream(buffer);
|
||||
output.writeByte(Packet.getPlayOut().get(getClass()));
|
||||
int value = 0;
|
||||
byte value = 0;
|
||||
for (PlayerAbilityFlags flag : flags) {
|
||||
value = value | flag.getValue();
|
||||
value = (byte) (value | flag.getValue());
|
||||
}
|
||||
|
||||
output.writeByte(value);
|
||||
|
||||
+1
-8
@@ -55,9 +55,8 @@ public class PacketPlayOutPositionAndLook extends PacketOut {
|
||||
private float pitch;
|
||||
private Set<PlayerTeleportFlags> flags;
|
||||
private int teleportId;
|
||||
private boolean dismountVehicle;
|
||||
|
||||
public PacketPlayOutPositionAndLook(double x, double y, double z, float yaw, float pitch, int teleportId, boolean dismountVehicle, PlayerTeleportFlags... flags) {
|
||||
public PacketPlayOutPositionAndLook(double x, double y, double z, float yaw, float pitch, int teleportId, PlayerTeleportFlags... flags) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
@@ -65,7 +64,6 @@ public class PacketPlayOutPositionAndLook extends PacketOut {
|
||||
this.pitch = pitch;
|
||||
this.teleportId = teleportId;
|
||||
this.flags = new HashSet<>(Arrays.asList(flags));
|
||||
this.dismountVehicle = dismountVehicle;
|
||||
}
|
||||
|
||||
public double getX() {
|
||||
@@ -96,10 +94,6 @@ public class PacketPlayOutPositionAndLook extends PacketOut {
|
||||
return teleportId;
|
||||
}
|
||||
|
||||
public boolean isDismountVehicle() {
|
||||
return dismountVehicle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] serializePacket() throws IOException {
|
||||
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
||||
@@ -119,7 +113,6 @@ public class PacketPlayOutPositionAndLook extends PacketOut {
|
||||
|
||||
output.writeByte(flag);
|
||||
DataTypeIO.writeVarInt(output, teleportId);
|
||||
output.writeBoolean(dismountVehicle);
|
||||
|
||||
return buffer.toByteArray();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user