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.StringableRepresents a message from theMessagesOptions.fileNamefile
-
-
Constructor Summary
Constructors Constructor Description AnnoyingMessage(@NotNull AnnoyingPlugin plugin, @NotNull java.lang.String key)Constructs a newAnnoyingMessagewith the specified key and PAPI placeholders enabledAnnoyingMessage(@NotNull AnnoyingPlugin plugin, @NotNull java.lang.String key, boolean parsePapiPlaceholders)Constructs a newAnnoyingMessagewith the specified keyAnnoyingMessage(@NotNull AnnoyingMessage message)Constructs a newAnnoyingMessagefrom anotherAnnoyingMessage(copy constructor)AnnoyingMessage(@NotNull AnnoyingMessage message, @NotNull java.lang.String newKey)Constructs a newAnnoyingMessagefrom anotherAnnoyingMessagewith a new key
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbroadcast(@NotNull BroadcastType type)Broadcasts the message with the specifiedBroadcastTypeand default title parametersvoidbroadcast(@NotNull BroadcastType type, @Nullable java.lang.Integer fadeIn, @Nullable java.lang.Integer stay, @Nullable java.lang.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 java.lang.Integer fadeIn, @Nullable java.lang.Integer stay, @Nullable java.lang.Integer fadeOut)Broadcasts the message with the specifiedBroadcastTypeand title parameters.@NotNull net.md_5.bungee.api.chat.BaseComponent[]getComponents()RunsgetComponents(AnnoyingSender)usingnull@NotNull net.md_5.bungee.api.chat.BaseComponent[]getComponents(@Nullable AnnoyingSender sender)Gets the message inBaseComponentsvoidlog()Runslog(Level)usingnullvoidlog(@Nullable java.util.logging.Level level)Logs the message to the console with the specifiedLevel@NotNull AnnoyingMessagereplace(@NotNull java.lang.String before, @Nullable java.lang.Object after)Replace aStringin the message with anotherObject@NotNull AnnoyingMessagereplace(@NotNull java.lang.String placeholder, @Nullable java.lang.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 java.lang.StringtoString()RunstoString(AnnoyingSender)usingnull@NotNull java.lang.StringtoString(@Nullable AnnoyingSender sender)Gets the message usinggetComponents(AnnoyingSender)then joins theBaseComponents together
-
-
-
Constructor Detail
-
AnnoyingMessage
public AnnoyingMessage(@NotNull @NotNull AnnoyingPlugin plugin, @NotNull @NotNull java.lang.String key, boolean parsePapiPlaceholders)Constructs a newAnnoyingMessagewith the specified key- Parameters:
plugin-pluginkey-keyparsePapiPlaceholders-parsePapiPlaceholders
-
AnnoyingMessage
public AnnoyingMessage(@NotNull @NotNull AnnoyingPlugin plugin, @NotNull @NotNull java.lang.String key)Constructs a newAnnoyingMessagewith the specified key and PAPI placeholders enabled- Parameters:
plugin-pluginkey-key
-
AnnoyingMessage
public AnnoyingMessage(@NotNull @NotNull AnnoyingMessage message)Constructs a newAnnoyingMessagefrom anotherAnnoyingMessage(copy constructor)- Parameters:
message- theAnnoyingMessageto copy
-
AnnoyingMessage
public AnnoyingMessage(@NotNull @NotNull AnnoyingMessage message, @NotNull @NotNull java.lang.String newKey)Constructs a newAnnoyingMessagefrom anotherAnnoyingMessagewith a new key- Parameters:
message- theAnnoyingMessageto copynewKey- the new key to use
-
-
Method Detail
-
replace
@NotNull public @NotNull AnnoyingMessage replace(@NotNull @NotNull java.lang.String placeholder, @Nullable @Nullable java.lang.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(String, Object),ReplaceType
-
replace
@NotNull public @NotNull AnnoyingMessage replace(@NotNull @NotNull java.lang.String before, @Nullable @Nullable java.lang.Object after)
Replace aStringin the message with anotherObject- Parameters:
before- theStringto replaceafter- theObjectto replace with- Returns:
- the updated
AnnoyingMessageinstance - See Also:
replace(String, Object, xyz.srnyx.annoyingapi.message.ReplaceType)
-
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:
send(AnnoyingSender)
-
getComponents
@NotNull public @NotNull net.md_5.bungee.api.chat.BaseComponent[] getComponents()
RunsgetComponents(AnnoyingSender)usingnull- Returns:
- the message in
BaseComponents - See Also:
send(AnnoyingSender),getComponents(AnnoyingSender)
-
toString
@NotNull public @NotNull java.lang.String toString(@Nullable @Nullable AnnoyingSender sender)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:
getComponents(AnnoyingSender)
-
toString
@NotNull public @NotNull java.lang.String 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:
getComponents(),toString(AnnoyingSender)
-
broadcast
public void broadcast(@NotNull @NotNull BroadcastType type, @Nullable @Nullable AnnoyingSender sender, @Nullable @Nullable java.lang.Integer fadeIn, @Nullable @Nullable java.lang.Integer stay, @Nullable @Nullable java.lang.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(BroadcastType, Integer, Integer, Integer),broadcast(BroadcastType, AnnoyingSender),broadcast(BroadcastType)
-
broadcast
public void broadcast(@NotNull @NotNull BroadcastType type, @Nullable @Nullable java.lang.Integer fadeIn, @Nullable @Nullable java.lang.Integer stay, @Nullable @Nullable java.lang.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(BroadcastType, AnnoyingSender, Integer, Integer, Integer)
-
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(BroadcastType, AnnoyingSender, Integer, Integer, Integer)
-
broadcast
public void broadcast(@NotNull @NotNull BroadcastType type)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:
broadcast(BroadcastType, AnnoyingSender, Integer, Integer, Integer)
-
send
public void send(@NotNull @NotNull AnnoyingSender sender)Sends the message to the specifiedAnnoyingSender- Parameters:
sender- theAnnoyingSenderto send the message to- See Also:
send(CommandSender),getComponents(AnnoyingSender)
-
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:
send(AnnoyingSender)
-
log
public void log(@Nullable @Nullable java.util.logging.Level level)Logs the message to the console with the specifiedLevel- Parameters:
level- theLevelto log with
-
log
public void log()
Runslog(Level)usingnull
-
-