mirror of
https://github.com/songoda/SongodaCore.git
synced 2025-01-23 16:01:21 +01:00
feat: Add NMSPlayer#getProfile(Player) method to get the GameProfile
This commit is contained in:
parent
157150a2f1
commit
9aad7f63f3
@ -1,7 +1,10 @@
|
||||
package com.craftaro.core.nms.entity;
|
||||
|
||||
import com.craftaro.core.nms.entity.player.GameProfile;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public interface NMSPlayer {
|
||||
void sendPacket(Player p, Object packet);
|
||||
|
||||
GameProfile getProfile(Player p);
|
||||
}
|
||||
|
@ -0,0 +1,52 @@
|
||||
package com.craftaro.core.nms.entity.player;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
public class GameProfile {
|
||||
private final Object mojangGameProfile;
|
||||
|
||||
private final UUID id;
|
||||
private final String name;
|
||||
private final String textureValue;
|
||||
private final String textureSignature;
|
||||
|
||||
public GameProfile(
|
||||
Object mojangGameProfile,
|
||||
|
||||
UUID id,
|
||||
String name,
|
||||
@Nullable String textureValue,
|
||||
@Nullable String textureSignature
|
||||
) {
|
||||
this.mojangGameProfile = Objects.requireNonNull(mojangGameProfile);
|
||||
|
||||
this.id = Objects.requireNonNull(id);
|
||||
this.name = Objects.requireNonNull(name);
|
||||
this.textureValue = textureValue;
|
||||
this.textureSignature = textureSignature;
|
||||
}
|
||||
|
||||
public Object getMojangGameProfile() {
|
||||
return this.mojangGameProfile;
|
||||
}
|
||||
|
||||
public @NotNull UUID getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public @NotNull String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public @Nullable String getTextureValue() {
|
||||
return this.textureValue;
|
||||
}
|
||||
|
||||
public @Nullable String getTextureSignature() {
|
||||
return this.textureSignature;
|
||||
}
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
package com.craftaro.core.nms.v1_10_R1.entity;
|
||||
|
||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||
import com.craftaro.core.nms.entity.player.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import net.minecraft.server.v1_10_R1.Packet;
|
||||
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -10,4 +12,26 @@ public class NMSPlayerImpl implements NMSPlayer {
|
||||
public void sendPacket(Player p, Object packet) {
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket((Packet<?>) packet);
|
||||
}
|
||||
|
||||
public GameProfile getProfile(Player p) {
|
||||
com.mojang.authlib.GameProfile profile = ((CraftPlayer) p).getHandle().getProfile();
|
||||
|
||||
String textureValue = null;
|
||||
String textureSignature = null;
|
||||
for (Property property : profile.getProperties().get("textures")) {
|
||||
if (property.getName().equals("SKIN")) {
|
||||
textureValue = property.getValue();
|
||||
textureSignature = property.getSignature();
|
||||
}
|
||||
}
|
||||
|
||||
return new GameProfile(
|
||||
profile,
|
||||
|
||||
profile.getId(),
|
||||
profile.getName(),
|
||||
textureValue,
|
||||
textureSignature
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.craftaro.core.nms.v1_11_R1.entity;
|
||||
|
||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||
import com.craftaro.core.nms.entity.player.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import net.minecraft.server.v1_11_R1.Packet;
|
||||
import org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -10,4 +12,26 @@ public class NMSPlayerImpl implements NMSPlayer {
|
||||
public void sendPacket(Player p, Object packet) {
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket((Packet<?>) packet);
|
||||
}
|
||||
|
||||
public GameProfile getProfile(Player p) {
|
||||
com.mojang.authlib.GameProfile profile = ((CraftPlayer) p).getHandle().getProfile();
|
||||
|
||||
String textureValue = null;
|
||||
String textureSignature = null;
|
||||
for (Property property : profile.getProperties().get("textures")) {
|
||||
if (property.getName().equals("SKIN")) {
|
||||
textureValue = property.getValue();
|
||||
textureSignature = property.getSignature();
|
||||
}
|
||||
}
|
||||
|
||||
return new GameProfile(
|
||||
profile,
|
||||
|
||||
profile.getId(),
|
||||
profile.getName(),
|
||||
textureValue,
|
||||
textureSignature
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.craftaro.core.nms.v1_12_R1.entity;
|
||||
|
||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||
import com.craftaro.core.nms.entity.player.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import net.minecraft.server.v1_12_R1.Packet;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -10,4 +12,26 @@ public class NMSPlayerImpl implements NMSPlayer {
|
||||
public void sendPacket(Player p, Object packet) {
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket((Packet<?>) packet);
|
||||
}
|
||||
|
||||
public GameProfile getProfile(Player p) {
|
||||
com.mojang.authlib.GameProfile profile = ((CraftPlayer) p).getHandle().getProfile();
|
||||
|
||||
String textureValue = null;
|
||||
String textureSignature = null;
|
||||
for (Property property : profile.getProperties().get("textures")) {
|
||||
if (property.getName().equals("SKIN")) {
|
||||
textureValue = property.getValue();
|
||||
textureSignature = property.getSignature();
|
||||
}
|
||||
}
|
||||
|
||||
return new GameProfile(
|
||||
profile,
|
||||
|
||||
profile.getId(),
|
||||
profile.getName(),
|
||||
textureValue,
|
||||
textureSignature
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.craftaro.core.nms.v1_13_R1.entity;
|
||||
|
||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||
import com.craftaro.core.nms.entity.player.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import net.minecraft.server.v1_13_R1.Packet;
|
||||
import org.bukkit.craftbukkit.v1_13_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -10,4 +12,26 @@ public class NMSPlayerImpl implements NMSPlayer {
|
||||
public void sendPacket(Player p, Object packet) {
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket((Packet<?>) packet);
|
||||
}
|
||||
|
||||
public GameProfile getProfile(Player p) {
|
||||
com.mojang.authlib.GameProfile profile = ((CraftPlayer) p).getHandle().getProfile();
|
||||
|
||||
String textureValue = null;
|
||||
String textureSignature = null;
|
||||
for (Property property : profile.getProperties().get("textures")) {
|
||||
if (property.getName().equals("SKIN")) {
|
||||
textureValue = property.getValue();
|
||||
textureSignature = property.getSignature();
|
||||
}
|
||||
}
|
||||
|
||||
return new GameProfile(
|
||||
profile,
|
||||
|
||||
profile.getId(),
|
||||
profile.getName(),
|
||||
textureValue,
|
||||
textureSignature
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.craftaro.core.nms.v1_13_R2.entity;
|
||||
|
||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||
import com.craftaro.core.nms.entity.player.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import net.minecraft.server.v1_13_R2.Packet;
|
||||
import org.bukkit.craftbukkit.v1_13_R2.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -10,4 +12,26 @@ public class NMSPlayerImpl implements NMSPlayer {
|
||||
public void sendPacket(Player p, Object packet) {
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket((Packet<?>) packet);
|
||||
}
|
||||
|
||||
public GameProfile getProfile(Player p) {
|
||||
com.mojang.authlib.GameProfile profile = ((CraftPlayer) p).getHandle().getProfile();
|
||||
|
||||
String textureValue = null;
|
||||
String textureSignature = null;
|
||||
for (Property property : profile.getProperties().get("textures")) {
|
||||
if (property.getName().equals("SKIN")) {
|
||||
textureValue = property.getValue();
|
||||
textureSignature = property.getSignature();
|
||||
}
|
||||
}
|
||||
|
||||
return new GameProfile(
|
||||
profile,
|
||||
|
||||
profile.getId(),
|
||||
profile.getName(),
|
||||
textureValue,
|
||||
textureSignature
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.craftaro.core.nms.v1_14_R1.entity;
|
||||
|
||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||
import com.craftaro.core.nms.entity.player.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import net.minecraft.server.v1_14_R1.Packet;
|
||||
import org.bukkit.craftbukkit.v1_14_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -10,4 +12,26 @@ public class NMSPlayerImpl implements NMSPlayer {
|
||||
public void sendPacket(Player p, Object packet) {
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket((Packet<?>) packet);
|
||||
}
|
||||
|
||||
public GameProfile getProfile(Player p) {
|
||||
com.mojang.authlib.GameProfile profile = ((CraftPlayer) p).getHandle().getProfile();
|
||||
|
||||
String textureValue = null;
|
||||
String textureSignature = null;
|
||||
for (Property property : profile.getProperties().get("textures")) {
|
||||
if (property.getName().equals("SKIN")) {
|
||||
textureValue = property.getValue();
|
||||
textureSignature = property.getSignature();
|
||||
}
|
||||
}
|
||||
|
||||
return new GameProfile(
|
||||
profile,
|
||||
|
||||
profile.getId(),
|
||||
profile.getName(),
|
||||
textureValue,
|
||||
textureSignature
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.craftaro.core.nms.v1_15_R1.entity;
|
||||
|
||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||
import com.craftaro.core.nms.entity.player.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import net.minecraft.server.v1_15_R1.Packet;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -10,4 +12,26 @@ public class NMSPlayerImpl implements NMSPlayer {
|
||||
public void sendPacket(Player p, Object packet) {
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket((Packet<?>) packet);
|
||||
}
|
||||
|
||||
public GameProfile getProfile(Player p) {
|
||||
com.mojang.authlib.GameProfile profile = ((CraftPlayer) p).getHandle().getProfile();
|
||||
|
||||
String textureValue = null;
|
||||
String textureSignature = null;
|
||||
for (Property property : profile.getProperties().get("textures")) {
|
||||
if (property.getName().equals("SKIN")) {
|
||||
textureValue = property.getValue();
|
||||
textureSignature = property.getSignature();
|
||||
}
|
||||
}
|
||||
|
||||
return new GameProfile(
|
||||
profile,
|
||||
|
||||
profile.getId(),
|
||||
profile.getName(),
|
||||
textureValue,
|
||||
textureSignature
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.craftaro.core.nms.v1_16_R1.entity;
|
||||
|
||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||
import com.craftaro.core.nms.entity.player.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import net.minecraft.server.v1_16_R1.Packet;
|
||||
import org.bukkit.craftbukkit.v1_16_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -10,4 +12,26 @@ public class NMSPlayerImpl implements NMSPlayer {
|
||||
public void sendPacket(Player p, Object packet) {
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket((Packet<?>) packet);
|
||||
}
|
||||
|
||||
public GameProfile getProfile(Player p) {
|
||||
com.mojang.authlib.GameProfile profile = ((CraftPlayer) p).getHandle().getProfile();
|
||||
|
||||
String textureValue = null;
|
||||
String textureSignature = null;
|
||||
for (Property property : profile.getProperties().get("textures")) {
|
||||
if (property.getName().equals("SKIN")) {
|
||||
textureValue = property.getValue();
|
||||
textureSignature = property.getSignature();
|
||||
}
|
||||
}
|
||||
|
||||
return new GameProfile(
|
||||
profile,
|
||||
|
||||
profile.getId(),
|
||||
profile.getName(),
|
||||
textureValue,
|
||||
textureSignature
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.craftaro.core.nms.v1_16_R2.entity;
|
||||
|
||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||
import com.craftaro.core.nms.entity.player.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import net.minecraft.server.v1_16_R2.Packet;
|
||||
import org.bukkit.craftbukkit.v1_16_R2.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -10,4 +12,26 @@ public class NMSPlayerImpl implements NMSPlayer {
|
||||
public void sendPacket(Player p, Object packet) {
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket((Packet<?>) packet);
|
||||
}
|
||||
|
||||
public GameProfile getProfile(Player p) {
|
||||
com.mojang.authlib.GameProfile profile = ((CraftPlayer) p).getHandle().getProfile();
|
||||
|
||||
String textureValue = null;
|
||||
String textureSignature = null;
|
||||
for (Property property : profile.getProperties().get("textures")) {
|
||||
if (property.getName().equals("SKIN")) {
|
||||
textureValue = property.getValue();
|
||||
textureSignature = property.getSignature();
|
||||
}
|
||||
}
|
||||
|
||||
return new GameProfile(
|
||||
profile,
|
||||
|
||||
profile.getId(),
|
||||
profile.getName(),
|
||||
textureValue,
|
||||
textureSignature
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.craftaro.core.nms.v1_16_R3.entity;
|
||||
|
||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||
import com.craftaro.core.nms.entity.player.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import net.minecraft.server.v1_16_R3.Packet;
|
||||
import org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -10,4 +12,26 @@ public class NMSPlayerImpl implements NMSPlayer {
|
||||
public void sendPacket(Player p, Object packet) {
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket((Packet<?>) packet);
|
||||
}
|
||||
|
||||
public GameProfile getProfile(Player p) {
|
||||
com.mojang.authlib.GameProfile profile = ((CraftPlayer) p).getHandle().getProfile();
|
||||
|
||||
String textureValue = null;
|
||||
String textureSignature = null;
|
||||
for (Property property : profile.getProperties().get("textures")) {
|
||||
if (property.getName().equals("SKIN")) {
|
||||
textureValue = property.getValue();
|
||||
textureSignature = property.getSignature();
|
||||
}
|
||||
}
|
||||
|
||||
return new GameProfile(
|
||||
profile,
|
||||
|
||||
profile.getId(),
|
||||
profile.getName(),
|
||||
textureValue,
|
||||
textureSignature
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.craftaro.core.nms.v1_17_R1.entity;
|
||||
|
||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||
import com.craftaro.core.nms.entity.player.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -10,4 +12,26 @@ public class NMSPlayerImpl implements NMSPlayer {
|
||||
public void sendPacket(Player p, Object packet) {
|
||||
((CraftPlayer) p).getHandle().b.sendPacket((Packet<?>) packet);
|
||||
}
|
||||
|
||||
public GameProfile getProfile(Player p) {
|
||||
com.mojang.authlib.GameProfile profile = ((CraftPlayer) p).getHandle().getProfile();
|
||||
|
||||
String textureValue = null;
|
||||
String textureSignature = null;
|
||||
for (Property property : profile.getProperties().get("textures")) {
|
||||
if (property.getName().equals("SKIN")) {
|
||||
textureValue = property.getValue();
|
||||
textureSignature = property.getSignature();
|
||||
}
|
||||
}
|
||||
|
||||
return new GameProfile(
|
||||
profile,
|
||||
|
||||
profile.getId(),
|
||||
profile.getName(),
|
||||
textureValue,
|
||||
textureSignature
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.craftaro.core.nms.v1_18_R1.entity;
|
||||
|
||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||
import com.craftaro.core.nms.entity.player.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -10,4 +12,26 @@ public class NMSPlayerImpl implements NMSPlayer {
|
||||
public void sendPacket(Player p, Object packet) {
|
||||
((CraftPlayer) p).getHandle().connection.send((Packet<?>) packet);
|
||||
}
|
||||
|
||||
public GameProfile getProfile(Player p) {
|
||||
com.mojang.authlib.GameProfile profile = ((CraftPlayer) p).getHandle().getGameProfile();
|
||||
|
||||
String textureValue = null;
|
||||
String textureSignature = null;
|
||||
for (Property property : profile.getProperties().get("textures")) {
|
||||
if (property.getName().equals("SKIN")) {
|
||||
textureValue = property.getValue();
|
||||
textureSignature = property.getSignature();
|
||||
}
|
||||
}
|
||||
|
||||
return new GameProfile(
|
||||
profile,
|
||||
|
||||
profile.getId(),
|
||||
profile.getName(),
|
||||
textureValue,
|
||||
textureSignature
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.craftaro.core.nms.v1_18_R2.entity;
|
||||
|
||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||
import com.craftaro.core.nms.entity.player.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import org.bukkit.craftbukkit.v1_18_R2.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -10,4 +12,26 @@ public class NMSPlayerImpl implements NMSPlayer {
|
||||
public void sendPacket(Player p, Object packet) {
|
||||
((CraftPlayer) p).getHandle().connection.send((Packet<?>) packet);
|
||||
}
|
||||
|
||||
public GameProfile getProfile(Player p) {
|
||||
com.mojang.authlib.GameProfile profile = ((CraftPlayer) p).getHandle().getGameProfile();
|
||||
|
||||
String textureValue = null;
|
||||
String textureSignature = null;
|
||||
for (Property property : profile.getProperties().get("textures")) {
|
||||
if (property.getName().equals("SKIN")) {
|
||||
textureValue = property.getValue();
|
||||
textureSignature = property.getSignature();
|
||||
}
|
||||
}
|
||||
|
||||
return new GameProfile(
|
||||
profile,
|
||||
|
||||
profile.getId(),
|
||||
profile.getName(),
|
||||
textureValue,
|
||||
textureSignature
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.craftaro.core.nms.v1_19_0.entity;
|
||||
|
||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||
import com.craftaro.core.nms.entity.player.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -10,4 +12,26 @@ public class NMSPlayerImpl implements NMSPlayer {
|
||||
public void sendPacket(Player p, Object packet) {
|
||||
((CraftPlayer) p).getHandle().connection.send((Packet<?>) packet);
|
||||
}
|
||||
|
||||
public GameProfile getProfile(Player p) {
|
||||
com.mojang.authlib.GameProfile profile = ((CraftPlayer) p).getHandle().getGameProfile();
|
||||
|
||||
String textureValue = null;
|
||||
String textureSignature = null;
|
||||
for (Property property : profile.getProperties().get("textures")) {
|
||||
if (property.getName().equals("SKIN")) {
|
||||
textureValue = property.getValue();
|
||||
textureSignature = property.getSignature();
|
||||
}
|
||||
}
|
||||
|
||||
return new GameProfile(
|
||||
profile,
|
||||
|
||||
profile.getId(),
|
||||
profile.getName(),
|
||||
textureValue,
|
||||
textureSignature
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.craftaro.core.nms.v1_19_R1.entity;
|
||||
|
||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||
import com.craftaro.core.nms.entity.player.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -10,4 +12,26 @@ public class NMSPlayerImpl implements NMSPlayer {
|
||||
public void sendPacket(Player p, Object packet) {
|
||||
((CraftPlayer) p).getHandle().connection.send((Packet<?>) packet);
|
||||
}
|
||||
|
||||
public GameProfile getProfile(Player p) {
|
||||
com.mojang.authlib.GameProfile profile = ((CraftPlayer) p).getHandle().getGameProfile();
|
||||
|
||||
String textureValue = null;
|
||||
String textureSignature = null;
|
||||
for (Property property : profile.getProperties().get("textures")) {
|
||||
if (property.getName().equals("SKIN")) {
|
||||
textureValue = property.getValue();
|
||||
textureSignature = property.getSignature();
|
||||
}
|
||||
}
|
||||
|
||||
return new GameProfile(
|
||||
profile,
|
||||
|
||||
profile.getId(),
|
||||
profile.getName(),
|
||||
textureValue,
|
||||
textureSignature
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.craftaro.core.nms.v1_19_R2.entity;
|
||||
|
||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||
import com.craftaro.core.nms.entity.player.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import org.bukkit.craftbukkit.v1_19_R2.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -10,4 +12,26 @@ public class NMSPlayerImpl implements NMSPlayer {
|
||||
public void sendPacket(Player p, Object packet) {
|
||||
((CraftPlayer) p).getHandle().connection.send((Packet<?>) packet);
|
||||
}
|
||||
|
||||
public GameProfile getProfile(Player p) {
|
||||
com.mojang.authlib.GameProfile profile = ((CraftPlayer) p).getHandle().getGameProfile();
|
||||
|
||||
String textureValue = null;
|
||||
String textureSignature = null;
|
||||
for (Property property : profile.getProperties().get("textures")) {
|
||||
if (property.getName().equals("SKIN")) {
|
||||
textureValue = property.getValue();
|
||||
textureSignature = property.getSignature();
|
||||
}
|
||||
}
|
||||
|
||||
return new GameProfile(
|
||||
profile,
|
||||
|
||||
profile.getId(),
|
||||
profile.getName(),
|
||||
textureValue,
|
||||
textureSignature
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.craftaro.core.nms.v1_19_R3.entity;
|
||||
|
||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||
import com.craftaro.core.nms.entity.player.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import org.bukkit.craftbukkit.v1_19_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -10,4 +12,26 @@ public class NMSPlayerImpl implements NMSPlayer {
|
||||
public void sendPacket(Player p, Object packet) {
|
||||
((CraftPlayer) p).getHandle().connection.send((Packet<?>) packet);
|
||||
}
|
||||
|
||||
public GameProfile getProfile(Player p) {
|
||||
com.mojang.authlib.GameProfile profile = ((CraftPlayer) p).getHandle().getGameProfile();
|
||||
|
||||
String textureValue = null;
|
||||
String textureSignature = null;
|
||||
for (Property property : profile.getProperties().get("textures")) {
|
||||
if (property.getName().equals("SKIN")) {
|
||||
textureValue = property.getValue();
|
||||
textureSignature = property.getSignature();
|
||||
}
|
||||
}
|
||||
|
||||
return new GameProfile(
|
||||
profile,
|
||||
|
||||
profile.getId(),
|
||||
profile.getName(),
|
||||
textureValue,
|
||||
textureSignature
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.craftaro.core.nms.v1_20_R1.entity;
|
||||
|
||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||
import com.craftaro.core.nms.entity.player.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -10,4 +12,26 @@ public class NMSPlayerImpl implements NMSPlayer {
|
||||
public void sendPacket(Player p, Object packet) {
|
||||
((CraftPlayer) p).getHandle().connection.send((Packet<?>) packet);
|
||||
}
|
||||
|
||||
public GameProfile getProfile(Player p) {
|
||||
com.mojang.authlib.GameProfile profile = ((CraftPlayer) p).getHandle().getGameProfile();
|
||||
|
||||
String textureValue = null;
|
||||
String textureSignature = null;
|
||||
for (Property property : profile.getProperties().get("textures")) {
|
||||
if (property.getName().equals("SKIN")) {
|
||||
textureValue = property.getValue();
|
||||
textureSignature = property.getSignature();
|
||||
}
|
||||
}
|
||||
|
||||
return new GameProfile(
|
||||
profile,
|
||||
|
||||
profile.getId(),
|
||||
profile.getName(),
|
||||
textureValue,
|
||||
textureSignature
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.craftaro.core.nms.v1_20_R2.entity;
|
||||
|
||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||
import com.craftaro.core.nms.entity.player.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import org.bukkit.craftbukkit.v1_20_R2.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -10,4 +12,26 @@ public class NMSPlayerImpl implements NMSPlayer {
|
||||
public void sendPacket(Player p, Object packet) {
|
||||
((CraftPlayer) p).getHandle().connection.send((Packet<?>) packet);
|
||||
}
|
||||
|
||||
public GameProfile getProfile(Player p) {
|
||||
com.mojang.authlib.GameProfile profile = ((CraftPlayer) p).getHandle().getGameProfile();
|
||||
|
||||
String textureValue = null;
|
||||
String textureSignature = null;
|
||||
for (Property property : profile.getProperties().get("textures")) {
|
||||
if (property.name().equals("SKIN")) {
|
||||
textureValue = property.value();
|
||||
textureSignature = property.signature();
|
||||
}
|
||||
}
|
||||
|
||||
return new GameProfile(
|
||||
profile,
|
||||
|
||||
profile.getId(),
|
||||
profile.getName(),
|
||||
textureValue,
|
||||
textureSignature
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.craftaro.core.nms.v1_20_R3.entity;
|
||||
|
||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||
import com.craftaro.core.nms.entity.player.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import org.bukkit.craftbukkit.v1_20_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -10,4 +12,26 @@ public class NMSPlayerImpl implements NMSPlayer {
|
||||
public void sendPacket(Player p, Object packet) {
|
||||
((CraftPlayer) p).getHandle().connection.send((Packet<?>) packet);
|
||||
}
|
||||
|
||||
public GameProfile getProfile(Player p) {
|
||||
com.mojang.authlib.GameProfile profile = ((CraftPlayer) p).getHandle().getGameProfile();
|
||||
|
||||
String textureValue = null;
|
||||
String textureSignature = null;
|
||||
for (Property property : profile.getProperties().get("textures")) {
|
||||
if (property.name().equals("SKIN")) {
|
||||
textureValue = property.value();
|
||||
textureSignature = property.signature();
|
||||
}
|
||||
}
|
||||
|
||||
return new GameProfile(
|
||||
profile,
|
||||
|
||||
profile.getId(),
|
||||
profile.getName(),
|
||||
textureValue,
|
||||
textureSignature
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.craftaro.core.nms.v1_20_R4.entity;
|
||||
|
||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||
import com.craftaro.core.nms.entity.player.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import org.bukkit.craftbukkit.v1_20_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -10,4 +12,26 @@ public class NMSPlayerImpl implements NMSPlayer {
|
||||
public void sendPacket(Player p, Object packet) {
|
||||
((CraftPlayer) p).getHandle().connection.send((Packet<?>) packet);
|
||||
}
|
||||
|
||||
public GameProfile getProfile(Player p) {
|
||||
com.mojang.authlib.GameProfile profile = ((CraftPlayer) p).getHandle().getGameProfile();
|
||||
|
||||
String textureValue = null;
|
||||
String textureSignature = null;
|
||||
for (Property property : profile.getProperties().get("textures")) {
|
||||
if (property.name().equals("SKIN")) {
|
||||
textureValue = property.value();
|
||||
textureSignature = property.signature();
|
||||
}
|
||||
}
|
||||
|
||||
return new GameProfile(
|
||||
profile,
|
||||
|
||||
profile.getId(),
|
||||
profile.getName(),
|
||||
textureValue,
|
||||
textureSignature
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.craftaro.core.nms.v1_21_R1.entity;
|
||||
|
||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||
import com.craftaro.core.nms.entity.player.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import org.bukkit.craftbukkit.v1_21_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -10,4 +12,26 @@ public class NMSPlayerImpl implements NMSPlayer {
|
||||
public void sendPacket(Player p, Object packet) {
|
||||
((CraftPlayer) p).getHandle().connection.send((Packet<?>) packet);
|
||||
}
|
||||
|
||||
public GameProfile getProfile(Player p) {
|
||||
com.mojang.authlib.GameProfile profile = ((CraftPlayer) p).getHandle().getGameProfile();
|
||||
|
||||
String textureValue = null;
|
||||
String textureSignature = null;
|
||||
for (Property property : profile.getProperties().get("textures")) {
|
||||
if (property.name().equals("SKIN")) {
|
||||
textureValue = property.value();
|
||||
textureSignature = property.signature();
|
||||
}
|
||||
}
|
||||
|
||||
return new GameProfile(
|
||||
profile,
|
||||
|
||||
profile.getId(),
|
||||
profile.getName(),
|
||||
textureValue,
|
||||
textureSignature
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.craftaro.core.nms.v1_8_R1.entity;
|
||||
|
||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||
import com.craftaro.core.nms.entity.player.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import net.minecraft.server.v1_8_R1.Packet;
|
||||
import org.bukkit.craftbukkit.v1_8_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -10,4 +12,26 @@ public class NMSPlayerImpl implements NMSPlayer {
|
||||
public void sendPacket(Player p, Object packet) {
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket((Packet) packet);
|
||||
}
|
||||
|
||||
public GameProfile getProfile(Player p) {
|
||||
com.mojang.authlib.GameProfile profile = ((CraftPlayer) p).getHandle().getProfile();
|
||||
|
||||
String textureValue = null;
|
||||
String textureSignature = null;
|
||||
for (Property property : profile.getProperties().get("textures")) {
|
||||
if (property.getName().equals("SKIN")) {
|
||||
textureValue = property.getValue();
|
||||
textureSignature = property.getSignature();
|
||||
}
|
||||
}
|
||||
|
||||
return new GameProfile(
|
||||
profile,
|
||||
|
||||
profile.getId(),
|
||||
profile.getName(),
|
||||
textureValue,
|
||||
textureSignature
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.craftaro.core.nms.v1_8_R2.entity;
|
||||
|
||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||
import com.craftaro.core.nms.entity.player.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import net.minecraft.server.v1_8_R2.Packet;
|
||||
import org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -8,6 +10,28 @@ import org.bukkit.entity.Player;
|
||||
public class NMSPlayerImpl implements NMSPlayer {
|
||||
@Override
|
||||
public void sendPacket(Player p, Object packet) {
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket((Packet) packet);
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket((Packet<?>) packet);
|
||||
}
|
||||
|
||||
public GameProfile getProfile(Player p) {
|
||||
com.mojang.authlib.GameProfile profile = ((CraftPlayer) p).getHandle().getProfile();
|
||||
|
||||
String textureValue = null;
|
||||
String textureSignature = null;
|
||||
for (Property property : profile.getProperties().get("textures")) {
|
||||
if (property.getName().equals("SKIN")) {
|
||||
textureValue = property.getValue();
|
||||
textureSignature = property.getSignature();
|
||||
}
|
||||
}
|
||||
|
||||
return new GameProfile(
|
||||
profile,
|
||||
|
||||
profile.getId(),
|
||||
profile.getName(),
|
||||
textureValue,
|
||||
textureSignature
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.craftaro.core.nms.v1_8_R3.entity;
|
||||
|
||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||
import com.craftaro.core.nms.entity.player.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import net.minecraft.server.v1_8_R3.Packet;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -10,4 +12,26 @@ public class NMSPlayerImpl implements NMSPlayer {
|
||||
public void sendPacket(Player p, Object packet) {
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket((Packet<?>) packet);
|
||||
}
|
||||
|
||||
public GameProfile getProfile(Player p) {
|
||||
com.mojang.authlib.GameProfile profile = ((CraftPlayer) p).getHandle().getProfile();
|
||||
|
||||
String textureValue = null;
|
||||
String textureSignature = null;
|
||||
for (Property property : profile.getProperties().get("textures")) {
|
||||
if (property.getName().equals("SKIN")) {
|
||||
textureValue = property.getValue();
|
||||
textureSignature = property.getSignature();
|
||||
}
|
||||
}
|
||||
|
||||
return new GameProfile(
|
||||
profile,
|
||||
|
||||
profile.getId(),
|
||||
profile.getName(),
|
||||
textureValue,
|
||||
textureSignature
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.craftaro.core.nms.v1_9_R1.entity;
|
||||
|
||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||
import com.craftaro.core.nms.entity.player.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import net.minecraft.server.v1_9_R1.Packet;
|
||||
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -10,4 +12,26 @@ public class NMSPlayerImpl implements NMSPlayer {
|
||||
public void sendPacket(Player p, Object packet) {
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket((Packet<?>) packet);
|
||||
}
|
||||
|
||||
public GameProfile getProfile(Player p) {
|
||||
com.mojang.authlib.GameProfile profile = ((CraftPlayer) p).getHandle().getProfile();
|
||||
|
||||
String textureValue = null;
|
||||
String textureSignature = null;
|
||||
for (Property property : profile.getProperties().get("textures")) {
|
||||
if (property.getName().equals("SKIN")) {
|
||||
textureValue = property.getValue();
|
||||
textureSignature = property.getSignature();
|
||||
}
|
||||
}
|
||||
|
||||
return new GameProfile(
|
||||
profile,
|
||||
|
||||
profile.getId(),
|
||||
profile.getName(),
|
||||
textureValue,
|
||||
textureSignature
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.craftaro.core.nms.v1_9_R2.entity;
|
||||
|
||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||
import com.craftaro.core.nms.entity.player.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import net.minecraft.server.v1_9_R2.Packet;
|
||||
import org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -10,4 +12,26 @@ public class NMSPlayerImpl implements NMSPlayer {
|
||||
public void sendPacket(Player p, Object packet) {
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket((Packet<?>) packet);
|
||||
}
|
||||
|
||||
public GameProfile getProfile(Player p) {
|
||||
com.mojang.authlib.GameProfile profile = ((CraftPlayer) p).getHandle().getProfile();
|
||||
|
||||
String textureValue = null;
|
||||
String textureSignature = null;
|
||||
for (Property property : profile.getProperties().get("textures")) {
|
||||
if (property.getName().equals("SKIN")) {
|
||||
textureValue = property.getValue();
|
||||
textureSignature = property.getSignature();
|
||||
}
|
||||
}
|
||||
|
||||
return new GameProfile(
|
||||
profile,
|
||||
|
||||
profile.getId(),
|
||||
profile.getName(),
|
||||
textureValue,
|
||||
textureSignature
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user