Update VV API usage

This commit is contained in:
FlorianMichael 2024-06-15 21:02:44 +02:00
parent 0ea07d0e63
commit 18fd102a68
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126
4 changed files with 5 additions and 77 deletions

View File

@ -1,26 +0,0 @@
/*
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
* Copyright (C) 2021-2024 FlorianMichael/EnZaXD <florian.michael07@gmail.com> and RK_01/RaphiMC
* Copyright (C) 2023-2024 contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.florianmichael.viafabricplus.injection.access;
public interface IViaCommandHandler {
void viaFabricPlus$removeSubCommand(final String name);
}

View File

@ -1,43 +0,0 @@
/*
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
* Copyright (C) 2021-2024 FlorianMichael/EnZaXD <florian.michael07@gmail.com> and RK_01/RaphiMC
* Copyright (C) 2023-2024 contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.florianmichael.viafabricplus.injection.mixin.viaversion;
import com.viaversion.viaversion.api.command.ViaSubCommand;
import com.viaversion.viaversion.commands.ViaCommandHandler;
import de.florianmichael.viafabricplus.injection.access.IViaCommandHandler;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import java.util.Map;
@Mixin(ViaCommandHandler.class)
public abstract class MixinViaCommandHandler implements IViaCommandHandler {
@Shadow
@Final
private Map<String, ViaSubCommand> commandMap;
@Override
public void viaFabricPlus$removeSubCommand(String name) {
this.commandMap.remove(name);
}
}

View File

@ -25,7 +25,6 @@ import com.mojang.brigadier.suggestion.Suggestions;
import com.mojang.brigadier.suggestion.SuggestionsBuilder;
import de.florianmichael.viafabricplus.fixes.versioned.classic.command.ListExtensionsCommand;
import de.florianmichael.viafabricplus.fixes.versioned.classic.command.SetTimeCommand;
import de.florianmichael.viafabricplus.injection.access.IViaCommandHandler;
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
import net.raphimc.vialoader.impl.viaversion.VLCommandHandler;
@ -36,13 +35,12 @@ public class ViaFabricPlusVLCommandHandler extends VLCommandHandler {
public ViaFabricPlusVLCommandHandler() {
super();
this.removeSubCommand("list");
this.removeSubCommand("player");
this.removeSubCommand("pps");
this.registerSubCommand(new ListExtensionsCommand());
this.registerSubCommand(new SetTimeCommand());
final IViaCommandHandler mixin = (IViaCommandHandler) this;
mixin.viaFabricPlus$removeSubCommand("list");
mixin.viaFabricPlus$removeSubCommand("player");
mixin.viaFabricPlus$removeSubCommand("pps");
}
public int execute(final CommandContext<FabricClientCommandSource> ctx) {

View File

@ -200,8 +200,7 @@
"fixes.viaversion.MixinWorldPacketRewriter1_19",
"viabedrock.MixinJoinPackets",
"vialegacy.MixinExtensionProtocolMetadataStorage",
"vialegacy.MixinViaLegacyConfig",
"viaversion.MixinViaCommandHandler"
"vialegacy.MixinViaLegacyConfig"
],
"injectors": {
"defaultRequire": 1