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)
    • 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)
    • getDummyScoreboard

      public static Scoreboard getDummyScoreboard()
    • getEntity

      public static Entity getEntity(UUID uuid)
    • getEyeLocation

      public static Location getEyeLocation(Entity entity)
    • getFallbackEntityType

      public static EntityType getFallbackEntityType(String first, String... second)
    • getFallbackMaterial

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

      public static Random getFastRandom()
    • getRegistryValue

      public static <T extends Keyed> T getRegistryValue(Registry<T> registry, String... keyCandidates)
    • getTeamName

      public static String getTeamName(UUID id)
    • getYawFromVelocity

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

      public static boolean inBlock(Entity entity)
    • isAlwaysFlyable

      public static boolean isAlwaysFlyable(EntityType type)
    • isBedrockName

      public static boolean isBedrockName(String name)
    • isEquippable

      public static boolean isEquippable(ItemStack stack, Equipment.EquipmentSlot slot)
    • 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(Object[] values)
    • 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)
    • parseColor

      public static Color parseColor(String string)
    • parseItemStack

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

      public static int parseTicks(String raw)
    • possiblyConvertToBedrockName

      public static String possiblyConvertToBedrockName(String name)
    • possiblyStripBedrockPrefix

      public static String possiblyStripBedrockPrefix(String name, UUID uuid)
    • prettyEnum

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

      public static String prettyPrintLocation(Location to)
    • 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)
    • stripBedrockPrefix

      public static String stripBedrockPrefix(String name)
    • talk

      public static void talk(SpeechContext context)
    • toTicks

      public static int toTicks(Duration delay)