diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 750e950977..beb62a00b8 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -47,6 +47,7 @@ import org.bukkit.inventory.InventoryView.Property; import org.bukkit.map.MapView; import org.bukkit.metadata.MetadataValue; import org.bukkit.plugin.Plugin; +import org.bukkit.plugin.messaging.Messenger; import org.bukkit.plugin.messaging.StandardMessenger; @DelegateDeserialization(CraftOfflinePlayer.class) @@ -782,6 +783,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } } + public void setTexturePack(String url) { + Validate.notNull(url, "Texture pack URL cannot be null"); + + byte[] message = (url + "\0" + "16").getBytes(); + Validate.isTrue(message.length <= Messenger.MAX_MESSAGE_SIZE, "Texture pack URL is too long"); + + getHandle().playerConnection.sendPacket(new Packet250CustomPayload("MC|TPack", message)); + } + public void addChannel(String channel) { if (channels.add(channel)) { server.getPluginManager().callEvent(new PlayerRegisterChannelEvent(this, channel));