Archiviert
13
0

Add API to allow plugins to request players switch to a texture pack. Adds BUKKIT-2579

The setTexturePack method causes the player's client to
download and switch to a texture pack specified by a URL.

Note: Players can disable server textures on their client, in which
case this API would not affect them.
Dieser Commit ist enthalten in:
Wojciech Stryjewski 2012-10-09 15:57:39 -05:00 committet von EvilSeph
Ursprung f4836fb428
Commit f377a7680f

Datei anzeigen

@ -47,6 +47,7 @@ import org.bukkit.inventory.InventoryView.Property;
import org.bukkit.map.MapView; import org.bukkit.map.MapView;
import org.bukkit.metadata.MetadataValue; import org.bukkit.metadata.MetadataValue;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.messaging.Messenger;
import org.bukkit.plugin.messaging.StandardMessenger; import org.bukkit.plugin.messaging.StandardMessenger;
@DelegateDeserialization(CraftOfflinePlayer.class) @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) { public void addChannel(String channel) {
if (channels.add(channel)) { if (channels.add(channel)) {
server.getPluginManager().callEvent(new PlayerRegisterChannelEvent(this, channel)); server.getPluginManager().callEvent(new PlayerRegisterChannelEvent(this, channel));