forked from SteamWar/SteamWar
Fix RPlayer skin data
This commit is contained in:
@@ -40,7 +40,6 @@ import java.util.UUID;
|
|||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
@Getter
|
|
||||||
public class RPlayer extends REntity {
|
public class RPlayer extends REntity {
|
||||||
|
|
||||||
private static int skinPartsIndex() {
|
private static int skinPartsIndex() {
|
||||||
@@ -65,7 +64,9 @@ public class RPlayer extends REntity {
|
|||||||
|
|
||||||
private static final Object skinPartsDataWatcher = BountifulWrapper.impl.getDataWatcherObject(skinPartsIndex(), Byte.class);
|
private static final Object skinPartsDataWatcher = BountifulWrapper.impl.getDataWatcherObject(skinPartsIndex(), Byte.class);
|
||||||
|
|
||||||
|
@Getter
|
||||||
private final UUID actualUUID;
|
private final UUID actualUUID;
|
||||||
|
@Getter
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
public RPlayer(REntityServer server, UUID uuid, String name, Location location) {
|
public RPlayer(REntityServer server, UUID uuid, String name, Location location) {
|
||||||
@@ -76,8 +77,8 @@ public class RPlayer extends REntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private GameProfile getGameProfile() {
|
private GameProfile getGameProfile() {
|
||||||
Property skinData = CoreNetworkHandler.SKIN_DATA_PROMISES.computeIfAbsent(uuid, __ -> {
|
Property skinData = CoreNetworkHandler.SKIN_DATA_PROMISES.computeIfAbsent(actualUUID, __ -> {
|
||||||
NetworkSender.sendOrQueue(new PlayerSkinRequestPacket(uuid));
|
NetworkSender.sendOrQueue(new PlayerSkinRequestPacket(actualUUID));
|
||||||
return new Property("textures", null, null);
|
return new Property("textures", null, null);
|
||||||
});
|
});
|
||||||
if (skinData.getValue() != null) {
|
if (skinData.getValue() != null) {
|
||||||
@@ -89,9 +90,12 @@ public class RPlayer extends REntity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private GameProfile saved;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void list(Consumer<Object> packetSink) {
|
void list(Consumer<Object> packetSink) {
|
||||||
packetSink.accept(ProtocolWrapper.impl.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.ADD, getGameProfile(), GameMode.CREATIVE));
|
saved = getGameProfile();
|
||||||
|
packetSink.accept(ProtocolWrapper.impl.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.ADD, saved, GameMode.CREATIVE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -108,7 +112,8 @@ public class RPlayer extends REntity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
void delist(Consumer<Object> packetSink) {
|
void delist(Consumer<Object> packetSink) {
|
||||||
packetSink.accept(ProtocolWrapper.impl.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.REMOVE, getGameProfile(), GameMode.CREATIVE));
|
if (saved == null) saved = getGameProfile();
|
||||||
|
packetSink.accept(ProtocolWrapper.impl.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.REMOVE, saved, GameMode.CREATIVE));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Class<?> namedSpawnPacket = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundAddPlayerPacket");
|
private static final Class<?> namedSpawnPacket = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundAddPlayerPacket");
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public class NetworkSender implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
if (!Bukkit.getOnlinePlayers().isEmpty()) {
|
if (Bukkit.getOnlinePlayers().size() > 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Bukkit.getScheduler().runTaskLater(Core.getInstance(), () -> {
|
Bukkit.getScheduler().runTaskLater(Core.getInstance(), () -> {
|
||||||
|
|||||||
Reference in New Issue
Block a user