Skip to content

Commit

Permalink
Release v0.8.5
Browse files Browse the repository at this point in the history
  • Loading branch information
KobeBryant114514 committed Feb 23, 2024
2 parents 985fc6f + 0ac6ad5 commit 1e441a5
Show file tree
Hide file tree
Showing 16 changed files with 475 additions and 370 deletions.
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ PackConstructorInitializers: CurrentLine
PointerAlignment: Left
TabWidth: 4
UseTab: Never
SortIncludes: CaseSensitive
SortIncludes: CaseSensitive
144 changes: 144 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
---
Checks: '-*,
bugprone-argument-comment,
bugprone-assert-side-effect,
bugprone-bad-signal-to-kill-thread,
bugprone-branch-clone,
bugprone-copy-constructor-init,
bugprone-dangling-handle,
bugprone-dynamic-static-initializers,
bugprone-fold-init-type,
bugprone-forward-declaration-namespace,
bugprone-forwarding-reference-overload,
bugprone-inaccurate-erase,
bugprone-incorrect-roundings,
bugprone-integer-division,
bugprone-lambda-function-name,
bugprone-macro-parentheses,
bugprone-macro-repeated-side-effects,
bugprone-misplaced-operator-in-strlen-in-alloc,
bugprone-misplaced-pointer-arithmetic-in-alloc,
bugprone-misplaced-widening-cast,
bugprone-move-forwarding-reference,
bugprone-multiple-statement-macro,
bugprone-no-escape,
bugprone-not-null-terminated-result,
bugprone-parent-virtual-call,
bugprone-posix-return,
bugprone-reserved-identifier,
bugprone-sizeof-container,
bugprone-sizeof-expression,
bugprone-spuriously-wake-up-functions,
bugprone-string-constructor,
bugprone-string-integer-assignment,
bugprone-string-literal-with-embedded-nul,
bugprone-suspicious-enum-usage,
bugprone-suspicious-include,
bugprone-suspicious-memory-comparison,
bugprone-suspicious-memset-usage,
bugprone-suspicious-missing-comma,
bugprone-suspicious-semicolon,
bugprone-suspicious-string-compare,
bugprone-swapped-arguments,
bugprone-terminating-continue,
bugprone-throw-keyword-missing,
bugprone-too-small-loop-variable,
bugprone-undefined-memory-manipulation,
bugprone-undelegated-constructor,
bugprone-unhandled-self-assignment,
bugprone-unused-raii,
bugprone-unused-return-value,
bugprone-use-after-move,
bugprone-virtual-near-miss,
cert-dcl21-cpp,
cert-dcl58-cpp,
cert-err34-c,
cert-err52-cpp,
cert-err60-cpp,
cert-flp30-c,
cert-msc50-cpp,
cert-msc51-cpp,
cert-str34-c,
cppcoreguidelines-interfaces-global-init,
cppcoreguidelines-narrowing-conversions,
cppcoreguidelines-pro-type-member-init,
cppcoreguidelines-slicing,
google-default-arguments,
google-explicit-constructor,
google-runtime-operator,
hicpp-exception-baseclass,
hicpp-multiway-paths-covered,
misc-misplaced-const,
misc-new-delete-overloads,
misc-non-copyable-objects,
misc-throw-by-value-catch-by-reference,
misc-unconventional-assign-operator,
misc-uniqueptr-reset-release,
modernize-avoid-bind,
modernize-concat-nested-namespaces,
modernize-deprecated-headers,
modernize-deprecated-ios-base-aliases,
modernize-loop-convert,
modernize-make-shared,
modernize-make-unique,
modernize-pass-by-value,
modernize-raw-string-literal,
modernize-redundant-void-arg,
modernize-replace-auto-ptr,
modernize-replace-disallow-copy-and-assign-macro,
modernize-replace-random-shuffle,
modernize-return-braced-init-list,
modernize-shrink-to-fit,
modernize-unary-static-assert,
modernize-use-auto,
modernize-use-bool-literals,
modernize-use-emplace,
modernize-use-equals-default,
modernize-use-equals-delete,
modernize-use-nodiscard,
modernize-use-noexcept,
modernize-use-nullptr,
modernize-use-override,
modernize-use-transparent-functors,
modernize-use-uncaught-exceptions,
mpi-buffer-deref,
mpi-type-mismatch,
openmp-use-default-none,
performance-faster-string-find,
performance-for-range-copy,
performance-implicit-conversion-in-loop,
performance-inefficient-algorithm,
performance-inefficient-string-concatenation,
performance-inefficient-vector-operation,
performance-move-const-arg,
performance-move-constructor-init,
performance-no-automatic-move,
performance-noexcept-move-constructor,
performance-trivially-destructible,
performance-type-promotion-in-math-fn,
performance-unnecessary-copy-initialization,
performance-unnecessary-value-param,
portability-simd-intrinsics,
readability-avoid-const-params-in-decls,
readability-const-return-type,
readability-container-size-empty,
readability-delete-null-pointer,
readability-deleted-default,
readability-inconsistent-declaration-parameter-name,
readability-make-member-function-const,
readability-misleading-indentation,
readability-misplaced-array-index,
readability-non-const-parameter,
readability-redundant-control-flow,
readability-redundant-declaration,
readability-redundant-function-ptr-dereference,
readability-redundant-smartptr-get,
readability-redundant-string-cstr,
readability-redundant-string-init,
readability-simplify-subscript-expr,
readability-static-accessed-through-instance,
readability-static-definition-in-anonymous-namespace,
readability-string-compare,
readability-uniqueptr-delete-release,
readability-use-anyofallof'
...
11 changes: 8 additions & 3 deletions .clangd
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
Diagnostics:
Suppress: ["-Wmicrosoft-enum-forward-reference", "-Wc++11-narrowing", "-Wc++2b-extensions", "-Wmicrosoft-cast"]
Suppress:
- "-Wmicrosoft-enum-forward-reference"
- "-Wc++11-narrowing"
- "-Wc++2b-extensions"
- "-Wmicrosoft-cast"
CompileFlags:
Add: ["-ferror-limit=0", "-D__FUNCTION__=\"dummy\"", "-D_CRT_USE_BUILTIN_OFFSETOF", "-std:c++latest"]
Remove: ["/Yu_HeaderOutputPredefine.h", "/FI_HeaderOutputPredefine.h"]
Add:
- "-ferror-limit=0"
- '-D__FUNCTION__="dummy"'
7 changes: 6 additions & 1 deletion include/GMLIB/GMLIB.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@ namespace GMLIB::Version {
GMLIB_API SemVersion getLibVersion();

GMLIB_API bool isReleaseVersion();

GMLIB_API bool isPreReleaseVersion();

GMLIB_API std::string getLibVersionString();

GMLIB_API std::string getPreReleaseInfo();

GMLIB_API bool checkLibVersionMatch(SemVersion minVersion);
GMLIB_API bool checkLibVersionMatch(SemVersion minVersion, SemVersion maxVersion);

GMLIB_API int getProtocolVersion();

GMLIB_API std::string getBdsVersion();

} // namespace GMLIB::Version
75 changes: 49 additions & 26 deletions include/GMLIB/Server/PlaceholderAPI.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
#pragma once
#include "GMLIB/GMLIB.h"
#include "mc/world/actor/player/Player.h"

namespace GMLIB::Server {

class PlaceholderAPI {
public:
std::string mValue;
std::string mName;

private:
std::string mValue;
std::string mPlaceholder;
std::string mPluginName;
int mUpdateInterval;
bool mAutoUpdate;
Expand All @@ -18,7 +17,8 @@ class PlaceholderAPI {
std::function<std::string(Player*, std::unordered_map<std::string, std::string>)> mCallbackWithParameters;

public:
PlaceholderAPI(){};
PlaceholderAPI() = default;

PlaceholderAPI(
std::string Name,
int UpdateInterval,
Expand All @@ -29,65 +29,88 @@ class PlaceholderAPI {
std::function<std::string(Player*)> callback,
std::function<std::string(Player*, std::unordered_map<std::string, std::string>)> CallbackWithParameters
);
~PlaceholderAPI(){};

GMLIB_API static void registerPlaceholder(PlaceholderAPI papi);
public:
virtual ~PlaceholderAPI() = default;

GMLIB_API static std::string getValue(std::string name, Player* sp);
public:
GMLIB_API static std::string getValue(std::string placeholder, Player* player);

GMLIB_API static std::string getValue(std::string name);
GMLIB_API static std::string getValue(std::string placeholder);

GMLIB_API static void translateString(std::string& papi, Player* sp = nullptr);
GMLIB_API static void translate(std::string& value, Player* sp = nullptr);

GMLIB_API static void registerStaticPlaceholder(std::string name, std::string value, std::string PluginName = "");
GMLIB_API static std::string translate(std::string_view value, Player* sp = nullptr);

GMLIB_API static void registerStaticPlaceholder(std::string name, std::string (*Func)(), std::string PluginName);
GMLIB_API static bool
registerStaticPlaceholder(std::string placeholder, std::string value, std::string PluginName = "");

GMLIB_API static void
registerStaticPlaceholder(std::string name, std::function<std::string()> callback, std::string PluginName = "");
GMLIB_API static bool
registerStaticPlaceholder(std::string placeholder, std::string (*Func)(), std::string PluginName = "");

GMLIB_API static bool registerStaticPlaceholder(
std::string placeholder,
std::function<std::string()> callback,
std::string PluginName = ""
);

GMLIB_API static void
registerStaticPlaceholder(std::string name, int UpdateInterval, std::string (*Func)(), std::string PluginName);
GMLIB_API static bool registerStaticPlaceholder(
std::string placeholder,
int UpdateInterval,
std::string (*Func)(),
std::string PluginName
);

GMLIB_API static void registerStaticPlaceholder(
GMLIB_API static bool registerStaticPlaceholder(
std::string name,
int UpdateInterval,
std::function<std::string()> callback,
std::string PluginName = ""
);

GMLIB_API static void registerPlayerPlaceholder(
GMLIB_API static bool registerPlayerPlaceholder(
std::string name,
std::function<std::string(Player*)> callback,
std::string PluginName = ""
);

GMLIB_API static void registerPlayerPlaceholder(
GMLIB_API static bool registerPlayerPlaceholder(
std::string name,
std::function<std::string(Player*, std::unordered_map<std::string, std::string>)> callback,
std::string PluginName = ""
);

GMLIB_API static void
registerServerPlaceholder(std::string name, std::function<std::string()> callback, std::string PluginName = "");
GMLIB_API static bool registerServerPlaceholder(
std::string placeholder,
std::function<std::string()> callback,
std::string PluginName = ""
);

GMLIB_API static void registerServerPlaceholder(
GMLIB_API static bool registerServerPlaceholder(
std::string name,
std::function<std::string(std::unordered_map<std::string, std::string>)> callback,
std::string PluginName = ""
);

GMLIB_API static bool unRegisterPlaceholder(std::string name);
GMLIB_API static bool unRegisterPlaceholder(std::string placeholder);

GMLIB_API static void Update(PlaceholderAPI a1);
GMLIB_API static void update(PlaceholderAPI papi);

GMLIB_API static std::unordered_set<std::string> getPAPIPluginsList();

GMLIB_API static std::vector<PlaceholderAPI> getPAPIInfoList();

GMLIB_API inline std::string getValue() { return mValue; }
GMLIB_API static std::vector<std::string> getAllPAPI();

GMLIB_API inline std::string getPluginName() { return mPluginName; }
public:
GMLIB_API std::string getName();

GMLIB_API std::string getValue();

GMLIB_API std::string getPluginName();

private:
static bool registerPlaceholder(PlaceholderAPI papi);
};

} // namespace GMLIB::Server
10 changes: 10 additions & 0 deletions include/GMLIB/Server/PlayerAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@ class GMLIB_Player : public Player {

GMLIB_API std::optional<int> getScore(std::string objective);

GMLIB_API std::string_view getIP();

GMLIB_API ushort getPort();

GMLIB_API int getAvgPing();

GMLIB_API int getLastPing();

GMLIB_API std::string_view getLanguageCode();

GMLIB_API std::optional<int>
setScore(std::string objective, int value, PlayerScoreSetFunction action = PlayerScoreSetFunction::Set);

Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
"type": "native",
"author": "GroupMountain",
"description": "Group Mountain Library",
"version": "0.8.4"
"version": "0.8.5"
}
Loading

0 comments on commit 1e441a5

Please sign in to comment.