feat: 新增聊天相关API
This commit is contained in:
parent
a041e8e2d2
commit
3df2625e65
9
src/main/resources/api/chat.js
Normal file
9
src/main/resources/api/chat.js
Normal file
@ -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;
|
8
src/main/resources/internal/bukkit/chat.js
Normal file
8
src/main/resources/internal/bukkit/chat.js
Normal file
@ -0,0 +1,8 @@
|
||||
/*global Java, base, module, exports, require*/
|
||||
function json(sender, json) {
|
||||
|
||||
}
|
||||
|
||||
exports = module.exports = {
|
||||
json: json
|
||||
};
|
9
src/main/resources/internal/sponge/chat.js
Normal file
9
src/main/resources/internal/sponge/chat.js
Normal file
@ -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
Block a user