Package xyz.srnyx.annoyingapi.utility
Class BukkitUtility
- java.lang.Object
-
- xyz.srnyx.annoyingapi.utility.BukkitUtility
-
public class BukkitUtility extends java.lang.ObjectUtility methods relating to Bukkit
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static @NotNull java.lang.Stringcolor(@Nullable java.lang.Object object)Translates&color codes toChatColorstatic @NotNull java.util.List<java.lang.String>colorCollection(@Nullable java.util.Collection<?> objects)Translates&color codes toChatColorfor aCollectionof messagesstatic @NotNull java.util.Set<java.lang.String>getAllPlayerNames()Gets aSetof all player namesstatic @NotNull java.util.Optional<org.bukkit.OfflinePlayer>getOfflinePlayer(@NotNull java.lang.String name)Gets anOfflinePlayerfrom the specified name
Returns aPlayerif they're onlinestatic @NotNull java.util.Set<java.lang.String>getOfflinePlayerNames()Gets aSetof all offline player namesstatic @NotNull java.util.Set<java.lang.String>getOnlinePlayerNames()Gets aSetof all online player namesstatic @NotNull java.util.Optional<java.lang.Integer>getPermissionValue(@NotNull org.bukkit.entity.Player player, @NotNull java.lang.String permission)Gets the value of a permission node from aPlayer
Example:playerhasfriends.max.5permission,getPermissionValue(player, "friends.max.")would return5static @NotNull java.util.Set<java.lang.String>getWorldNames()Gets aSetof all world namesstatic @NotNull java.lang.StringstripUntranslatedColor(@Nullable java.lang.String string)Strips untranslatedChatColors(using&) from aStringstatic booleantoggleScoreboardTag(@NotNull org.bukkit.entity.Entity entity, @NotNull java.lang.String scoreboardTag)Toggles a scoreboard tag on anEntity
-
-
-
Method Detail
-
color
@NotNull public static @NotNull java.lang.String color(@Nullable @Nullable java.lang.Object object)Translates&color codes toChatColor- Parameters:
object- the object/message to translate- Returns:
- the translated object/message
-
colorCollection
@NotNull public static @NotNull java.util.List<java.lang.String> colorCollection(@Nullable @Nullable java.util.Collection<?> objects)Translates&color codes toChatColorfor aCollectionof messages- Parameters:
objects- the objects/messages to translate- Returns:
- the translated objects/messages
-
stripUntranslatedColor
@NotNull public static @NotNull java.lang.String stripUntranslatedColor(@Nullable @Nullable java.lang.String string)Strips untranslatedChatColors(using&) from aString- Parameters:
string- theStringto strip- Returns:
- the stripped
String
-
toggleScoreboardTag
public static boolean toggleScoreboardTag(@NotNull @NotNull org.bukkit.entity.Entity entity, @NotNull @NotNull java.lang.String scoreboardTag)Toggles a scoreboard tag on anEntity- Parameters:
entity- theEntityto toggle the scoreboard tag onscoreboardTag- the scoreboard tag to toggle- Returns:
- true if the scoreboard tag was added, false if it was removed (or if it failed)
-
getPermissionValue
@NotNull public static @NotNull java.util.Optional<java.lang.Integer> getPermissionValue(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull java.lang.String permission)Gets the value of a permission node from aPlayer
Example:playerhasfriends.max.5permission,getPermissionValue(player, "friends.max.")would return5- Parameters:
player- thePlayerto get the permission value frompermission- the permission node to get the value of- Returns:
- the value of the permission node, or empty if not found
-
getOfflinePlayer
@NotNull public static @NotNull java.util.Optional<org.bukkit.OfflinePlayer> getOfflinePlayer(@NotNull @NotNull java.lang.String name)Gets anOfflinePlayerfrom the specified name
Returns aPlayerif they're online- Parameters:
name- the name of the player- Returns:
- the
OfflinePlayer, or empty if not found
-
getOnlinePlayerNames
@NotNull public static @NotNull java.util.Set<java.lang.String> getOnlinePlayerNames()
Gets aSetof all online player names- Returns:
- the
Setof player names
-
getOfflinePlayerNames
@NotNull public static @NotNull java.util.Set<java.lang.String> getOfflinePlayerNames()
Gets aSetof all offline player names- Returns:
- the
Setof player names
-
getAllPlayerNames
@NotNull public static @NotNull java.util.Set<java.lang.String> getAllPlayerNames()
Gets aSetof all player names- Returns:
- the
Setof player names
-
getWorldNames
@NotNull public static @NotNull java.util.Set<java.lang.String> getWorldNames()
Gets aSetof all world names- Returns:
- the
Setof world names
-
-