diff --git a/src/main/resources/api/chat.js b/src/main/resources/api/chat.js new file mode 100644 index 0000000..2c2cdc5 --- /dev/null +++ b/src/main/resources/api/chat.js @@ -0,0 +1,9 @@ +/*global Java, base, module, exports, require*/ +function ChatHandlerDefault() { + this.tellraw = function(sender, raw) { + this.json(sender, JSON.stringify(raw)); + } +} +var ChatHandler = Object.assign(new ChatHandlerDefault(), requireInternal('chat')); + +exports = module.exports = ChatHandler; \ No newline at end of file diff --git a/src/main/resources/internal/bukkit/chat.js b/src/main/resources/internal/bukkit/chat.js new file mode 100644 index 0000000..1db8c33 --- /dev/null +++ b/src/main/resources/internal/bukkit/chat.js @@ -0,0 +1,8 @@ +/*global Java, base, module, exports, require*/ +function json(sender, json) { + +} + +exports = module.exports = { + json: json +}; \ No newline at end of file diff --git a/src/main/resources/internal/sponge/chat.js b/src/main/resources/internal/sponge/chat.js new file mode 100644 index 0000000..dc15b8b --- /dev/null +++ b/src/main/resources/internal/sponge/chat.js @@ -0,0 +1,9 @@ +/*global Java, base, module, exports, require*/ +var TextSerializers = Java.type('org.spongepowered.api.text.serializer.TextSerializers'); +function json(sender, json) { + sender.sendMessage(TextSerializers.JSON.deserialize(json)); +} + +exports = module.exports = { + json: json +}; \ No newline at end of file