feat: 新增聊天相关API
parent
a041e8e2d2
commit
3df2625e65
|
@ -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;
|
|
@ -0,0 +1,8 @@
|
|||
/*global Java, base, module, exports, require*/
|
||||
function json(sender, json) {
|
||||
|
||||
}
|
||||
|
||||
exports = module.exports = {
|
||||
json: json
|
||||
};
|
|
@ -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
|
||||
};
|
Loading…
Reference in New Issue