mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-01-23 00:21:31 +01:00
Migrate /npc skin properly and deprecate skinnable entity methods
This commit is contained in:
parent
93af872e93
commit
2c1ef04614
@ -81,7 +81,6 @@ import net.citizensnpcs.api.util.Placeholders;
|
||||
import net.citizensnpcs.npc.EntityControllers;
|
||||
import net.citizensnpcs.npc.NPCSelector;
|
||||
import net.citizensnpcs.npc.Template;
|
||||
import net.citizensnpcs.npc.skin.SkinnableEntity;
|
||||
import net.citizensnpcs.trait.Age;
|
||||
import net.citizensnpcs.trait.Anchors;
|
||||
import net.citizensnpcs.trait.ArmorStandTrait;
|
||||
@ -1642,7 +1641,7 @@ public class NPCCommands {
|
||||
@Requirements(types = EntityType.PLAYER, selected = true, ownership = true)
|
||||
public void skin(final CommandContext args, final CommandSender sender, final NPC npc) throws CommandException {
|
||||
String skinName = npc.getName();
|
||||
SkinTrait trait = npc.getTrait(SkinTrait.class);
|
||||
final SkinTrait trait = npc.getTrait(SkinTrait.class);
|
||||
if (args.hasFlag('c')) {
|
||||
trait.clearTexture();
|
||||
} else if (args.hasValueFlag("url")) {
|
||||
@ -1673,7 +1672,7 @@ public class NPCCommands {
|
||||
Bukkit.getScheduler().runTask(CitizensAPI.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
((SkinnableEntity) npc.getEntity()).setSkinPersistent(uuid, signature, textureEncoded);
|
||||
trait.setSkinPersistent(uuid, signature, textureEncoded);
|
||||
Messaging.sendTr(sender, Messages.SKIN_URL_SET, npc.getName(), url);
|
||||
}
|
||||
});
|
||||
@ -1704,12 +1703,7 @@ public class NPCCommands {
|
||||
} else if (args.hasFlag('t')) {
|
||||
if (args.argsLength() != 4)
|
||||
throw new CommandException(Messages.SKIN_REQUIRED);
|
||||
SkinnableEntity skinnable = npc.getEntity() instanceof SkinnableEntity ? (SkinnableEntity) npc.getEntity()
|
||||
: null;
|
||||
if (skinnable == null) {
|
||||
throw new CommandException("Must be spawned.");
|
||||
}
|
||||
skinnable.setSkinPersistent(args.getString(1), args.getString(3), args.getString(2));
|
||||
trait.setSkinPersistent(args.getString(1), args.getString(3), args.getString(2));
|
||||
Messaging.sendTr(sender, Messages.SKIN_SET, npc.getName(), args.getString(1));
|
||||
return;
|
||||
} else {
|
||||
|
@ -5,6 +5,7 @@ import org.bukkit.entity.Player;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.trait.SkinTrait;
|
||||
|
||||
/**
|
||||
* Interface for player entities that are skinnable.
|
||||
@ -50,12 +51,23 @@ public interface SkinnableEntity extends NPCHolder {
|
||||
* Setting the skin name automatically updates and respawn the NPC.
|
||||
* </p>
|
||||
*
|
||||
* @see SkinTrait#setSkinName(String)
|
||||
*
|
||||
* @param name
|
||||
* The skin name.
|
||||
*/
|
||||
@Deprecated
|
||||
void setSkinName(String name);
|
||||
|
||||
/**
|
||||
* @see SkinTrait#setSkinName(String,boolean)
|
||||
*/
|
||||
@Deprecated
|
||||
void setSkinName(String skinName, boolean forceUpdate);
|
||||
|
||||
/**
|
||||
* @see SkinTrait#setSkinPersistent(String,String,String)
|
||||
*/
|
||||
@Deprecated
|
||||
void setSkinPersistent(String skinName, String signature, String data);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user