public class ChatAPI
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
ChatAPI.ChatMessageType
Enum of the available ChatMessageTypes
|
Modifier and Type | Field and Description |
---|---|
static java.lang.reflect.Method |
fromICBC
Method for converting IChatBaseComponent to raw JSON.
|
static java.lang.Class |
icbcClass
The IChatBaseComponent class
|
static java.lang.reflect.Method |
toICBC
Method for converting raw json to IChatBaseComponent.
|
Constructor and Description |
---|
ChatAPI()
|
Modifier and Type | Method and Description |
---|---|
static void |
init()
Initializes the ChatAPI.
|
static java.lang.String |
quoteJson(java.lang.String value)
Converts a string to it's json format
|
static void |
sendJsonMsg(ChatAPI.ChatMessageType type,
java.lang.String msg,
java.util.Collection<? extends org.bukkit.entity.Player> pls)
Sends the given type json message to the given players or to
every online player
|
static void |
sendJsonMsg(ChatAPI.ChatMessageType type,
java.lang.String msg,
org.bukkit.entity.Player... pls)
Sends the given type json message to the given players or to
every online player
|
static void |
sendRawJson(ChatAPI.ChatMessageType type,
java.lang.String json,
java.util.Collection<? extends org.bukkit.entity.Player> pls)
Sends a raw Json message to the given players
|
static void |
sendRawJson(ChatAPI.ChatMessageType type,
java.lang.String json,
org.bukkit.entity.Player... pls)
Sends a raw Json message to the given players
|
static java.lang.String |
TextToJson(java.lang.String msg)
Converts the given message to raw JSON format
|
static java.lang.Object |
toICBC(java.lang.String json)
Converts a raw json message to vanilla IChatBaseComponent
|
static java.lang.String |
toJson(java.lang.Object icbc)
Converts a vanilla IChatBaseComponent to a raw Json message
|
static java.lang.String |
unicodeEscape(char ch)
Escapes an unicode character
|
public static java.lang.reflect.Method fromICBC
public static java.lang.Class icbcClass
public static java.lang.reflect.Method toICBC
public static java.lang.String TextToJson(java.lang.String msg)
msg
- - The messagepublic static void init()
public static java.lang.String quoteJson(java.lang.String value)
value
- - The convertable Stringpublic static void sendJsonMsg(ChatAPI.ChatMessageType type, java.lang.String msg, org.bukkit.entity.Player... pls)
type
- - The type of the sendable JSON messagemsg
- - The json messagepls
- - The receiver list, if it is empty then all the online
players will get the message
public static void sendJsonMsg(ChatAPI.ChatMessageType type, java.lang.String msg, java.util.Collection<? extends org.bukkit.entity.Player> pls)
type
- - The type of the sendable JSON messagemsg
- - The json messagepls
- - The receiver list, if it is empty then all the online
players will get the message
public static void sendRawJson(ChatAPI.ChatMessageType type, java.lang.String json, org.bukkit.entity.Player... pls)
type
- - The type of the sendable JSON messagejson
- - The raw jsonpls
- - The receiver listpublic static void sendRawJson(ChatAPI.ChatMessageType type, java.lang.String json, java.util.Collection<? extends org.bukkit.entity.Player> pls)
type
- - The type of the sendable JSON messagejson
- - The raw jsonpls
- - The receiver listpublic static java.lang.Object toICBC(java.lang.String json)
json
- - The raw jsonpublic static java.lang.String toJson(java.lang.Object icbc)
icbc
- - The vanilla IChatBaseComponentpublic static java.lang.String unicodeEscape(char ch)
ch
- - The escapeable character