public class BeansLib extends Object
| Constructor and Description |
|---|
BeansLib() |
BeansLib(@Nullable org.bukkit.plugin.Plugin plugin)
Creates a new instance of the lib using a
Plugin implementation. |
| Modifier and Type | Method and Description |
|---|---|
String |
centerMessage(org.bukkit.entity.Player target,
org.bukkit.entity.Player parser,
String string)
Deprecated.
|
String |
colorize(org.bukkit.entity.Player target,
org.bukkit.entity.Player parser,
String string)
Formats an input string parsing first
PlaceholderAPI placeholders,
replaced chars and then applying the respective colors. |
String |
colorize(org.bukkit.entity.Player player,
String string)
Formats an input string parsing first
PlaceholderAPI placeholders,
replaced chars and then applying the respective colors. |
String |
colorize(String string)
Formats an input string parsing first
PlaceholderAPI placeholders,
replaced chars and then applying the respective colors. |
String |
convertToSmallCaps(String string) |
String |
createCenteredChatMessage(org.bukkit.entity.Player target,
org.bukkit.entity.Player parser,
String string)
Formats a string to a centered string, that has a perfect amount of spaces
before the actual string to be display in the chat as a centered message.
|
String |
createCenteredChatMessage(org.bukkit.entity.Player player,
String string)
Formats a string to a centered string, that has a perfect amount of spaces
before the actual string to be display in the chat as a centered message.
|
String |
createCenteredChatMessage(String string)
Formats a string to a centered string, that has a perfect amount of spaces
before the actual string to be display in the chat as a centered message.
|
void |
doLog(@Nullable org.bukkit.command.CommandSender sender,
String... lines)
Sends requested information to a
CommandSender using the plugin's
logger and its prefix. |
void |
doLog(String... lines)
Sends requested information to a
CommandSender using the plugin's
logger and its prefix. |
boolean |
equals(Object o) |
boolean |
fixColorLogger()
Deprecated.
check and/or set the "coloredConsole" variable
|
String |
formatPlaceholders(@Nullable org.bukkit.entity.Player parser,
String string) |
Pattern |
getBlankPattern()
Creates a new
Pattern instance using the defined blank-space
internal placeholder. |
Pattern |
getBossbarPattern()
Creates a new
Pattern instance using the defined custom bossbar
internal placeholder. |
Pattern |
getCharPattern()
Creates a new
Pattern instance using the defined char regex string. |
@NotNull org.bukkit.plugin.Plugin |
getPlugin()
The
Plugin instance of your project. |
Pattern |
getSmallCapsPattern()
Creates a new
Pattern instance using the defined SmallCaps
internal placeholder. |
void |
mixLog(org.bukkit.command.CommandSender sender,
String... lines)
Sends information choosing which of the two main methods will be used in each line.
|
void |
mixLog(String... lines)
Sends information choosing which of the two main methods will be used in each line.
|
String |
parseChars(String string)
Use a char pattern to find unicode values and replace them with
its respective characters.
|
String |
parsePlayerKeys(org.bukkit.entity.Player parser,
String string)
Deprecated.
|
String |
parsePlayerKeys(org.bukkit.entity.Player parser,
String string,
boolean c)
Deprecated.
|
void |
playerLog(@NotNull org.bukkit.entity.Player player,
String... lines)
Sends information to a player using the
MessageSender object. |
void |
rawLog(String... lines)
Sends requested information using
Bukkit.getLogger() to the console,
avoiding the plugin prefix. |
String |
replacePrefixKey(String string,
boolean remove)
Replace the
langPrefixKey with the langPrefix. |
void |
sendMessageList(org.bukkit.command.CommandSender sender,
org.bukkit.configuration.ConfigurationSection section,
String path)
Deprecated.
See
MessageSender and its constructor. |
void |
sendMessageList(org.bukkit.command.CommandSender sender,
org.bukkit.configuration.ConfigurationSection section,
String path,
String[] keys,
String[] values)
Deprecated.
See
MessageSender and its constructor. |
void |
sendMessageList(org.bukkit.command.CommandSender sender,
List<String> list)
Deprecated.
See
MessageSender and its constructor. |
void |
sendMessageList(org.bukkit.command.CommandSender sender,
List<String> list,
String[] keys,
String[] values)
Deprecated.
See
MessageSender and its constructor. |
BeansLib |
setKeysDelimiters(String start,
String end)
Sets the delimiters for the messages keys to identify what type of
message is a string to be displayed.
|
BeansLib |
setTitleTicks(int in,
int stay,
int out)
Sets the default title ticks values.
|
String[] |
splitLine(String s)
Creates a new string array from an input string using the
lineSeparator
as a split for the array. |
String[] |
splitLine(String s,
int limit)
Creates a new string array from an input string using the
lineSeparator
as a split for the array. |
public BeansLib(@Nullable
@Nullable org.bukkit.plugin.Plugin plugin)
Plugin implementation.
if the plugin instance is null, methods that use a plugin instance like logging with a plugin prefix, sending bossbar messages and others plugin-related will not work.
plugin - plugin's instancepublic BeansLib()
@NotNull
public @NotNull org.bukkit.plugin.Plugin getPlugin()
throws NullPointerException
Plugin instance of your project.NullPointerException - if the plugin is nullpublic final BeansLib setTitleTicks(int in, int stay, int out)
in - in server ticksstay - stay server ticksout - out server tickspublic final BeansLib setKeysDelimiters(String start, String end)
Example: default: [title] - custom: {{title}}
start - start delimiter stringend - end delimiter string@ApiStatus.ScheduledForRemoval(inVersion="1.4") @Deprecated public boolean fixColorLogger()
public String replacePrefixKey(String string, boolean remove)
langPrefixKey with the langPrefix.string - an input stringremove - if the prefix will be removedpublic String[] splitLine(String s, int limit)
lineSeparator
as a split for the array.
You can define the limit of the array.
s - an input stringlimit - a limitpublic String[] splitLine(String s)
lineSeparator
as a split for the array.s - an input stringpublic Pattern getCharPattern()
Pattern instance using the defined char regex string.public Pattern getBossbarPattern()
Pattern instance using the defined custom bossbar
internal placeholder.public Pattern getBlankPattern()
Pattern instance using the defined blank-space
internal placeholder.public Pattern getSmallCapsPattern()
Pattern instance using the defined SmallCaps
internal placeholder.public String parseChars(String string)
string - the input linepublic String formatPlaceholders(@Nullable @Nullable org.bukkit.entity.Player parser, String string)
public String colorize(org.bukkit.entity.Player target, org.bukkit.entity.Player parser, String string)
PlaceholderAPI placeholders,
replaced chars and then applying the respective colors.target - a target to parse colors depending on its client, can be nullparser - a player, can be nullstring - the input messagepublic String colorize(org.bukkit.entity.Player player, String string)
PlaceholderAPI placeholders,
replaced chars and then applying the respective colors.player - a player, can be nullstring - the input messagepublic String colorize(String string)
PlaceholderAPI placeholders,
replaced chars and then applying the respective colors.string - the input messagepublic String createCenteredChatMessage(org.bukkit.entity.Player target, org.bukkit.entity.Player parser, String string)
target - a target to parse colors depending on its client, can be nullparser - a player to parse placeholders.string - the input messagepublic String createCenteredChatMessage(org.bukkit.entity.Player player, String string)
player - a player to parse placeholders.string - the input messagepublic String createCenteredChatMessage(String string)
string - the input message@ApiStatus.ScheduledForRemoval(inVersion="1.4") @Deprecated public String centerMessage(org.bukkit.entity.Player target, org.bukkit.entity.Player parser, String string)
@ApiStatus.ScheduledForRemoval(inVersion="1.4") @Deprecated public final String parsePlayerKeys(org.bukkit.entity.Player parser, String string, boolean c)
PlayerKey.replaceKeys(Player, String, boolean)parser - a playerstring - an input stringc - if keys are case-sensitive@ApiStatus.ScheduledForRemoval(inVersion="1.4") @Deprecated public final String parsePlayerKeys(org.bukkit.entity.Player parser, String string)
PlayerKey.replaceKeys(Player, String)parser - a playerstring - an input stringpublic final void playerLog(@NotNull
@NotNull org.bukkit.entity.Player player,
String... lines)
MessageSender object.player - a valid playerlines - the information to sendpublic final void rawLog(String... lines)
Bukkit.getLogger() to the console,
avoiding the plugin prefix.lines - the information to sendpublic final void doLog(@Nullable
@Nullable org.bukkit.command.CommandSender sender,
String... lines)
CommandSender using the plugin's
logger and its prefix.
If the sender is a Player and it's not null, it will log using
playerLog(Player, String...).
sender - a valid sender, can be the console, a player or nulllines - the information to sendNullPointerException - if the plugin is nullpublic final void doLog(String... lines)
CommandSender using the plugin's
logger and its prefix.lines - the information to sendNullPointerException - if the plugin is nullpublic final void mixLog(org.bukkit.command.CommandSender sender,
String... lines)
rawLog, doLog)
If the line does not start with a boolean value or that value is false,
it will use the doLog method, otherwise
will use the rawLog method.
"My information for the console" >> // Uses "doLog"
"true::My basic log information" >> // Uses "rawLog"
"false::Some plugin's information" >> // Uses "doLog"
"" or null >> // Uses "doLog", 'cause is empty/null
sender - a valid sender, can be the console, a player or nulllines - the information to sendpublic final void mixLog(String... lines)
rawLog, doLog)
If the line does not start with a boolean value or that value is false,
it will use the doLog method, otherwise
will use the rawLog method.
"My information for the console" >> // Uses "doLog"
"true::My basic log information" >> // Uses "rawLog"
"false::Some plugin's information" >> // Uses "doLog"
"" or null >> // Uses "doLog", 'cause is empty/null
lines - the information to send@ApiStatus.ScheduledForRemoval(inVersion="1.4") @Deprecated public void sendMessageList(org.bukkit.command.CommandSender sender, List<String> list, String[] keys, String[] values)
MessageSender and its constructor.TextUtils.replaceInsensitiveEach(String[], String[], String)sender - a sender to format and send the messagelist - the message listkeys - a keys arrayvalues - a values array@ApiStatus.ScheduledForRemoval(inVersion="1.4") @Deprecated public void sendMessageList(org.bukkit.command.CommandSender sender, org.bukkit.configuration.ConfigurationSection section, String path, String[] keys, String[] values)
MessageSender and its constructor.TextUtils.replaceInsensitiveEach(String[], String[], String)sender - a sender to format and send the messagesection - the config file or sectionpath - the path of the string or string listkeys - a keys arrayvalues - a values array@ApiStatus.ScheduledForRemoval(inVersion="1.4") @Deprecated public void sendMessageList(org.bukkit.command.CommandSender sender, List<String> list)
MessageSender and its constructor.TextUtils.replaceInsensitiveEach(String[], String[], String)sender - a sender to format and send the messagelist - the message list@ApiStatus.ScheduledForRemoval(inVersion="1.4") @Deprecated public void sendMessageList(org.bukkit.command.CommandSender sender, org.bukkit.configuration.ConfigurationSection section, String path)
MessageSender and its constructor.TextUtils.replaceInsensitiveEach(String[], String[], String)sender - a sender to format and send the messagesection - the config file or sectionpath - the path of the string or string listCopyright © 2023. All rights reserved.