Skip to content

Commit 554f8a4

Browse files
feat: Stop SkyblockClient Updater from suggesting incorrect updates
POV: u need to make a mixin for ur own mod cause someone messed it up
1 parent 9230e90 commit 554f8a4

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* Skytils - Hypixel Skyblock Quality of Life Mod
3+
* Copyright (C) 2020-2024 Skytils
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU Affero General Public License as published
7+
* by the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU Affero General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU Affero General Public License
16+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
*/
18+
19+
package gg.skytils.skytilsmod.mixins.transformers.skyclientupdater;
20+
21+
import org.spongepowered.asm.mixin.Dynamic;
22+
import org.spongepowered.asm.mixin.Mixin;
23+
import org.spongepowered.asm.mixin.Pseudo;
24+
import org.spongepowered.asm.mixin.injection.At;
25+
import org.spongepowered.asm.mixin.injection.Inject;
26+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
27+
28+
import java.util.Locale;
29+
30+
@Pseudo
31+
@Mixin(targets = "mynameisjeff.skyblockclientupdater.UpdateChecker")
32+
public abstract class MixinUpdateChecker {
33+
34+
/***
35+
* @param expected The remote version it's checking against
36+
* @param received The local version
37+
* @param cir Returns true if the updater should suggest an update
38+
*/
39+
@Dynamic
40+
@Inject(method = "checkMatch", at = @At("HEAD"), cancellable = true)
41+
private void checkMatch(String expected, String received, CallbackInfoReturnable<Boolean> cir) {
42+
received = received.toLowerCase(Locale.US);
43+
44+
// we aren't changing the mod id, so we can just check if the received string contains "skytils"
45+
// they have a updateToModIds anyway, so we don't need to worry about the mod id
46+
if (received.contains("skytils")) {
47+
cir.setReturnValue(false);
48+
}
49+
}
50+
}

src/main/resources/mixins.skytils.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
"renderer.MixinTileEntitySkullRenderer",
8080
"sba.MixinContainerPreviewManager",
8181
"sk1eroam.MixinAnimationHandler",
82+
"skyclientupdater.MixinUpdateChecker",
8283
"util.MixinChatStyle",
8384
"util.MixinIChatComponentSerializer",
8485
"util.MixinUtil",

0 commit comments

Comments
 (0)