Skip to content

Commit

Permalink
fix: fix error
Browse files Browse the repository at this point in the history
  • Loading branch information
zimuya4153 committed Feb 7, 2025
1 parent b0945b9 commit fb33b61
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
4 changes: 1 addition & 3 deletions Config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/// <reference path="d:/dts/dts/helperlib/src/index.d.ts"/>
/// <reference path="../GMLIB-LegacyRemoteCallApi/lib/BEPlaceholderAPI-JS.d.ts"/>
/// <reference path="../GMLIB-LegacyRemoteCallApi/lib/GMLIB_API-JS.d.ts"/>

const { I18nAPI, UserCache } = require("./GMLIB-LegacyRemoteCallApi/lib/GMLIB_API-JS.js");
const { I18nAPI, UserCache, Minecraft } = require("./GMLIB-LegacyRemoteCallApi/lib/GMLIB_API-JS.js");

module.exports = {
Config: {
Expand Down
14 changes: 11 additions & 3 deletions Waila.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ setInterval(() => {
let TempCache = {
'HandItem': Player.getHand(),
'BlockNbt': ViewBlock ? ViewBlock.getNbt() : null,
'BlockEntityNbt': ViewBlock.hasBlockEntity() ? ViewBlock.getBlockEntity().getNbt() : null,
'BlockEntityNbt': ViewBlock?.hasBlockEntity() ? ViewBlock?.getBlockEntity()?.getNbt() : null,
'BlockContainer': ViewBlock.hasContainer() ? ViewBlock.getContainer() : null,
'EntityNbt': ViewEntity ? ViewEntity.getNbt() : null,
'BuffKeyID': ['potion.empty', 'potion.moveSpeed', 'potion.moveSlowdown', 'potion.digSpeed', 'potion.digSlowDown', 'potion.damageBoost', 'potion.heal', 'potion.harm', 'potion.jump', 'potion.confusion', 'potion.regeneration', 'potion.resistance', 'potion.fireResistance', 'potion.waterBreathing', 'potion.invisibility', 'potion.blindness', 'potion.nightVision', 'potion.hunger', 'potion.weakness', 'potion.poison', 'potion.wither', 'potion.healthBoost', 'potion.absorption', 'potion.saturation', 'potion.levitation', 'potion.poison', 'potion.conduitPower', 'potion.slowFalling', 'effect.badOmen', 'effect.villageHero', 'effect.darkness'],
Expand All @@ -86,7 +86,13 @@ setInterval(() => {
*/
Items => {
const ErrorLog = (text, error) => {
const ErrorText = `\n${text}报错:${error.message} 玩家:${Player.realName}(${Player.uuid})\n文本条件:${Items.Conditions.toString()}\n文本结果:${Items.Text.toString()}\n堆栈:\n${error.stack}`
const ErrorText = [ // 全程`不便阅读
`§6LeviLamina:§a${ll.versionString()} §6GMLIB:§a${Version.getGmlibVersion().toString(false)} §6LRCA:§a${Version.getLrcaVersion().toString(false)} §6Waila:§a${ll.getPluginInfo("Waila")?.version?.join('.')}`,
`§e${text}§c报错:§4${error.message} §e玩家§c:§a${Player.realName}§7(${Player.uuid})§c`,
`§c文本条件:§b${Items.Conditions.toString()}`,
`§c文本结果:§b${Items.Text.toString()}`,
`§c堆栈:\n§d${error.stack.replace(/at /g, "§eat §d").replace(/\(/g, "§c(").replace(/\)/g, ")§d")}`
].join('\n');
if (ErrorList.includes(ErrorText)) return;
ErrorList.push(ErrorText);
logger.error(ErrorText);
Expand Down Expand Up @@ -188,11 +194,13 @@ mc.listen('onPlayerCmd', (player, cmd) => player.permLevel >= 3 && unloadDetecti
if (Version.getLrcaVersion().valueOf() == 130006) { // 临时修复
const languageFiles = File.getFilesList(`./plugins/Waila/Language`).filter(fileName => fileName.endsWith('.lang'));
for (const languageFile of languageFiles) {
if (!File.exists(`./resource_packs/vanilla/texts/${languageFile}`)) continue;
File.copy(`./resource_packs/vanilla/texts/${languageFile}`, `./resource_packs/vanilla/texts/${languageFile}.bak`);
File.writeLine(`./resource_packs/vanilla/texts/${languageFile}`, File.readFrom(`./plugins/Waila/Language/${languageFile}`));
}
mc.listen("onServerStarted", () => {
for (const languageFile of languageFiles){
for (const languageFile of languageFiles) {
if (!File.exists(`./resource_packs/vanilla/texts/${languageFile}.bak`)) continue;
File.delete(`./resource_packs/vanilla/texts/${languageFile}`);
File.rename(`./resource_packs/vanilla/texts/${languageFile}.bak`, `./resource_packs/vanilla/texts/${languageFile}`);
}
Expand Down
6 changes: 3 additions & 3 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"entry": "Waila.js",
"name": "Waila",
"type": "lse-quickjs",
"description":"普普通通的搞高亮显示",
"author":"小小的子沐呀",
"version":"1.4.2",
"description": "普普通通的搞高亮显示",
"author": "小小的子沐呀",
"version": "1.4.3",
"dependencies": [
{
"name": "legacy-script-engine-quickjs"
Expand Down
4 changes: 2 additions & 2 deletions tooth.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"format_version": 2,
"tooth": "github.com/ZMBlocks/LSE_Waila",
"version": "1.4.2",
"version": "1.4.3",
"info": {
"name": "LSE_Waila",
"description": "普普通通的高亮显示~",
Expand All @@ -15,7 +15,7 @@
"legacyscriptengine"
]
},
"asset_url": "https://github.com/ZMBlocks/LSE_Waila/releases/download/v1.4.2/LSE_Waila-1.4.2.zip",
"asset_url": "https://github.com/ZMBlocks/LSE_Waila/releases/download/v1.4.3/LSE_Waila-1.4.3.zip",
"prerequisites": {
"github.com/LiteLDev/LeviLamina": ">=1.0.0-rc.1",
"gitea.litebds.com/LiteLDev/legacy-script-engine-quickjs": ">=0.9.0-rc.1",
Expand Down

0 comments on commit fb33b61

Please sign in to comment.