mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-06 08:27:43 +01:00
Fixed SerializableData#clone
This commit is contained in:
parent
c5b83f1054
commit
151dedca99
@ -1,5 +1,6 @@
|
||||
package net.minestom.server.chat;
|
||||
|
||||
|
||||
import net.kyori.text.Component;
|
||||
import net.kyori.text.serializer.gson.GsonComponentSerializer;
|
||||
import net.kyori.text.serializer.legacy.LegacyComponentSerializer;
|
||||
|
@ -28,9 +28,10 @@ public class SerializableData extends Data {
|
||||
|
||||
@Override
|
||||
public Data clone() {
|
||||
SerializableData cloned = (SerializableData) super.clone();
|
||||
cloned.dataType = new ConcurrentHashMap<>(dataType);
|
||||
return super.clone();
|
||||
SerializableData data = new SerializableData();
|
||||
data.data = new ConcurrentHashMap<>(this.data);
|
||||
data.dataType = new ConcurrentHashMap<>(dataType);
|
||||
return data;
|
||||
}
|
||||
|
||||
public byte[] getSerializedData() throws IOException {
|
||||
|
@ -17,13 +17,16 @@ import java.util.UUID;
|
||||
|
||||
public class LoginStartPacket implements ClientPreplayPacket {
|
||||
|
||||
private static final String ALREADY_CONNECTED_JSON =
|
||||
ColoredText.of(ChatColor.RED, "You are already on this server").toString();
|
||||
|
||||
public String username;
|
||||
|
||||
@Override
|
||||
public void process(PlayerConnection connection, ConnectionManager connectionManager) {
|
||||
if (MojangAuth.isUsingMojangAuth()) {
|
||||
if (connectionManager.getPlayer(username) != null) {
|
||||
connection.sendPacket(new LoginDisconnect(ColoredText.of(ChatColor.RED, "You are already on this server").toString()));
|
||||
connection.sendPacket(new LoginDisconnect(ALREADY_CONNECTED_JSON));
|
||||
connection.disconnect();
|
||||
return;
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ public class EntityEquipmentPacket implements ServerPacket {
|
||||
@Override
|
||||
public void write(PacketWriter writer) {
|
||||
writer.writeVarInt(entityId);
|
||||
// TODO multiple equipments
|
||||
writer.writeByte((byte) slot.ordinal());
|
||||
writer.writeItemStack(itemStack);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user