mirror of
https://github.com/ViaVersion/ViaProxy.git
synced 2024-12-04 13:54:37 +01:00
Ensure player UUID is always set
This commit is contained in:
parent
883ac408d1
commit
b4c90a1119
@ -30,6 +30,7 @@ import net.raphimc.netminecraft.packet.impl.login.C2SLoginKeyPacket;
|
|||||||
import net.raphimc.netminecraft.packet.impl.login.S2CLoginGameProfilePacket;
|
import net.raphimc.netminecraft.packet.impl.login.S2CLoginGameProfilePacket;
|
||||||
import net.raphimc.netminecraft.packet.impl.login.S2CLoginHelloPacket;
|
import net.raphimc.netminecraft.packet.impl.login.S2CLoginHelloPacket;
|
||||||
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
||||||
|
import net.raphimc.vialegacy.api.util.UuidUtil;
|
||||||
import net.raphimc.vialegacy.protocol.release.r1_6_4tor1_7_2_5.storage.ProtocolMetadataStorage;
|
import net.raphimc.vialegacy.protocol.release.r1_6_4tor1_7_2_5.storage.ProtocolMetadataStorage;
|
||||||
import net.raphimc.viaproxy.ViaProxy;
|
import net.raphimc.viaproxy.ViaProxy;
|
||||||
import net.raphimc.viaproxy.plugins.events.ClientLoggedInEvent;
|
import net.raphimc.viaproxy.plugins.events.ClientLoggedInEvent;
|
||||||
@ -84,7 +85,7 @@ public class LoginPacketHandler extends PacketHandler {
|
|||||||
if (loginHelloPacket.uuid != null) {
|
if (loginHelloPacket.uuid != null) {
|
||||||
proxyConnection.setGameProfile(new GameProfile(loginHelloPacket.uuid, loginHelloPacket.name));
|
proxyConnection.setGameProfile(new GameProfile(loginHelloPacket.uuid, loginHelloPacket.name));
|
||||||
} else {
|
} else {
|
||||||
proxyConnection.setGameProfile(new GameProfile(null, loginHelloPacket.name));
|
proxyConnection.setGameProfile(new GameProfile(UuidUtil.createOfflinePlayerUuid(loginHelloPacket.name), loginHelloPacket.name));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ViaProxy.getConfig().isProxyOnlineMode() && !ViaProxy.EVENT_MANAGER.call(new ShouldVerifyOnlineModeEvent(this.proxyConnection)).isCancelled()) {
|
if (ViaProxy.getConfig().isProxyOnlineMode() && !ViaProxy.EVENT_MANAGER.call(new ShouldVerifyOnlineModeEvent(this.proxyConnection)).isCancelled()) {
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
package net.raphimc.viaproxy.saves.impl.accounts;
|
package net.raphimc.viaproxy.saves.impl.accounts;
|
||||||
|
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
import net.raphimc.vialegacy.api.util.UuidUtil;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class OfflineAccount extends Account {
|
public class OfflineAccount extends Account {
|
||||||
@ -34,7 +34,7 @@ public class OfflineAccount extends Account {
|
|||||||
|
|
||||||
public OfflineAccount(final String name) {
|
public OfflineAccount(final String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.uuid = UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(StandardCharsets.UTF_8));
|
this.uuid = UuidUtil.createOfflinePlayerUuid(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user