import server.extraServerApi as serverApi
import math
def version(self, id):
command = serverApi.CreateComponent(serverApi.GetLevelId(), "Minecraft", "command")
command.SetCommand('/fill ~~2~~~2~ light_block 0 replace air 0',id)
PosComp = serverApi.CreateComponent(id, "Minecraft", "pos")
x,y,z = math.floor(PosComp.pos[0]),math.floor(PosComp.pos[1]-1.62),math.floor(PosComp.pos[2])
blockcomp = serverApi.CreateComponent(id, "Minecraft", "blockInfo")
blockid, aux = self.GetCompData(blockcomp, "serverlevel", "get_block_and_data", x, y+2, z)
if blockid in [-215,470]:
return True
else:
command.SetCommand('/tellraw @s {"rawtext":[{"text":"你的游戏版本低,请升级到最新版。"}]}',id)
return False
#直接用判断语句即可使用,注意传入参数
if version(id):
print('版本通过')
欢迎光临 网易我的世界论坛 (http://mc.netease.com/) | Powered by Discuz! X3.3 |