-
Notifications
You must be signed in to change notification settings - Fork 1
Utilities and Helpers
Griffin Kubesa edited this page Nov 27, 2019
·
4 revisions
Will move to a javadoc soon:tm:
-
void log(message)- Log a message -
void warn(message)- Log a warning -
void severe(message)- Log an error -
void registerListener(listener)- Registers an EventListener with the server
-
String colorize(text)- Turn color codes into real colors -
String right(string, number)- Get the rightmost x characters of a string -
String left(string, number)- Get the leftmost x characters of a string
Borrowed from the language ColdFusion, lists are just strings separated by something.
-
String listFirst(string, delimiter)- Get the first value in a list -
String listLast(string, delimiter)- Get the last value in a list -
String listGetAt(string, index, delimiter)- Get the value at an index in a list (starts at 1)
-
void wait(delay, runnable)- Wait x milliseconds, then execute a task -
int repeat(startDelay, interval, runnable)- Repeat a task. Returns taskId -
int async(runnable)- Run a task asynchronously. Returns taskId -
void cancelTask(taskId)- Cancel a task
boolean isVanished(player)boolean isAfk(player)boolean isAfk(nerd)List<String> getOnlineUuids()OfflinePlayer getPlayer(uuid)OfflinePlayer getPlayer(partialName)-
void giveItem(player, item)- Gives an item to a player, dropping excess on the floor -
void giveItems(player, items)- Gives items to a player, dropping excess on the floor String getRankDisplay(player)
-
String getPrefix(text)- Get a formatted prefix -
String camelCase(text)- Turn a space or underscore delimited string into camel case LocalDateTime timestamp(timestamp)String timespanFormat(seconds)
-
void callEvent(event)- Call a Bukkit event -
void dump(object)- Dump an object to console
Follows the Builder Pattern.
ItemStack item = new ItemStackBuilder(Material.APPLE)
.amount(20)
.name("Chomp")
.enchantment(Enchantment.MENDING)
.build();amount(amount)name(displayName)lore(lore)enchant(enchantment)enchant(enchantment, level)enchant(enchantment, level, ignoreLevelRestriction)effect(potionEffectType)effect(potionEffectType, seconds)effect(potionEffectType, seconds, amplifier)itemFlags(flags)