Paste #108134: Unnamed Java Paste

Date: 2023/03/30 08:26:32 UTC-07:00
Type: Java

View Raw Paste Download This Paste
Copy Link


public abstract class StigglesNPC {
    private NPC npc;
    private ChatColor nameColorPrefix = ChatColor.WHITE;
    private ChatColor chatColor = ChatColor.WHITE;
    protected SMP5 main;

    private String name;

    private com.stiggles.smp5.worlds.WorldType worldType;
    private String worldName;

    private Location spawnLocation;

    private float yaw;
    private float pitch;

    public StigglesNPC (SMP5 main, String name, Location location) {
        this.main = main;
        npc = CitizensAPI.getNPCRegistry().createNPC(EntityType.PLAYER, name);
        NPCManager.registerNewNPC(this);

        worldName = location.getWorld().getName();

        worldType = com.stiggles.smp5.worlds.WorldType.SMP;
        for (com.stiggles.smp5.worlds.WorldType w : WorldType.values())
            if (worldName.contains(w.toString()))
                worldType = w;

        spawnLocation = location;
        yaw = 1f;
        pitch = 1f;

        npc.spawn(spawnLocation);
    }
    /** Set the skin of the NPC. Get fields from mineskin.org.
     *
     * @param value The skin value string.
     * @param signature The skin signature string.
     */
    public void setSkin (String value, String signature) {
        npc.getOrAddTrait(SkinTrait.class).setSkinPersistent(name, signature, value);
    }
}


Highlighting for 'Other' types handled by Highlight.JS, which was released under the BSD 3-Clause License.