Package xyz.srnyx.annoyingapi.message
Class AnnoyingMessage
java.lang.Object
xyz.srnyx.javautilities.parents.Stringable
xyz.srnyx.annoyingapi.message.AnnoyingMessage
public class AnnoyingMessage
extends xyz.srnyx.javautilities.parents.Stringable
Represents a message from the
MessagesOptions.fileName file-
Constructor Summary
ConstructorsConstructorDescriptionAnnoyingMessage(@NotNull AnnoyingPlugin plugin, @NotNull String key) Constructs a newAnnoyingMessagewith the specified key and PAPI placeholders enabledAnnoyingMessage(@NotNull AnnoyingPlugin plugin, @NotNull String key, boolean parsePapiPlaceholders) Constructs a newAnnoyingMessagewith the specified keyAnnoyingMessage(@NotNull AnnoyingMessage message) Constructs a newAnnoyingMessagefrom anotherAnnoyingMessage(copy constructor)AnnoyingMessage(@NotNull AnnoyingMessage message, @NotNull String newKey) Constructs a newAnnoyingMessagefrom anotherAnnoyingMessagewith a new key -
Method Summary
Modifier and TypeMethodDescriptionvoidbroadcast(@NotNull BroadcastType type) Broadcasts the message with the specifiedBroadcastTypeand default title parametersvoidbroadcast(@NotNull BroadcastType type, @Nullable Integer fadeIn, @Nullable Integer stay, @Nullable Integer fadeOut) Broadcasts the message with the specifiedBroadcastTypeand title parametersvoidbroadcast(@NotNull BroadcastType type, @Nullable AnnoyingSender sender) Broadcasts the message with the specifiedBroadcastType,AnnoyingSender, and default title parametersvoidbroadcast(@NotNull BroadcastType type, @Nullable AnnoyingSender sender, @Nullable Integer fadeIn, @Nullable Integer stay, @Nullable Integer fadeOut) Broadcasts the message with the specifiedBroadcastTypeand title parameters.@NotNull net.md_5.bungee.api.chat.BaseComponent[]RunsgetComponents(AnnoyingSender)usingnull@NotNull net.md_5.bungee.api.chat.BaseComponent[]getComponents(@Nullable AnnoyingSender sender) Gets the message inBaseComponentsvoidlog()Runslog(Level)usingnullvoidLogs the message to the console with the specifiedLevel@NotNull AnnoyingMessage@NotNull AnnoyingMessagereplace(@NotNull String placeholder, @Nullable Object value, @Nullable ReplaceType type) replace(String, Object)except using parameter placeholdersvoidsend(@NotNull org.bukkit.command.CommandSender sender) Sends the message to the specifiedCommandSendervoidsend(@NotNull AnnoyingSender sender) Sends the message to the specifiedAnnoyingSender@NotNull StringtoString()RunstoString(AnnoyingSender)usingnull@NotNull StringtoString(@Nullable AnnoyingSender sender) Gets the message usinggetComponents(AnnoyingSender)then joins theBaseComponents togetherMethods inherited from class xyz.srnyx.javautilities.parents.Stringable
toString, toString, toString, toString
-
Constructor Details
-
AnnoyingMessage
public AnnoyingMessage(@NotNull @NotNull AnnoyingPlugin plugin, @NotNull @NotNull String key, boolean parsePapiPlaceholders) Constructs a newAnnoyingMessagewith the specified key- Parameters:
plugin-pluginkey-keyparsePapiPlaceholders-parsePapiPlaceholders
-
AnnoyingMessage
Constructs a newAnnoyingMessagewith the specified key and PAPI placeholders enabled- Parameters:
plugin-pluginkey-key
-
AnnoyingMessage
Constructs a newAnnoyingMessagefrom anotherAnnoyingMessage(copy constructor)- Parameters:
message- theAnnoyingMessageto copy
-
AnnoyingMessage
Constructs a newAnnoyingMessagefrom anotherAnnoyingMessagewith a new key- Parameters:
message- theAnnoyingMessageto copynewKey- the new key to use
-
-
Method Details
-
replace
@NotNull public @NotNull AnnoyingMessage replace(@NotNull @NotNull String placeholder, @Nullable @Nullable Object value, @Nullable @Nullable ReplaceType type) replace(String, Object)except using parameter placeholders- Parameters:
placeholder- the placeholder to replace (must have%on both sides)value- theObjectto replace withtype- theDefaultReplaceTypeto use. Ifnull, the replacement will be treated normally- Returns:
- the updated
AnnoyingMessageinstance - See Also:
-
replace
@NotNull public @NotNull AnnoyingMessage replace(@NotNull @NotNull String before, @Nullable @Nullable Object after) - Parameters:
before- theStringto replaceafter- theObjectto replace with- Returns:
- the updated
AnnoyingMessageinstance - See Also:
-
getComponents
@NotNull public @NotNull net.md_5.bungee.api.chat.BaseComponent[] getComponents(@Nullable @Nullable AnnoyingSender sender) Gets the message inBaseComponents- Parameters:
sender- theAnnoyingSenderto use- Returns:
- the message in
BaseComponents - See Also:
-
getComponents
@NotNull public @NotNull net.md_5.bungee.api.chat.BaseComponent[] getComponents()RunsgetComponents(AnnoyingSender)usingnull- Returns:
- the message in
BaseComponents - See Also:
-
toString
Gets the message usinggetComponents(AnnoyingSender)then joins theBaseComponents togetherThis will only have the display text of the components, use
getComponents(AnnoyingSender)for all parts- Parameters:
sender- theAnnoyingSenderto use- Returns:
- the message
- See Also:
-
toString
RunstoString(AnnoyingSender)usingnullThis will only have the display text of the components, use
getComponents()for all parts- Overrides:
toStringin classxyz.srnyx.javautilities.parents.Stringable- Returns:
- the message
- See Also:
-
broadcast
public void broadcast(@NotNull @NotNull BroadcastType type, @Nullable @Nullable AnnoyingSender sender, @Nullable @Nullable Integer fadeIn, @Nullable @Nullable Integer stay, @Nullable @Nullable Integer fadeOut) Broadcasts the message with the specifiedBroadcastTypeand title parameters.fadeIn,stay, andfadeOutare 1.11+ only and will be ignored on older versions- Parameters:
type- theBroadcastTypeto broadcast withsender- theAnnoyingSenderto usefadeIn- the fade in time for the titlestay- the stay time for the titlefadeOut- the fade out time for the title- See Also:
-
broadcast
public void broadcast(@NotNull @NotNull BroadcastType type, @Nullable @Nullable Integer fadeIn, @Nullable @Nullable Integer stay, @Nullable @Nullable Integer fadeOut) Broadcasts the message with the specifiedBroadcastTypeand title parametersThis is equivalent to calling
broadcast(BroadcastType, AnnoyingSender, Integer, Integer, Integer)withnullforsender- Parameters:
type- theBroadcastTypeto broadcast withfadeIn- the fade in time for the titlestay- the stay time for the titlefadeOut- the fade out time for the title- See Also:
-
broadcast
public void broadcast(@NotNull @NotNull BroadcastType type, @Nullable @Nullable AnnoyingSender sender) Broadcasts the message with the specifiedBroadcastType,AnnoyingSender, and default title parametersThis is equivalent to calling
broadcast(BroadcastType, AnnoyingSender, Integer, Integer, Integer)withnullfor all title parameters- Parameters:
type- theBroadcastTypeto broadcast withsender- theAnnoyingSenderto use- See Also:
-
broadcast
Broadcasts the message with the specifiedBroadcastTypeand default title parametersThis is equivalent to calling
broadcast(BroadcastType, AnnoyingSender, Integer, Integer, Integer)withnullfor all other parameters- Parameters:
type- theBroadcastTypeto broadcast with- See Also:
-
send
Sends the message to the specifiedAnnoyingSender- Parameters:
sender- theAnnoyingSenderto send the message to- See Also:
-
send
public void send(@NotNull @NotNull org.bukkit.command.CommandSender sender) Sends the message to the specifiedCommandSenderThis will convert the
CommandSenderto aAnnoyingSenderand then runsend(AnnoyingSender)- Parameters:
sender- theCommandSenderto send the message to- See Also:
-
log
Logs the message to the console with the specifiedLevel- Parameters:
level- theLevelto log with
-
log
public void log()Runslog(Level)usingnull
-