mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-12-22 16:48:25 +01:00
Remove via subcommands which are not usable on the clientside
This commit is contained in:
parent
1f8fb02b53
commit
46474fcd22
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* 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);
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
|
||||
}
|
@ -25,6 +25,7 @@ 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;
|
||||
|
||||
@ -37,6 +38,11 @@ public class ViaFabricPlusVLCommandHandler extends VLCommandHandler {
|
||||
|
||||
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(CommandContext<FabricClientCommandSource> ctx) {
|
||||
|
@ -29,6 +29,7 @@
|
||||
"base.perserverversion.MixinServerInfo",
|
||||
"compat.classic4j.MixinCCAuthenticationResponse",
|
||||
"compat.classic4j.MixinTextFieldWidget",
|
||||
"compat.fabricapi.MixinRegistrySyncManager",
|
||||
"compat.ipnext.MixinAutoRefillHandler_ItemSlotMonitor",
|
||||
"compat.jsonwebtoken.MixinClasses",
|
||||
"compat.jsonwebtoken.MixinDefaultJwtParserBuilder",
|
||||
@ -200,7 +201,7 @@
|
||||
"viabedrock.MixinJoinPackets",
|
||||
"vialegacy.MixinExtensionProtocolMetadataStorage",
|
||||
"vialegacy.MixinViaLegacyConfig",
|
||||
"compat.fabricapi.MixinRegistrySyncManager"
|
||||
"viaversion.MixinViaCommandHandler"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
Loading…
Reference in New Issue
Block a user