From 4f9903c3370d5f0b8b861b3024da95dff2ed21ea Mon Sep 17 00:00:00 2001 From: twoone3 <3197653242@qq.com> Date: Thu, 11 Aug 2022 18:43:35 +0800 Subject: [PATCH] =?UTF-8?q?v2.0.9=E6=9B=B4=E6=96=B0=20-=20=E9=80=82?= =?UTF-8?q?=E9=85=8DLL2.5.0=20-=20=E4=BF=AE=E5=A4=8DgetOnlinePlayers?= =?UTF-8?q?=E7=9A=84=E8=BF=94=E5=9B=9E=E5=80=BC=E9=94=99=E8=AF=AF=20-=20?= =?UTF-8?q?=E5=AE=8C=E5=96=84=E4=BA=86=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SDK | 2 +- example/cmd.py | 16 +++++++++++++++- example/mc.pyi | 8 ++++---- example/pyr_test.py | 20 ++++++++++---------- src/api/event.cpp | 2 +- src/main.cpp | 4 ++-- 6 files changed, 33 insertions(+), 19 deletions(-) diff --git a/SDK b/SDK index 8444c38..2ee36e4 160000 --- a/SDK +++ b/SDK @@ -1 +1 @@ -Subproject commit 8444c3899d8f31012dd529e8823793d706e471b7 +Subproject commit 2ee36e4043bc3b5648f9119e8bcf6e9bd003dbaf diff --git a/example/cmd.py b/example/cmd.py index 1ece514..907861b 100644 --- a/example/cmd.py +++ b/example/cmd.py @@ -13,4 +13,18 @@ def cb(p: CommandOrigin, result): ) c.overload(['ssss', 'aaa']) c.setCallback(cb) -c.setup() \ No newline at end of file +c.setup() + + +def ons(e): + print(e) + while (True): + print(getBlock(BlockPos(1, 1, 1), 0)) + + +setListener("onServerStarted", ons) + +print(globals()) +import mc + +print(mc) \ No newline at end of file diff --git a/example/mc.pyi b/example/mc.pyi index 757f216..54d7e72 100644 --- a/example/mc.pyi +++ b/example/mc.pyi @@ -1,7 +1,7 @@ -# Code completion file for BDSpyrunner +# pyr的代码补全文件 # Copyright (c) 2022 twoone3 # All rights reserved. -# last change: 2022.8.7 +# last change: 2022.7.24 from enum import Enum @@ -950,7 +950,7 @@ def runCommand(cmd) -> bool: pass -def runCommandEx(cmd) -> tuple[bool, str]: +def runCommandEx(cmd) -> tuple[str, bool]: pass @@ -965,7 +965,7 @@ def registerCommand( pass -def getPlayer(name) -> Player: +def getPlayer(name) -> list[Player]: pass diff --git a/example/pyr_test.py b/example/pyr_test.py index e49ea2c..4cd9b69 100644 --- a/example/pyr_test.py +++ b/example/pyr_test.py @@ -85,13 +85,13 @@ def onAllEvent(e): for n in events: setListener(n, onAllEvent) -# nbt = NBT.newCompound() -# nbt['list'] = NBT.newList() -# nbt['string'] = NBT.newString('I am string') -# nbt['list'] = NBT.newList() -# nbt['a24z'] = NBT.fromSNBT('{"a4z":{},"az":[1f,1f,1],"az3":"az2"}') -# logger.warn(str(nbt['a24z'])) -# nbt['a24z']['a4z'] = NBT.newByte(2) -# b = nbt.toBinary() -# nbt['二进制'] = NBT.fromBinary(b) -# logger.warn(nbt.toSNBT(4)) +nbt = newCompound() +nbt['list'] = NBT.newList() +nbt['string'] = NBT.newString('I am string') +nbt['list'] = NBT.newList() +nbt['a24z'] = NBT.fromSNBT('{"a4z":{},"az":[1f,1f,1],"az3":"az2"}') +logger.warn(str(nbt['a24z'])) +nbt['a24z']['a4z'] = NBT.newByte(2) +b = nbt.toBinary() +nbt['二进制'] = NBT.fromBinary(b) +logger.warn(nbt.toSNBT(4)) diff --git a/src/api/event.cpp b/src/api/event.cpp index 94e2518..825cc62 100644 --- a/src/api/event.cpp +++ b/src/api/event.cpp @@ -506,8 +506,8 @@ void EnableEventListener(EventCode event_code) { EVENT_INSERT(Actor); EVENT_INSERT(Container); EVENT_INSERT(Slot); - EVENT_INSERT(NewItemStack); EVENT_INSERT(PreviousItemStack); + EVENT_INSERT(NewItemStack); EVENT_END; }); break; diff --git a/src/main.cpp b/src/main.cpp index fb69caa..c97bc29 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -7,8 +7,8 @@ constexpr unsigned PYR_VERSION_MAJOR = 2; constexpr unsigned PYR_VERSION_MINOR = 0; -constexpr unsigned PYR_VERSION_MICRO = 8; -constexpr const char* PYR_VERSION = "v2.0.8"; +constexpr unsigned PYR_VERSION_MICRO = 9; +constexpr const char* PYR_VERSION = "v2.0.9"; Logger logger("BDSpyrunner");