fix: fix some api error
This commit is contained in:
+39
-5
@@ -6,10 +6,16 @@ const GMLIB_API = {
|
||||
sendFloatingText: ll.import("GMLIB_API", "sendFloatingText"),
|
||||
removeFloatingTextFromPlayer: ll.import("GMLIB_API", "removeFloatingTextFromPlayer"),
|
||||
removeFloatingText: ll.import("GMLIB_API", "removeFloatingText"),
|
||||
updateClientFloatingTextData: ll.import("GMLIB_API", "updateClientFloatingTextData"),
|
||||
updateAllClientsFloatingTextData: ll.import("GMLIB_API", "updateAllClientsFloatingTextData"),
|
||||
getServerMspt: ll.import("GMLIB_API", "getServerMspt"),
|
||||
getServerCurrentTps: ll.import("GMLIB_API", "getServerCurrentTps"),
|
||||
getServerAverageTps: ll.import("GMLIB_API", "getServerAverageTps"),
|
||||
getAllPlayerUuids: ll.import("GMLIB_API", "getAllPlayerUuids"),
|
||||
getPlayerNbt: ll.import("GMLIB_API", "getPlayerNbt"),
|
||||
setPlayerNbt: ll.import("GMLIB_API", "setPlayerNbt"),
|
||||
setPlayerNbtTags: ll.import("GMLIB_API", "setPlayerNbtTags"),
|
||||
tryGetNameFormUuid: ll.import("GMLIB_API", "tryGetNameFormUuid"),
|
||||
setEducationFeatureEnabled: ll.import("GMLib_ServerAPI", "setEducationFeatureEnabled"),
|
||||
registerAbilityCommand: ll.import("GMLib_ServerAPI", "registerAbilityCommand"),
|
||||
setEnableAchievement: ll.import("GMLib_ServerAPI", "setEnableAchievement"),
|
||||
@@ -72,6 +78,14 @@ class StaticFloatingText {
|
||||
return GMLIB_API.removeFloatingText(this.mRuntimeId);
|
||||
}
|
||||
|
||||
updateClient(player) {
|
||||
return GMLIB_API.updateClientFloatingTextData(this.mRuntimeId, player);
|
||||
}
|
||||
|
||||
updateClients() {
|
||||
return GMLIB_API.updateAllClientsFloatingTextData(this.mRuntimeId);
|
||||
}
|
||||
|
||||
getRuntimeId() {
|
||||
return this.mRuntimeId;
|
||||
}
|
||||
@@ -86,7 +100,7 @@ class StaticFloatingText {
|
||||
|
||||
update() {
|
||||
GMLIB_API.setFloatingTextData(this.mRuntimeId, this.mText);
|
||||
return this.sendToClients();
|
||||
return this.updateClients();
|
||||
}
|
||||
|
||||
updateText(newText) {
|
||||
@@ -109,13 +123,13 @@ class StaticFloatingText {
|
||||
}
|
||||
|
||||
static getFloatingText(runtimeId) {
|
||||
FloatingTextList.forEach((ft) => {
|
||||
for (const ft of FloatingTextList) {
|
||||
if (ft.getRuntimeId() == runtimeId) {
|
||||
if (!ft.isDynamic()) {
|
||||
return ft;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -178,13 +192,13 @@ class DynamicFloatingText extends StaticFloatingText {
|
||||
}
|
||||
|
||||
static getFloatingText(runtimeId) {
|
||||
FloatingTextList.forEach((ft) => {
|
||||
for (const ft of FloatingTextList) {
|
||||
if (ft.getRuntimeId() == runtimeId) {
|
||||
if (ft.isDynamic()) {
|
||||
return ft;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -220,6 +234,26 @@ class Minecraft {
|
||||
return GMLIB_API.getAllPlayerUuids();
|
||||
}
|
||||
|
||||
static getPlayerNbt(uuid) {
|
||||
let snbt = GMLIB_API.getPlayerNbt(uuid);
|
||||
let nbt = NBT.parseSNBT(snbt);
|
||||
return nbt;
|
||||
}
|
||||
|
||||
static setPlayerNbt(uuid, nbt) {
|
||||
let snbt = nbt.toSNBT();
|
||||
return GMLIB_API.setPlayerNbt(uuid, snbt);
|
||||
}
|
||||
|
||||
static setPlayerNbtTags(uuid, nbt, tags) {
|
||||
let snbt = nbt.toSNBT();
|
||||
return GMLIB_API.setPlayerNbtTags(uuid, snbt, tags);
|
||||
}
|
||||
|
||||
static tryGetNameFormUuid(uuid) {
|
||||
return GMLIB_API.tryGetNameFormUuid(uuid);
|
||||
}
|
||||
|
||||
static setEducationFeatureEnabled() {
|
||||
return GMLIB_API.setEducationFeatureEnabled();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user