Interface IMessageable
- All Known Subinterfaces:
ICommandSender, IPlayer, IServer
- All Known Implementing Classes:
SpigotServer, WrappedOfflinePlayer, WrappedPlayer
public interface IMessageable
Represents objects that can receive messages.
-
Method Summary
Modifier and TypeMethodDescriptionCreates a newPersonalizedLocalizerusing the localizer and locale of this messageable.Gets the text factory of this messageable.default TextnewText()Creates a newTextusing the text factory of this messageable.default voidsendError(String key, Text.ArgumentCreator... args) Sends an error message to this messageable.default voidsendInfo(String key, Text.ArgumentCreator... args) Sends a info message to this object.voidsendMessage(Text text) Sends a message to this object.default voidsendMessage(TextType textType, String key, Text.ArgumentCreator... args) Sends a message to this object.default voidsendSuccess(String key, Text.ArgumentCreator... args) Sends a success message to this object.
-
Method Details
-
sendMessage
Sends a message to this object.- Parameters:
text- The message to send. This may or may not contain formatting.
-
getTextFactory
ITextFactory getTextFactory()Gets the text factory of this messageable.- Returns:
- The text factory of this messageable.
-
getPersonalizedLocalizer
PersonalizedLocalizer getPersonalizedLocalizer()Creates a newPersonalizedLocalizerusing the localizer and locale of this messageable.- Returns:
- A new
PersonalizedLocalizerobject.
-
newText
-
sendMessage
Sends a message to this object.This is a shortcut for
sendMessage(Text).- Parameters:
textType- TheTextTypeto use for the message to send.key- The key of the error message. E.g.constants.error.generic.args- The arguments to use for the message.
-
sendError
Sends an error message to this messageable.This is a shortcut for
sendMessage(TextType, String, Text.ArgumentCreator...)with theTextType.ERRORtype.- Parameters:
key- The key of the error message. E.g.constants.error.generic.args- The arguments to use for the message, if any.
-
sendSuccess
Sends a success message to this object.This is a shortcut for
sendMessage(TextType, String, Text.ArgumentCreator...)with theTextType.SUCCESStype.- Parameters:
key- The key of the error message. E.g.constants.error.generic.args- The arguments to use for the message, if any.
-
sendInfo
Sends a info message to this object.This is a shortcut for
sendMessage(TextType, String, Text.ArgumentCreator...)with theTextType.INFOtype.- Parameters:
key- The key of the error message. E.g.constants.error.generic.args- The arguments to use for the message, if any.
-