Skip to content

πŸ’¬ Chat Module

Gustavo M. Paes edited this page Sep 23, 2021 · 1 revision

Classes:

Methods:

Events:

Need declare Intent.CHAT to Work


ChatMessage(String msg, Sound? sound, ClickEvent? clickEvent, HoverEvent? hoverEvent) -> ChatMessage

  • msg is the message
  • sound is the sound that will play when receiving the message. Optional
  • clickEvent event when clicking in the message on chat. Optional
  • hoverEvent event when hovering the cursor in the message on chat. Optional

Class with information of message templates that you can create a pattern


Mars.chat.registerChatMessage(String key, [ChatMessage](#ChatMessage) chatMessage) -> void

  • key is the message pattern key
  • chatMessage is the class with message templates

Register a message template in your plugin


Mars.chat.send(Player pl, String messageKey, String message, boolean? supressSound) -> void

  • pl is the player will receive the message
  • messageKey is the message template key (you declare in registerChatMessage)
  • message is the message will gonna be message template text + message
  • supressSound will suppress the sound from the template. Optional

Send a player message with a pattern

Mars.chat.send(Player pl, String messageKey, Hashmap<String, String> replacer, boolean? supressSound) -> void

  • pl is the player will receive the message
  • messageKey is the message template key (you declare in registerChatMessage)
  • replacer is a hashmap with 2 Strings, the first one is a replacer like '[player'] and the second one is the value is gonna be replaced like 'GumpDev'
  • supressSound will suppress the sound from the template. Optional

Send a player message with a pattern


Mars.chat.getVolume() -> float

Gets the volume of the sound will play when the player receives the message


Mars.chat.setVolume(float volume) -> void

  • volume is the new volume

Sets the volume of the sound will play when the player receives the message


Mars.chat.getPitch() -> float

Gets the pitch of the sound will play when the player receives the message


Mars.chat.setPitch(float pitch) -> void

  • pitch is the new pitch

Sets the pitch of the sound will play when the player receives the message


Mars.chat.onSay(Player pl, ChatEvent event) -> void

Will listen to the next message of a player in the chat


Mars.chat.removeEvent(Player pl) -> void

  • pl is the player will be unlisten

Will remove onSay event from a player