Package net.citizensnpcs.trait

Examples of net.citizensnpcs.trait.Poses


                        + (pose_loc != null ? pose_loc.debug() : ""));

        if (!npc.getCitizen().hasTrait(Poses.class))
            npc.getCitizen().addTrait(Poses.class);

        Poses poses = npc.getCitizen().getTrait(Poses.class);

        switch (action) {

            case ASSUME:
                if (!poses.hasPose(id))
                    throw new CommandExecutionException("Pose \"" + id + "\" doesn't exist for " + npc.toString());

                if (target.name().equals("NPC"))
                    poses.assumePose(id);
                else {
                    Player player = ((BukkitScriptEntryData)scriptEntry.entryData).getPlayer().getPlayerEntity();
                    Location location = player.getLocation();
                    location.setYaw(poses.getPose(id).getYaw());
                    location.setPitch(poses.getPose(id).getPitch());

                    // The only way to change a player's yaw and pitch in Bukkit
                    // is to use teleport on him/her
                    player.teleport(location);
                }
                break;

            case ADD:
                if (!poses.addPose(id, pose_loc))
                    throw new CommandExecutionException(npc.toString() + " already has that pose!");
                break;

            case REMOVE:
                if (!poses.removePose(id))
                    throw new CommandExecutionException(npc.toString() + " does not have that pose!");
                break;

        }
View Full Code Here

TOP

Related Classes of net.citizensnpcs.trait.Poses

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.