我也不知道改了什么,理论上什么都没改

This commit is contained in:
EillesWan 2022-01-23 21:56:48 +08:00
parent 5b6ff5ee68
commit dda78ab35f
28 changed files with 54 additions and 9 deletions

26
fcwslib/__init__.py Normal file
View File

@ -0,0 +1,26 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
__version__ = '0.0.1'
__all__ = []
__author__ = 'Fuckcraft <https://gitee.com/fuckcraft>'
'''
Fuckcraft Websocket Library (FCWSLIB)
A library to develop minecraft websocket server easily.
Copyright (C) 2021 Fuckcraft
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
'''
from main import *

View File

@ -5,6 +5,23 @@ __version__ = '0.0.1'
__all__ = ['run_server', 'subscribe', 'unsubscribe', 'send_command', 'tellraw']
__author__ = 'Fuckcraft <https://gitee.com/fuckcraft>'
'''
Fuckcraft Websocket Library (FCWSLIB)
A library to develop minecraft websocket server easily.
Copyright (C) 2021 Fuckcraft
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
'''
import os
import json
import uuid
@ -19,11 +36,11 @@ import websockets
# 此函数用于向 Minecraft 订阅请求
async def subscribe(websocket, event_name):
'''
参数:
输入:
: websocket : websocket 对象 :
: event_name : 需要订阅的请求 :
返回:
输出:
None
'''
@ -48,17 +65,17 @@ async def subscribe(websocket, event_name):
# 此函数用于向 Minecraft 消除订阅请求
async def unsubscribe(webscket):
'''
参数:
输入:
: websocket : websocket 对象 :
: event_name : 需要消除订阅的请求 :
返回:
输出:
None
'''
response = {
"body": {
"eventName": str(event_name) # PlayerMessage
"eventName": str(event_name) # 示例:PlayerMessage
},
"header": {
"requestId": str(uuid.uuid4()),
@ -74,14 +91,16 @@ async def unsubscribe(webscket):
await websocket.send(response)
# 我个人不负责这块的质量,因为他们逼迫我违心的写了这段代码
# 此函数用于向 Minecraft 执行命令
async def send_command(websocket, command):
'''
参数:
输入:
: websocket : websocket 对象 :
: command : 执行的命令 :
返回:
输出:
None
'''
@ -110,11 +129,11 @@ async def send_command(websocket, command):
# 此函数用于向 Minecraft 发送消息
async def tellraw(websocket, message):
'''
参数:
输入:
: websocket : websocket 对象 :
: message : 发送的消息 :
返回:
输出:
None
'''

Binary file not shown.