feat: 新增聊天相关API
This commit is contained in:
		
							
								
								
									
										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
 | 
			
		||||
};
 | 
			
		||||
		Reference in New Issue
	
	Block a user