Class Util

java.lang.Object
net.citizensnpcs.util.Util

public class Util extends Object
  • Method Details

    • callCollisionEvent

      public static void callCollisionEvent(NPC npc, Entity entity)
    • callPistonPushEvent

      public static boolean callPistonPushEvent(NPC npc)
    • callPossiblySync

      public static <T> T callPossiblySync(Callable<T> callable, boolean sync)
    • callPushEvent

      public static Vector callPushEvent(NPC npc, double x, double y, double z)
    • clamp

      public static float clamp(float angle)
      Clamps the rotation angle to [-180, 180]
    • clamp

      public static float clamp(float angle, float min, float max, float d)
    • convert

      public static int convert(TimeUnit unit, Duration delay)
    • createItem

      public static ItemStack createItem(Material mat, String name)
    • createItem

      public static ItemStack createItem(Material mat, String name, String description)
    • editTitle

      public static ItemStack editTitle(ItemStack item, Function<String,String> transform)
    • face

      public static void face(Entity entity, float yaw, float pitch)
    • faceEntity

      public static void faceEntity(Entity entity, Entity to)
    • faceLocation

      public static void faceLocation(Entity entity, Location to)
    • faceLocation

      public static void faceLocation(Entity entity, Location to, boolean headOnly)
    • faceLocation

      public static void faceLocation(Entity entity, Location to, boolean headOnly, boolean immediate)
    • getCenterLocation

      public static Location getCenterLocation(Block block)
    • getDragonYaw

      public static float getDragonYaw(Entity entity, double motX, double motZ)
      Returns the yaw to face along the given velocity (corrected for dragon yaw i.e. facing backwards)
    • getDummyScoreboard

      public static Scoreboard getDummyScoreboard()
    • getEntity

      public static Entity getEntity(UUID uuid)
    • getEyeLocation

      public static Location getEyeLocation(Entity entity)
    • getFallbackMaterial

      public static Material getFallbackMaterial(String first, String... second)
    • getFastRandom

      public static Random getFastRandom()
    • getTeamName

      public static String getTeamName(UUID id)
    • inBlock

      public static boolean inBlock(Entity entity)
    • isAlwaysFlyable

      public static boolean isAlwaysFlyable(EntityType type)
    • isHorse

      public static boolean isHorse(EntityType type)
    • isLoaded

      public static boolean isLoaded(Location location)
    • isOffHand

      public static boolean isOffHand(PlayerInteractEntityEvent event)
    • isOffHand

      public static boolean isOffHand(PlayerInteractEvent event)
    • listValuesPretty

      public static String listValuesPretty(Enum<?>[] values)
    • locationWithinRange

      public static boolean locationWithinRange(Location current, Location target, double range)
    • matchEnum

      public static <T extends Enum<?>> T matchEnum(T[] values, String toMatch)
    • matchesItemInHand

      public static boolean matchesItemInHand(Player player, String setting)
    • optionalEntitySet

      public static Set<EntityType> optionalEntitySet(String... types)
    • parseItemStack

      public static ItemStack parseItemStack(ItemStack stack, String item)
    • parseTicks

      public static int parseTicks(String raw)
    • prettyEnum

      public static String prettyEnum(Enum<?> e)
    • prettyPrintLocation

      public static String prettyPrintLocation(Location to)
    • rawtype

      public static String rawtype(Enum<?>[] values)
    • runCommand

      public static void runCommand(NPC npc, Player clicker, String command, boolean op, boolean player)
    • sendBlockChanges

      public static void sendBlockChanges(List<Block> blocks, Material type)
    • talk

      public static void talk(SpeechContext context)
    • toTicks

      public static int toTicks(Duration delay)