There are various utilities that have nothing to do with Bukkit or Minecraft alone. These are utilities working with mathematics, logic, strings and blockfaces. There are a lot of utilities, and listing them all here is going to result in too much information. Instead the basic features covered are listed so you know where to find them.


MathUtil contains various common operations involving math:

  • length, lengthSquared, distance, distanceSquared, normalize - both 2D and 3D vector length operations
  • wrapAngle, getAngleDifference, toChunk, Long<>2Int, fixNaN, clamp, lerp, atan2 - for simplistic number calculations
  • getLookAtYaw/Pitch, getDirection, isHeadingTo, move, rotate - for rotation-based vector calculations and checks


FaceUtil contains various common operations involving the conversion from and to BlockFaces:

  • Conversion between yaw and BlockFace
  • Conversion between vector directions and BlockFace
  • Conversion between 'notch' (0-7) and BlockFace
  • Several BlockFace constants for easier logic


LogicUtil contains methods to work with general logic such as checking for null and returning something else, logic involving collections and more:

  • Conversion between primitive and boxed class types
  • Checking whether an Object is null or empty
  • Checking whether an index is in bounds of an array or list
  • Dynamically creating arrays and getting array elements
  • Checking to see if a given value is present in a primitive type array


StringUtil contains methods to format Strings, get the first index of text in a String and other String-related operations:

  • Get the width of text in Minecraft font (might become deprecated)
  • Get the first index of multiple pieces of text
  • Get the text before or after a piece of text
  • Obtain a String filled with certain text appended N times
  • Trimming the end or start of text from whitespaces
  • Combining multiple pieces of text together with a delimiter, or using , and and
  • Converting "-surrounded parts into a single element (for command argument conversion)
  • Get the amount of successive times a given character is present in a text
  • Chat style conversion methods
  • Replacing text, or all text


ParseUtil takes care of number, boolean and enum parsing. Note that the Conversion system already includes redirects to this class:

  • Parsing booleans, checking whether a piece of text can be interpreted as a boolean
  • Parsing numbers, checking whether a piece of text can be interpreted as a number
  • Parsing enumerations from text, generic
  • Parsing materials, by checking for an ID or the material name


TimeUtil is used to convert between time and text, by interpreting words such as 'day' and 'night' and turning it into Minecraft time. Although it has something to do with Minecraft, it is still basic logic. Methods:

  • get Minecraft time from text
  • get name in text format from Minecraft time
  • getting the current time in a certain date format


Posts Quoted:
Clear All Quotes