Skip to content
Denis Istratov edited this page Jul 28, 2023 · 3 revisions

MaterialUtils

Contains several methods for working with Material

getMaterialFromString(String) - Returns the material with the specified name or Material.AIR

remove(Inventory inventory, Material type, int n) - Removes n items of Material from inventory

count(Inventory inventory, Material type) - Count of items with type 'type' in inventory

NumUtils

Utils for parsing time from string

formatDurationTicks(long) - Time in ticks to string in format hours:minutes:seconds

ticksFromString, millisFromString, secondsFromString, minutesFromString, hoursFromString, daysFromString All these functions convert a string to time.

Format of string

  • none - ticks (one second = 20 ticks)
  • s - seconds
  • m - minutes
  • h - hours
  • d - days

For example: "20 1s 2h"

PlayerUtils

uuidByName(String) - Returns uuid of player by name

RunnableX

Simplified syntax for BukkitRunnable For example:

((RunnableX)() -> System.out.println("test")).runTask(plugin);

MD5ColorUtils

translateHexColorCodes(String) - translates hex and legacy colors

UUIDSerializer

Serializer of UUID for kotlinx.serialization

@Serializable
data class RentalRecord(
    val tag: String,
    @Serializable(with = UUIDSerializer::class)
    val renter: UUID)

Clone this wiki locally