Merge branch 'development' of https://github.com/craftaro/SongodaCore into development

This commit is contained in:
ceze88 2024-07-22 15:33:59 +02:00
commit 91a92bc10b
68 changed files with 900 additions and 255 deletions

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-Compatibility</artifactId>

View File

@ -0,0 +1,95 @@
package com.craftaro.core.compatibility;
import org.apache.commons.lang3.ArrayUtils;
public enum MajorServerVersion {
UNKNOWN, V1_7, V1_8, V1_9, V1_10, V1_11, V1_12, V1_13, V1_14, V1_15, V1_16, V1_17, V1_18, V1_19, V1_20, V1_21, V1_22, V1_23;
private static final MajorServerVersion SERVER_VERSION = getVersion();
public boolean isLessThan(MajorServerVersion other) {
if (SERVER_VERSION == UNKNOWN) {
return false;
}
return this.ordinal() < other.ordinal();
}
public boolean isAtOrBelow(MajorServerVersion other) {
if (SERVER_VERSION == UNKNOWN && other != UNKNOWN) {
return false;
}
return this.ordinal() <= other.ordinal();
}
public boolean isGreaterThan(MajorServerVersion other) {
if (SERVER_VERSION == UNKNOWN) {
return false;
}
return this.ordinal() > other.ordinal();
}
public boolean isAtLeast(MajorServerVersion other) {
if (SERVER_VERSION == UNKNOWN && other != UNKNOWN) {
return false;
}
return this.ordinal() >= other.ordinal();
}
public static MajorServerVersion getServerVersion() {
return SERVER_VERSION;
}
public static boolean isServerVersion(MajorServerVersion version) {
return SERVER_VERSION == version;
}
public static boolean isServerVersion(MajorServerVersion... versions) {
return ArrayUtils.contains(versions, SERVER_VERSION);
}
public static boolean isServerVersionAbove(MajorServerVersion version) {
if (SERVER_VERSION == UNKNOWN) {
return false;
}
return SERVER_VERSION.ordinal() > version.ordinal();
}
public static boolean isServerVersionAtLeast(MajorServerVersion version) {
if (SERVER_VERSION == UNKNOWN && version != UNKNOWN) {
return false;
}
return SERVER_VERSION.ordinal() >= version.ordinal();
}
public static boolean isServerVersionAtOrBelow(MajorServerVersion version) {
if (SERVER_VERSION == UNKNOWN && version != UNKNOWN) {
return false;
}
return SERVER_VERSION.ordinal() <= version.ordinal();
}
public static boolean isServerVersionBelow(MajorServerVersion version) {
if (SERVER_VERSION == UNKNOWN) {
return false;
}
return SERVER_VERSION.ordinal() < version.ordinal();
}
private static MajorServerVersion getVersion() {
for (MajorServerVersion version : values()) {
if (ServerVersion.serverPackageVersion.toUpperCase().startsWith(version.name())) {
return version;
}
}
return UNKNOWN;
}
}

View File

@ -60,7 +60,7 @@ public enum ServerVersion {
;
private static final String serverPackageVersion;
static final String serverPackageVersion;
private static final String serverReleaseVersion;
private static final ServerVersion serverVersion;
private static final boolean isMocked;

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore</artifactId>

View File

@ -2,14 +2,11 @@ package com.craftaro.core;
import com.craftaro.core.commands.CommandManager;
import com.craftaro.core.compatibility.ClientVersion;
import com.craftaro.core.core.LocaleModule;
import com.craftaro.core.core.PluginInfo;
import com.craftaro.core.core.PluginInfoModule;
import com.craftaro.core.core.SongodaCoreCommand;
import com.craftaro.core.core.SongodaCoreDiagCommand;
import com.cryptomorin.xseries.XMaterial;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
@ -20,24 +17,14 @@ import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.plugin.ServicePriority;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.UUID;
import java.util.logging.Level;
public class SongodaCore {
@ -230,55 +217,11 @@ public class SongodaCore {
getLogger().info(getPrefix() + "Hooked " + plugin.getName() + ".");
PluginInfo info = new PluginInfo(plugin, pluginID, icon, libraryVersion);
// don't forget to check for language pack updates ;)
info.addModule(new LocaleModule());
registeredPlugins.add(info);
this.tasks.add(Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, () -> update(info), 60L));
}
/**
* @deprecated Seems useless and will probably be replaced in the near future
*/
@Deprecated
private void update(PluginInfo plugin) {
try {
URL url = new URL("https://update.songoda.com/index.php?plugin=" + plugin.getSongodaId()
+ "&version=" + plugin.getJavaPlugin().getDescription().getVersion()
+ "&updaterVersion=" + updaterVersion);
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11");
urlConnection.setRequestProperty("Accept", "*/*");
urlConnection.setConnectTimeout(5000);
InputStream is = urlConnection.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
int numCharsRead;
char[] charArray = new char[1024];
StringBuilder sb = new StringBuilder();
while ((numCharsRead = isr.read(charArray)) > 0) {
sb.append(charArray, 0, numCharsRead);
}
urlConnection.disconnect();
String jsonString = sb.toString();
JSONObject json = (JSONObject) new JSONParser().parse(jsonString);
plugin.setLatestVersion((String) json.get("latestVersion"));
plugin.setMarketplaceLink((String) json.get("link"));
plugin.setNotification((String) json.get("notification"));
plugin.setChangeLog((String) json.get("changeLog"));
plugin.setJson(json);
for (PluginInfoModule module : plugin.getModules()) {
module.run(plugin);
}
} catch (IOException ex) {
final String er = ex.getMessage();
getLogger().log(Level.FINE, "Connection with Songoda servers failed: " + (er.contains("URL") ? er.substring(0, er.indexOf("URL") + 3) : er));
} catch (ParseException ex) {
getLogger().log(Level.FINE, "Failed to parse json for " + plugin.getJavaPlugin().getName() + " update check");
if (plugin.getDescription().getWebsite() != null && plugin.getDescription().getWebsite().contains("songoda.com/")) {
info.setMarketplaceLink(plugin.getDescription().getWebsite());
}
registeredPlugins.add(info);
}
public static List<PluginInfo> getPlugins() {
@ -391,33 +334,6 @@ public class SongodaCore {
}
private class EventListener implements Listener {
final HashMap<UUID, Long> lastCheck = new HashMap<>();
@EventHandler
void onLogin(PlayerLoginEvent event) {
final Player player = event.getPlayer();
// don't spam players with update checks
long now = System.currentTimeMillis();
Long last = this.lastCheck.get(player.getUniqueId());
if (last != null && now - 10000 < last) {
return;
}
this.lastCheck.put(player.getUniqueId(), now);
// is this player good to revieve update notices?
if (!event.getPlayer().isOp() && !player.hasPermission("songoda.updatecheck")) return;
// check for updates! ;)
for (PluginInfo plugin : getPlugins()) {
if (plugin.getNotification() != null && plugin.getJavaPlugin().isEnabled())
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin.getJavaPlugin(), () ->
player.sendMessage("[" + plugin.getJavaPlugin().getName() + "] " + plugin.getNotification()), 10L);
}
}
@EventHandler
void onDisable(PluginDisableEvent event) {
// don't track disabled plugins

View File

@ -1,64 +0,0 @@
package com.craftaro.core.core;
import com.craftaro.core.locale.Locale;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;
public class LocaleModule implements PluginInfoModule {
@Override
public void run(PluginInfo plugin) {
if (plugin.getJavaPlugin() == null || plugin.getSongodaId() <= 0) {
return;
}
try {
JSONObject json = plugin.getJson();
JSONArray files = (JSONArray) json.get("neededFiles");
for (Object o : files) {
JSONObject file = (JSONObject) o;
if (file.get("type").equals("locale")) {
downloadLocale(plugin, (String) file.get("link"), (String) file.get("name"));
}
}
} catch (IOException ex) {
Logger.getLogger(LocaleModule.class.getName()).log(Level.INFO, "Failed to check for locale files: " + ex.getMessage());
}
}
void downloadLocale(PluginInfo plugin, String link, String fileName) throws IOException {
URL url = new URL(link);
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11");
urlConnection.setRequestProperty("Accept", "*/*");
urlConnection.setInstanceFollowRedirects(true);
urlConnection.setConnectTimeout(5000);
// do we need to follow a redirect?
int status = urlConnection.getResponseCode();
if (status == HttpURLConnection.HTTP_MOVED_TEMP || status == HttpURLConnection.HTTP_MOVED_PERM || status == HttpURLConnection.HTTP_SEE_OTHER) {
// get redirect url from "location" header field
String newUrl = urlConnection.getHeaderField("Location");
// get the cookie if needed
String cookies = urlConnection.getHeaderField("Set-Cookie");
// open the new connnection again
urlConnection = (HttpURLConnection) new URL(newUrl).openConnection();
urlConnection.setRequestProperty("Cookie", cookies);
urlConnection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11");
urlConnection.setRequestProperty("Accept", "*/*");
urlConnection.setConnectTimeout(5000);
}
Locale.saveLocale(plugin.getJavaPlugin(), urlConnection.getInputStream(), fileName);
urlConnection.disconnect();
}
}

View File

@ -4,7 +4,6 @@ import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.dependency.DependencyLoader;
import com.cryptomorin.xseries.XMaterial;
import org.bukkit.plugin.java.JavaPlugin;
import org.json.simple.JSONObject;
import java.util.ArrayList;
import java.util.Collections;
@ -18,12 +17,7 @@ public final class PluginInfo {
private final String coreLibraryVersion;
private final List<PluginInfoModule> modules = new ArrayList<>();
private boolean hasUpdate = false;
private String latestVersion;
private String notification;
private String changeLog;
private String marketplaceLink;
private JSONObject json;
public PluginInfo(JavaPlugin javaPlugin, int songodaId, String icon, String coreLibraryVersion) {
this.javaPlugin = javaPlugin;
@ -33,40 +27,6 @@ public final class PluginInfo {
this.coreLibraryVersion = coreLibraryVersion;
}
public String getLatestVersion() {
return this.latestVersion;
}
public void setLatestVersion(String latestVersion) {
this.latestVersion = latestVersion;
this.hasUpdate = latestVersion != null && !latestVersion.isEmpty() && !this.javaPlugin.getDescription().getVersion().equalsIgnoreCase(latestVersion);
}
public String getNotification() {
return this.notification;
}
public void setNotification(String notification) {
this.notification = notification;
}
public boolean hasUpdate() {
return this.hasUpdate;
}
public void setHasUpdate(boolean hasUpdate) {
this.hasUpdate = hasUpdate;
}
public String getChangeLog() {
return this.changeLog;
}
public void setChangeLog(String changeLog) {
this.changeLog = changeLog;
}
public String getMarketplaceLink() {
return this.marketplaceLink;
}
@ -75,14 +35,6 @@ public final class PluginInfo {
this.marketplaceLink = marketplaceLink;
}
public JSONObject getJson() {
return this.json;
}
public void setJson(JSONObject json) {
this.json = json;
}
public PluginInfoModule addModule(PluginInfoModule module) {
this.modules.add(module);

View File

@ -23,34 +23,19 @@ final class SongodaCoreOverviewGUI extends Gui {
for (int i = 0; i < plugins.size(); ++i) {
final PluginInfo plugin = plugins.get(i);
if (plugin.hasUpdate()) {
setButton(i, GuiUtils.createButtonItem(plugin.getIcon() != null ? plugin.getIcon() : XMaterial.STONE,
ChatColor.GOLD + plugin.getJavaPlugin().getName(),
ChatColor.GRAY + "Latest Version: " + plugin.getLatestVersion(),
ChatColor.GRAY + "Installed Version: " + plugin.getJavaPlugin().getDescription().getVersion(),
"",
"Change log:",
plugin.getChangeLog(),
"",
ChatColor.GOLD + "Click for the marketplace page link.",
ChatColor.GOLD + "Right Click to edit plugin settings."
),
ClickType.LEFT, (event) -> event.player.sendMessage(plugin.getMarketplaceLink()));
setAction(i, ClickType.RIGHT, (event) -> event.manager.showGUI(event.player, new PluginConfigGui(plugin.getJavaPlugin(), event.gui)));
highlightItem(i);
continue;
}
boolean hasMarketplaceLink = plugin.getMarketplaceLink() != null && !plugin.getMarketplaceLink().isEmpty();
setButton(i, GuiUtils.createButtonItem(plugin.getIcon() != null ? plugin.getIcon() : XMaterial.STONE,
ChatColor.GOLD + plugin.getJavaPlugin().getName(),
ChatColor.GRAY + "Installed Version: " + plugin.getJavaPlugin().getDescription().getVersion(),
"",
ChatColor.GOLD + "Click for the marketplace page link.",
hasMarketplaceLink ? (ChatColor.GOLD + "Click for the marketplace page link.") : "",
ChatColor.GOLD + "Right Click to edit plugin settings."
),
ClickType.LEFT, (event) -> event.player.sendMessage(plugin.getMarketplaceLink()));
setAction(i, ClickType.RIGHT, (event) -> event.manager.showGUI(event.player, new PluginConfigGui(plugin.getJavaPlugin(), event.gui)));
ClickType.RIGHT, (event) -> event.manager.showGUI(event.player, new PluginConfigGui(plugin.getJavaPlugin(), event.gui)));
if (hasMarketplaceLink) {
setAction(i, ClickType.LEFT, (event) -> event.player.sendMessage(plugin.getMarketplaceLink()));
}
}
}
}

View File

@ -0,0 +1,58 @@
package com.craftaro.core.utils;
import com.craftaro.core.nms.Nms;
import com.cryptomorin.xseries.profiles.builder.XSkull;
import com.cryptomorin.xseries.profiles.objects.ProfileInputType;
import com.cryptomorin.xseries.profiles.objects.Profileable;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import java.util.UUID;
public final class SkullItemCreator {
private static final String STEVE_TEXTURE = "ewogICJ0aW1lc3RhbXAiIDogMTYyMTcxNTMxMjI5MCwKICAicHJvZmlsZUlkIiA6ICJiNTM5NTkyMjMwY2I0MmE0OWY5YTRlYmYxNmRlOTYwYiIsCiAgInByb2ZpbGVOYW1lIiA6ICJtYXJpYW5hZmFnIiwKICAic2lnbmF0dXJlUmVxdWlyZWQiIDogdHJ1ZSwKICAidGV4dHVyZXMiIDogewogICAgIlNLSU4iIDogewogICAgICAidXJsIiA6ICJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzFhNGFmNzE4NDU1ZDRhYWI1MjhlN2E2MWY4NmZhMjVlNmEzNjlkMTc2OGRjYjEzZjdkZjMxOWE3MTNlYjgxMGIiCiAgICB9CiAgfQp9";
private static final String ALEX_TEXTURE = "rZvLQoZsgLYaoKqEuASopYAs7IAlZlsGkwagoM8ZX38cP9kalseZrWY5OHZVfoiftdQJ+lGOzkiFfyx6kNJDTZniLrnRa8sd3X6D65ZihT1sOm/RInCwxpS1K0zGCM2h9ErkWswfwaviIf7hJtrwk8/zL0bfzDk2IgX/IBvIZpVoYTfmQsVY9jgSwORrS9ObePGIfFgmThMoZnCYWQMVpS2+yTFA2wnw9hmisQK9UWBU+iBZv55bMmkMcyEuXw1w14DaEu+/M0UGD91LU4GmJLPA9T4GCuIV8GxOcraSVIajki1cMlOBQwIaibB2NE6KAwq1Zh6NnsNYucy6qFM+136lXfBchQ1Nx4FDRZQgt8VRqTMy/OQFpr2nTbWWbRU4gRFpKC3R0518DqUH0Qm612kPWniKku/QzUUBSe1PSVljBaZCyyRx0OB1a1/8MexboKRnPXuTDnmPa9UPfuH4VO0q+qYkjV2KUzP6e5vIP5aQ6USPrMie7MmAHFJzwAMIbLjgkTVx91GWtYqg/t7qBlvrdBRLIPPsy/DSOqa+2+4hABouVCPZrBMCMLzstPPQoqZAyiCqcKb2HqWSU0h9Bhx19yoIcbHCeI3zsQs8PqIBjUL4mO6VQT4lzHy0e3M61Xsdd8S1GtsakSetTvEtMdUwCEDfBA5PRRTLOVYTY+g=";
public static ItemStack byPlayer(Player player) {
if (Bukkit.getOnlineMode()) {
return XSkull.createItem().profile(new Profileable.PlayerProfileable(player)).apply();
}
String textureValue = Nms.getImplementations().getPlayer().getProfile(player).getTextureValue();
if (textureValue != null) {
return byTextureValue(textureValue);
}
return createDefaultSkull(player.getUniqueId());
}
public static ItemStack byUuid(UUID uuid) {
return XSkull.createItem().profile(new Profileable.UUIDProfileable(uuid)).apply();
}
public static ItemStack byUsername(String username) {
return XSkull.createItem().profile(new Profileable.StringProfileable(username, ProfileInputType.USERNAME)).apply();
}
public static ItemStack byTextureValue(String textureValue) {
return XSkull.createItem().profile(new Profileable.StringProfileable(textureValue, ProfileInputType.BASE64)).apply();
}
public static ItemStack byTextureUrl(String textureUrl) {
return XSkull.createItem().profile(new Profileable.StringProfileable(textureUrl, ProfileInputType.TEXTURE_URL)).apply();
}
public static ItemStack byTextureHash(String textureHash) {
return XSkull.createItem().profile(new Profileable.StringProfileable(textureHash, ProfileInputType.TEXTURE_HASH)).apply();
}
private static ItemStack createDefaultSkull(UUID uuid) {
String textureValue = STEVE_TEXTURE;
if ((uuid.hashCode() & 1) != 0) {
textureValue = ALEX_TEXTURE;
}
return XSkull.createItem().profile(new Profileable.StringProfileable(textureValue, ProfileInputType.BASE64)).apply();
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-API</artifactId>

View File

@ -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);
}

View File

@ -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;
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_10_R1</artifactId>

View File

@ -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
);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_11_R1</artifactId>

View File

@ -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
);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_12_R1</artifactId>

View File

@ -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
);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_13_R1</artifactId>

View File

@ -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
);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_13_R2</artifactId>

View File

@ -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
);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_14_R1</artifactId>

View File

@ -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
);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_15_R1</artifactId>

View File

@ -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
);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_16_R1</artifactId>

View File

@ -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
);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_16_R2</artifactId>

View File

@ -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
);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_16_R3</artifactId>

View File

@ -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
);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_17_R1</artifactId>

View File

@ -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
);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_18_R1</artifactId>

View File

@ -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
);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_18_R2</artifactId>

View File

@ -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
);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_19_0</artifactId>

View File

@ -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
);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_19_R1</artifactId>

View File

@ -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
);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_19_R2</artifactId>

View File

@ -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
);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_19_R3</artifactId>

View File

@ -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
);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_20_R1</artifactId>

View File

@ -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
);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_20_R2</artifactId>

View File

@ -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
);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_20_R3</artifactId>

View File

@ -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
);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_20_R4</artifactId>

View File

@ -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
);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_21_R1</artifactId>

View File

@ -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
);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_8_R1</artifactId>

View File

@ -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
);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_8_R2</artifactId>

View File

@ -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
);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_8_R3</artifactId>

View File

@ -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
);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_9_R1</artifactId>

View File

@ -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
);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_9_R2</artifactId>

View File

@ -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
);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS</artifactId>

View File

@ -6,7 +6,7 @@
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
<packaging>pom</packaging>
<!-- Run 'mvn versions:set -DgenerateBackupPoms=false -DnewVersion=X.Y.Z' to update version recursively -->