Skip to content

Commit 44c866b

Browse files
committed
feat: adapt to levilamina 1.7.x
1 parent 2210cab commit 44c866b

File tree

5 files changed

+19
-32
lines changed

5 files changed

+19
-32
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
run: xmake repo -u
2727

2828
- name: Update Project
29-
run: xmake f -a x64 -m release -p windows -v -y
29+
run: xmake f -a x64 -m release -p windows -y
3030

3131
- name: Build Project
3232
run: xmake -v -y

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
run: xmake repo -u
1818

1919
- name: Update Project
20-
run: xmake f -a x64 -m release -p windows -v -y
20+
run: xmake f -a x64 -m release -p windows -y
2121

2222
- name: Build Project
2323
run: xmake -v -y

src/gmsidebar/GMSidebar.cpp

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ struct GMSidebar::Impl {
211211
if (auto interval = config.update_interval; !interval) {
212212
if (cache.second.empty()) {
213213
// clang-format off
214-
cache.second = std::move(gmlib::PlaceholderAPI::translate(
214+
cache.second = std::move(gmlib::PlaceholderAPI::getInstance().translate(
215215
std::string{config.content[0]},
216216
player,
217217
{},
@@ -226,39 +226,26 @@ struct GMSidebar::Impl {
226226
return true;
227227
}
228228
} else {
229-
auto length = config.content.size();
230-
auto newIndex = length > 1 ? (now / interval) % length : 0;
231-
ll::DenseMap<
232-
std::string,
233-
std::variant<
234-
std::string,
235-
std::function<std::optional<std::string>(
236-
optional_ref<Actor> actor,
237-
ll::StringMap<std::string> const& params,
238-
std::string const& language
239-
)>>>
240-
params = {
241-
{"currentIndex", std::to_string(newIndex) },
242-
{"rawContent", config.content[newIndex] },
243-
{"updateInterval", std::to_string(interval) },
244-
{"contentSize", std::to_string(config.content.size())}
229+
auto length = config.content.size();
230+
auto newIndex = length > 1 ? (now / interval) % length : 0;
231+
gmlib::PlaceholderAPI::TranslateVariables params = {
232+
{"currentIndex", std::to_string(newIndex) },
233+
{"rawContent", config.content[newIndex] },
234+
{"updateInterval", std::to_string(interval) },
235+
{"contentSize", std::to_string(config.content.size())}
245236
};
246237
if (newIndex != cache.first) {
247-
if (auto newValue = gmlib::PlaceholderAPI::translate(
248-
std::string{config.content[newIndex]},
249-
player,
250-
{},
251-
params
252-
);
238+
if (auto newValue = gmlib::PlaceholderAPI::getInstance()
239+
.translate(std::string{config.content[newIndex]}, player, {}, params);
253240
newValue != cache.second) {
254241
cache.second = std::move(newValue);
255242
cache.first = newIndex;
256243
return true;
257244
}
258245
cache.first = newIndex;
259246
} else if (length == 1) {
260-
if (auto newValue =
261-
gmlib::PlaceholderAPI::translate(std::string{config.content[0]}, player, {}, params);
247+
if (auto newValue = gmlib::PlaceholderAPI::getInstance()
248+
.translate(std::string{config.content[0]}, player, {}, params);
262249
newValue != cache.second) {
263250
cache.second = std::move(newValue);
264251
return true;

tooth.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"format_version": 2,
33
"tooth": "github.com/GroupMountain/GMSidebar",
4-
"version": "1.1.1",
4+
"version": "1.2.0",
55
"info": {
66
"name": "GMSidebar",
77
"description": "High Performance Sidebar Mod",
@@ -15,8 +15,8 @@
1515
},
1616
"asset_url": "https://github.com/GroupMountain/GMSidebar/releases/download/v$(version)/GMSidebar-windows-x64.zip",
1717
"dependencies": {
18-
"github.com/LiteLDev/LeviLamina": ">=1.6.0",
19-
"github.com/GroupMountain/GMLIB": ">=1.6.0"
18+
"github.com/LiteLDev/LeviLamina": ">=1.7.0",
19+
"github.com/GroupMountain/GMLIB": ">=1.7.0"
2020
},
2121
"files": {
2222
"place": [

xmake.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ add_rules("mode.debug", "mode.release")
33
add_repositories("liteldev-repo https://github.com/LiteLDev/xmake-repo.git")
44
add_repositories("groupmountain-repo https://github.com/GroupMountain/xmake-repo.git")
55

6-
add_requires("levilamina 1.6.0", {configs = {target_type = "server"}})
6+
add_requires("levilamina 1.7.1", {configs = {target_type = "server"}})
77
add_requires("levibuildscript 0.5.2")
8-
add_requires("gmlib 1.6.0")
8+
add_requires("gmlib 1.7.0")
99

1010
if not has_config("vs_runtime") then
1111
set_runtimes("MD")

0 commit comments

Comments
 (0)