Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Commit

Permalink
Merge branch 'beta'
Browse files Browse the repository at this point in the history
  • Loading branch information
yqs112358 committed Mar 2, 2022
2 parents 3e12eeb + 0a48b15 commit aed1b5a
Show file tree
Hide file tree
Showing 58 changed files with 1,986 additions and 792 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
working-directory: ${{env.GITHUB_WORKSPACE}}
if: startsWith(github.ref, 'refs/tags/')
run: |
7z a -t zip PDB.zip PDB
7z a -tzip PDB.zip PDB
shell: bash

- name: Update LiteLoaderSDK
Expand Down
50 changes: 27 additions & 23 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
## [LiteLoader Release Note]
LiteLoaderBDS-2.1.3 update has been released, automatic update has been pushed
This is a bug fix update, please update as soon as possible
This is a bug fix update, fix several problems that may cause crash. Please update as soon as possible
## [New features]
- Added dynamic command registration interface (DynamicCommandAPI)
- Added text encoding conversion interface (I18nAPI)
- Added CompoundTag::toPrettySNBT beautification output interface
- Provide support for NetworkNBT format
- Provided annotation support for all json interfaces of scripting engine
- Added the symbol cache switch for PrintCurrentStackTraceback
- Added addons management and query commands
- Upgraded the included LLMoney version
## [Bug Fix]
- The script engine fixes the problem that the database cannot be closed
- Fix the problem that StructureTemplate class exists
- Scripting engine fixes the problem of repeated loading of ll.require
- Script engine fixes the problem that some object data is not updated after setNbt
- Scripting engine fixes the problem of missing onLiquidFlow event dimension
- Scripting engine fixes item.clone
- Scripting engine provides binary interface for base64 conversion
- Scripting engine adds engine validity check for multiple callbacks, improving stability
- Fix some problems of SymDBHelper in SDK
- Provide UTF8 conversion for most of the abnormal output to avoid the crash caused by local encoding in the output process.
- Fix the problem of crash caused by inputting full-angle characters in the background.
New dynamic command registration interface (DynamicCommandAPI)
New text encoding conversion interface (I18nAPI)
Added built-in OutputFilter regex output filtering function
Added addons automatic installation, management and query commands
Added CompoundTag::toPrettySNBT beautification output interface
Provided support for NetworkNBT format
Provide comment support for all json interfaces of scripting engine
Added a symbol cache switch for PrintCurrentStackTraceback
Upgraded the included LLMoney version
## [Bug fixes]
Repair the problem of incorrect content of some packet classes
Repair the problems of StructureTemplate class.
Repair the problem of error reporting in hot management command
Add lock to Logger to solve the problem of probable collapse of service when multi-threaded output
The script engine fixes the problem that the database cannot be closed.
Scripting engine fixes the problem of repeated loading of ll.require
Scripting engine fixes the problem that some object data is not updated after setNbt
Scripting engine fixes missing onLiquidFlow event dimension
Scripting engine fixes item.clone
Scripting engine provides binary interface for base64 conversion
Scripting engine fixes possible problems with TimeTask, adds security checks
Scripting engine adds engine validity checks for multiple callbacks, improving stability
Scripting engine fixes the problem that V8 output abnormal information triggers debugger and causes crash.
Fix some problems of SymDBHelper in SDK.
Provide UTF8 conversion for most of the output, to avoid the crash caused by local encoding
Repair the problem of crashing caused by inputting full-angle characters in the background
10 changes: 6 additions & 4 deletions LiteLoader/Header/DynamicCommandAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ class Actor;
#define USE_PARSE_ENUM_STRING
//#define ENABLE_PARAMETER_TYPE_POSTFIX
#include "MC/Command.hpp"
#include "MC/CommandOrigin.hpp"
#include "MC/CommandOutput.hpp"
#include "MC/CommandParameterData.hpp"
#include "MC/CommandRegistry.hpp"
#include "MC/CommandSelector.hpp"
#include "MC/CommandPosition.hpp"
#include "MC/CommandParameterData.hpp"
#include "Utils/WinHelper.h"
#include <third-party/magic_enum/magic_enum.hpp>

Expand Down Expand Up @@ -534,9 +536,9 @@ class DynamicCommandInstance
LIAPI void setCallback(DynamicCommand::CallBackFn&& callback) const;
LIAPI void removeCallback() const;
//LIAPI static bool updateSoftEnum(std::string const& name = "") const;
LIAPI static std::string setSoftEnum(std::string const& name, std::vector<std::string> const& values);
LIAPI static bool addSoftEnumValues(std::string const& name, std::vector<std::string> const& values);
LIAPI static bool removeSoftEnumValues(std::string const& name, std::vector<std::string> const& values);
LIAPI std::string setSoftEnum(std::string const& name, std::vector<std::string> const& values) const;
LIAPI bool addSoftEnumValues(std::string const& name, std::vector<std::string> const& values) const;
LIAPI bool removeSoftEnumValues(std::string const& name, std::vector<std::string> const& values) const;
LIAPI static std::vector<std::string> getSoftEnumValues(std::string const& name);
LIAPI static std::vector<std::string> getSoftEnumNames();

Expand Down
14 changes: 14 additions & 0 deletions LiteLoader/Header/EventAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -649,4 +649,18 @@ class PlayerBedEnterEvent : public EventTemplate<PlayerBedEnterEvent>
BlockInstance* mBlockInstance;
};

class ScriptPluginManagerEvent : public EventTemplate<ScriptPluginManagerEvent>
{
public:
enum class Operation
{ Load, Unload, Reload };

Operation operation;
std::string target;
std::string otherInfo;
std::string pluginExtention;

bool success = false;
};

}; // namespace Event
62 changes: 21 additions & 41 deletions LiteLoader/Header/LoggerAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ class Player;
using std::string;

#define LOGGER_CURRENT_FILE "ll_plugin_logger_file"
#define LOGGER_CURRENT_LOCK "ll_plugin_logger_lock"

template<bool B, class T = void>
using enable_if_type = typename std::enable_if<B, T>::type;
Expand All @@ -75,7 +74,7 @@ class Logger {
fmt::text_style style;
std::string levelPrefix;
std::ostringstream os;
bool locked = false;
bool locked = false; //Deprecated

LIAPI explicit OutputStream(Logger* logger, int level,
std::string&& consoleFormat,
Expand All @@ -87,35 +86,26 @@ class Logger {
template <typename T>
OutputStream& operator<<(T t)
{
if (!locked)
{
lock();
locked = true;
}
logger->lock();
os << t;
logger->unlock();
return *this;
}

template <>
OutputStream& operator<<(std::wstring wstr)
{
if (!locked)
{
lock();
locked = true;
}
logger->lock();
os << wstr2str(wstr);
logger->unlock();
return *this;
}
template <>
OutputStream& operator<<(const wchar_t* wstr)
{
if (!locked)
{
lock();
locked = true;
}
logger->lock();
os << wstr2str(wstr);
logger->unlock();
return *this;
}

Expand Down Expand Up @@ -158,15 +148,8 @@ class Logger {
};

private:

LIAPI static void initLockImpl(HMODULE hPlugin);

LIAPI static void lockImpl(HMODULE hPlugin);

LIAPI static void unlockImpl(HMODULE hPlugin);

LIAPI static bool setDefaultFileImpl(HMODULE hPlugin, const std::string& logFile, bool appendMode);

LIAPI static bool setDefaultFileImpl(HMODULE hPlugin, nullptr_t);

LIAPI static void endlImpl(HMODULE hPlugin, OutputStream& o);
Expand All @@ -184,21 +167,6 @@ class Logger {
setFile(nullptr);
}

inline static void initLock()
{
return initLockImpl(GetCurrentModule());
};

inline static void lock()
{
return lockImpl(GetCurrentModule());
};

inline static void unlock()
{
return unlockImpl(GetCurrentModule());
};

inline static bool setDefaultFile(const std::string& logFile, bool appendMode)
{
return setDefaultFileImpl(GetCurrentModule(), logFile, appendMode);
Expand All @@ -215,17 +183,29 @@ class Logger {
};

LIAPI bool setFile(const std::string& logFile, bool appendMode = true);

LIAPI bool setFile(nullptr_t);

LIAPI bool tryLock();
LIAPI bool lock();
LIAPI bool unlock();

OutputStream debug;
OutputStream info;
OutputStream warn;
OutputStream error;
OutputStream fatal;

inline Logger(): Logger("") {}

LIAPI explicit Logger(const std::string &title);

private:
LIAPI CsLock& getLocker();


//For compatibility
private:
LIAPI static void initLockImpl(HMODULE hPlugin);
LIAPI static void lockImpl(HMODULE hPlugin);
LIAPI static void unlockImpl(HMODULE hPlugin);

};
3 changes: 2 additions & 1 deletion LiteLoader/Header/MC/AvailableActorIdentifiersPacket.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#undef BEFORE_EXTRA

class AvailableActorIdentifiersPacket {
class AvailableActorIdentifiersPacket : public Packet {

#define AFTER_EXTRA
// Add Member There
Expand All @@ -27,6 +27,7 @@ class AvailableActorIdentifiersPacket {
/*2*/ virtual std::string getName() const;
/*3*/ virtual void write(class BinaryStream&) const;
/*4*/ virtual struct ExtendedStreamReadResult readExtended(class ReadOnlyBinaryStream&);
/*6*/ virtual enum StreamReadResult _read(class ReadOnlyBinaryStream&);
/*
inline ~AvailableActorIdentifiersPacket(){
(AvailableActorIdentifiersPacket::*rv)();
Expand Down
5 changes: 3 additions & 2 deletions LiteLoader/Header/MC/AvailableCommandsPacket.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

#define BEFORE_EXTRA
// Include Headers or Declare Types Here
#include "CommandRegistry.hpp"
#include "CommandFlag.hpp"
enum CommandPermissionLevel : char;

#undef BEFORE_EXTRA

Expand All @@ -29,7 +30,7 @@ class AvailableCommandsPacket : public Packet {
struct ParamData
{
std::string desc;
CommandRegistry::Symbol sym;
unsigned int sym;
};
struct OverloadData
{
Expand Down
5 changes: 3 additions & 2 deletions LiteLoader/Header/MC/BiomeDefinitionListPacket.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#undef BEFORE_EXTRA

class BiomeDefinitionListPacket {
class BiomeDefinitionListPacket : public Packet {

#define AFTER_EXTRA
// Add Member There
Expand All @@ -25,8 +25,9 @@ class BiomeDefinitionListPacket {
/*0*/ virtual ~BiomeDefinitionListPacket();
/*1*/ virtual enum MinecraftPacketIds getId() const;
/*2*/ virtual std::string getName() const;
/*3*/ virtual void __unk_vfn_3();
/*3*/ virtual void write(class BinaryStream&) const;
/*4*/ virtual struct ExtendedStreamReadResult readExtended(class ReadOnlyBinaryStream&);
/*6*/ virtual enum StreamReadResult _read(class ReadOnlyBinaryStream&);
/*
inline ~BiomeDefinitionListPacket(){
(BiomeDefinitionListPacket::*rv)();
Expand Down
1 change: 0 additions & 1 deletion LiteLoader/Header/MC/CommandFlag.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once


enum class CommandFlagValue : unsigned short
{
None = 0,
Expand Down
16 changes: 7 additions & 9 deletions LiteLoader/Header/MC/CommandRegistry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,17 +167,15 @@ class CommandRegistry {
double a = 0; // 48
double b = 0; // 56
double c = 0; // 64
inline Overload(CommandVersion version,
FactoryFn factory,
std::vector<CommandParameterData>&& args)
: version(version),
factory(factory),
params(std::forward<std::vector<CommandParameterData>>(args)),
unk(255) {}
LIAPI Overload(CommandVersion version,
FactoryFn factory,
std::vector<CommandParameterData>&& args);

inline std::string toDebugString() const
LIAPI ~Overload();

inline std::string toDebugString()
{
return fmt::format("<Overload {}>", params.size());
return fmt::format("<Overload>");
}
};

Expand Down
Loading

0 comments on commit aed1b5a

Please sign in to comment.