|
| 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 | +} |
0 commit comments