13
0
geforkt von Mirrors/Paper

SPIGOT-2152: Method to set resource pack + hash.

Dieser Commit ist enthalten in:
Max Lee 2017-02-14 14:00:30 +01:00 committet von md_5
Ursprung 2683195ecd
Commit 4c8d895513

Datei anzeigen

@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.entity;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableSet;
import com.google.common.io.BaseEncoding;
import com.mojang.authlib.GameProfile;
import io.netty.buffer.Unpooled;
@ -14,6 +15,7 @@ import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
@ -1094,6 +1096,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
getHandle().setResourcePack(url, "null");
}
@Override
public void setResourcePack(String url, byte[] hash) {
Validate.notNull(url, "Resource pack URL cannot be null");
Validate.notNull(hash, "Resource pack hash cannot be null");
Validate.isTrue(hash.length == 20, "Resource pack hash should be 20 bytes long but was " + hash.length);
getHandle().setResourcePack(url, BaseEncoding.base16().lowerCase().encode(hash));
}
public void addChannel(String channel) {
if (channels.add(channel)) {
server.getPluginManager().callEvent(new PlayerRegisterChannelEvent(this, channel));