forked from BLOCKFANTASY/LOOHP-Limbo
Fixed chat packets
This commit is contained in:
parent
081776e4fe
commit
ca186938f4
|
|
@ -435,7 +435,7 @@ public final class Limbo {
|
|||
}
|
||||
|
||||
public KeyedBossBar createBossBar(Key Key, Component name, float progress, BossBar.Color color, BossBar.Overlay overlay, BossBar.Flag... flags) {
|
||||
KeyedBossBar keyedBossBar = new KeyedBossBar(Key, BossBar.bossBar(name, progress, color, overlay, new HashSet<>(Arrays.asList(flags))));
|
||||
KeyedBossBar keyedBossBar = com.loohp.limbo.bossbar.Unsafe.create(Key, BossBar.bossBar(name, progress, color, overlay, new HashSet<>(Arrays.asList(flags))));
|
||||
bossBars.put(Key, keyedBossBar);
|
||||
return keyedBossBar;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,9 +43,7 @@ public class KeyedBossBar {
|
|||
protected final AtomicBoolean valid;
|
||||
private final Unsafe unsafe;
|
||||
|
||||
@SuppressWarnings("DeprecatedIsStillUsed")
|
||||
@Deprecated
|
||||
public KeyedBossBar(Key key, BossBar properties) {
|
||||
KeyedBossBar(Key key, BossBar properties) {
|
||||
this.uuid = UUID.randomUUID();
|
||||
this.key = key;
|
||||
this.properties = properties;
|
||||
|
|
|
|||
|
|
@ -19,10 +19,18 @@
|
|||
|
||||
package com.loohp.limbo.bossbar;
|
||||
|
||||
import net.kyori.adventure.bossbar.BossBar;
|
||||
import net.kyori.adventure.key.Key;
|
||||
|
||||
@SuppressWarnings("DeprecatedIsStillUsed")
|
||||
@Deprecated
|
||||
public class Unsafe {
|
||||
|
||||
@Deprecated
|
||||
public static KeyedBossBar create(Key key, BossBar properties) {
|
||||
return new KeyedBossBar(key, properties);
|
||||
}
|
||||
|
||||
private final KeyedBossBar instance;
|
||||
|
||||
protected Unsafe(KeyedBossBar instance) {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ public enum EquipmentSlot {
|
|||
|
||||
MAINHAND,
|
||||
OFFHAND,
|
||||
HELMENT,
|
||||
HELMET,
|
||||
CHESTPLATE,
|
||||
LEGGINGS,
|
||||
BOOTS;
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@ import java.net.InetAddress;
|
|||
import java.net.Socket;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
|
@ -122,7 +123,6 @@ import java.util.UUID;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class ClientConnection extends Thread {
|
||||
|
||||
|
|
@ -283,7 +283,7 @@ public class ClientConnection extends Thread {
|
|||
return null;
|
||||
}
|
||||
Constructor<?>[] constructors = packetType.getConstructors();
|
||||
Constructor<?> constructor = Stream.of(constructors).filter(each -> each.getParameterCount() > 0 && each.getParameterTypes()[0].equals(DataInputStream.class)).findFirst().orElse(null);
|
||||
Constructor<?> constructor = Arrays.stream(constructors).filter(each -> each.getParameterCount() > 0 && each.getParameterTypes()[0].equals(DataInputStream.class)).findFirst().orElse(null);
|
||||
if (constructor == null) {
|
||||
throw new NoSuchMethodException(packetType + " has no valid constructors!");
|
||||
} else if (constructor.getParameterCount() == 1) {
|
||||
|
|
|
|||
|
|
@ -34,20 +34,18 @@ public class PacketPlayInChat extends PacketIn {
|
|||
private Instant time;
|
||||
private long salt;
|
||||
private MessageSignature signature;
|
||||
private boolean signedPreview;
|
||||
private LastSeenMessages.b lastSeenMessages;
|
||||
|
||||
public PacketPlayInChat(String message, Instant time, long salt, MessageSignature signature, boolean signedPreview, LastSeenMessages.b lastSeenMessages) {
|
||||
public PacketPlayInChat(String message, Instant time, long salt, MessageSignature signature, LastSeenMessages.b lastSeenMessages) {
|
||||
this.message = message;
|
||||
this.time = time;
|
||||
this.salt = salt;
|
||||
this.signature = signature;
|
||||
this.signedPreview = signedPreview;
|
||||
this.lastSeenMessages = lastSeenMessages;
|
||||
}
|
||||
|
||||
public PacketPlayInChat(DataInputStream in) throws IOException {
|
||||
this(DataTypeIO.readString(in, StandardCharsets.UTF_8), Instant.ofEpochMilli(in.readLong()), in.readLong(), new MessageSignature(in), in.readBoolean(), new LastSeenMessages.b(in));
|
||||
this(DataTypeIO.readString(in, StandardCharsets.UTF_8), Instant.ofEpochMilli(in.readLong()), in.readLong(), in.readBoolean() ? new MessageSignature(in) : null, new LastSeenMessages.b(in));
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
|
|
@ -62,10 +60,6 @@ public class PacketPlayInChat extends PacketIn {
|
|||
return signature;
|
||||
}
|
||||
|
||||
public boolean isSignedPreview() {
|
||||
return signedPreview;
|
||||
}
|
||||
|
||||
public long getSalt() {
|
||||
return salt;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,15 +34,13 @@ public class ServerboundChatCommandPacket extends PacketIn {
|
|||
private Instant time;
|
||||
private long salt;
|
||||
private ArgumentSignatures argumentSignatures;
|
||||
private boolean commandPreview;
|
||||
private LastSeenMessages.b lastSeenMessages;
|
||||
|
||||
public ServerboundChatCommandPacket(String command, Instant time, long salt, ArgumentSignatures argumentSignatures, boolean commandPreview, LastSeenMessages.b lastSeenMessages) {
|
||||
public ServerboundChatCommandPacket(String command, Instant time, long salt, ArgumentSignatures argumentSignatures, LastSeenMessages.b lastSeenMessages) {
|
||||
this.command = command;
|
||||
this.time = time;
|
||||
this.salt = salt;
|
||||
this.argumentSignatures = argumentSignatures;
|
||||
this.commandPreview = commandPreview;
|
||||
this.lastSeenMessages = lastSeenMessages;
|
||||
}
|
||||
|
||||
|
|
@ -51,7 +49,6 @@ public class ServerboundChatCommandPacket extends PacketIn {
|
|||
this.time = Instant.ofEpochMilli(in.readLong());
|
||||
this.salt = in.readLong();
|
||||
this.argumentSignatures = new ArgumentSignatures(in);
|
||||
this.commandPreview = in.readBoolean();
|
||||
this.lastSeenMessages = new LastSeenMessages.b(in);
|
||||
}
|
||||
|
||||
|
|
@ -71,10 +68,6 @@ public class ServerboundChatCommandPacket extends PacketIn {
|
|||
return argumentSignatures;
|
||||
}
|
||||
|
||||
public boolean isCommandPreview() {
|
||||
return commandPreview;
|
||||
}
|
||||
|
||||
public LastSeenMessages.b getLastSeenMessages() {
|
||||
return lastSeenMessages;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue