From 38e7e0e20fc60b7c116cd6500fe0bad927b7db34 Mon Sep 17 00:00:00 2001 From: daoge_cmd <3523206925@qq.com> Date: Fri, 2 Feb 2024 17:07:23 +0800 Subject: [PATCH] feat: update to levilamina 0.6.3 --- src/Plugin.cpp | 11 ++++++----- xmake.lua | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Plugin.cpp b/src/Plugin.cpp index 25aac625..c954ae90 100644 --- a/src/Plugin.cpp +++ b/src/Plugin.cpp @@ -16,6 +16,7 @@ #include // MC +#include // Item #include #include @@ -48,6 +49,7 @@ // Command #include #include "mc/server/commands/CommandParameterData.h" +#include "mc/server/commands/MinecraftCommands.h" // NBT #include #include @@ -79,17 +81,17 @@ namespace plugin { return false; } const unsigned long len = compressBound(original_str.size()); - auto *buf = (unsigned char *) malloc(len); + auto *buf = static_cast(malloc(len)); if (!buf) { return false; } - d_stream.next_in = (unsigned char *) (original_str.c_str()); + d_stream.next_in = (unsigned char *) original_str.c_str(); d_stream.avail_in = original_str.size(); d_stream.next_out = buf; d_stream.avail_out = len; deflate(&d_stream, Z_SYNC_FLUSH); deflateEnd(&d_stream); - str.assign((char *) buf, d_stream.total_out); + str.assign(reinterpret_cast(buf), d_stream.total_out); free(buf); return true; } @@ -368,8 +370,7 @@ namespace plugin { for (int i = 0; i <= 256; ++i) { try { if (item.isValidAuxValue(i)) { - const auto itemstack = ItemStack(item, 1, i); // ignore some invaild aux exception - if (!uniqueStr.contains(itemstack.getDescriptionId())) { + if (const auto itemstack = ItemStack(item, 1, i); !uniqueStr.contains(itemstack.getDescriptionId())) { uniqueStr.insert(itemstack.getDescriptionId()); descriptionId.putString(std::to_string(i), itemstack.getDescriptionId()); } diff --git a/xmake.lua b/xmake.lua index 028d13fd..77f46df8 100644 --- a/xmake.lua +++ b/xmake.lua @@ -8,7 +8,7 @@ end -- Option 1: Use the latest version of LeviLamina released on GitHub. -add_requires("levilamina 0.5.1") +add_requires("levilamina 0.6.3") add_requires("zlib-ng 2.1.3") -- Option 2: Use a specific version of LeviLamina released on GitHub.