Removed commands which are now in VV

This commit is contained in:
RaphiMC 2024-06-15 15:11:25 +02:00
parent d2b45fd415
commit 273abf8190
No known key found for this signature in database
GPG Key ID: 0F6BB0657A03AC94
3 changed files with 0 additions and 124 deletions

View File

@ -1,49 +0,0 @@
/*
* This file is part of ViaLoader - https://github.com/RaphiMC/ViaLoader
* Copyright (C) 2020-2024 RK_01/RaphiMC and 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 net.raphimc.vialoader.commands.subs;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.command.ViaCommandSender;
import com.viaversion.viaversion.api.command.ViaSubCommand;
import com.viaversion.viaversion.api.connection.UserConnection;
import java.util.Set;
public class ConnectionsSubCommand implements ViaSubCommand {
@Override
public String name() {
return "connections";
}
@Override
public String description() {
return "Shows a list of all connections";
}
@Override
public boolean execute(ViaCommandSender viaCommandSender, String[] strings) {
final Set<UserConnection> users = Via.getManager().getConnectionManager().getConnections();
sendMessage(viaCommandSender, "&a--- Connected users ---");
for (UserConnection user : users) {
sendMessage(viaCommandSender, "&7[&6" + user.getProtocolInfo().getUsername() + "&7] UUID: &5" + user.getProtocolInfo().getUuid() + " &7Client-Protocol: &5" + user.getProtocolInfo().protocolVersion().getName() + " &7Server-Protocol: &5" + user.getProtocolInfo().serverProtocolVersion().getName());
}
return true;
}
}

View File

@ -1,67 +0,0 @@
/*
* This file is part of ViaLoader - https://github.com/RaphiMC/ViaLoader
* Copyright (C) 2020-2024 RK_01/RaphiMC and 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 net.raphimc.vialoader.commands.subs;
import com.viaversion.viaversion.api.command.ViaCommandSender;
import com.viaversion.viaversion.api.command.ViaSubCommand;
import io.netty.util.ResourceLeakDetector;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
public class LeakDetectSubCommand implements ViaSubCommand {
@Override
public String name() {
return "leakdetect";
}
@Override
public String description() {
return "Sets ResourceLeakDetector level";
}
@Override
public boolean execute(ViaCommandSender viaCommandSender, String[] strings) {
if (strings.length == 1) {
try {
ResourceLeakDetector.Level level = ResourceLeakDetector.Level.valueOf(strings[0]);
ResourceLeakDetector.setLevel(level);
viaCommandSender.sendMessage("Set leak detector level to " + level);
} catch (IllegalArgumentException e) {
viaCommandSender.sendMessage("Invalid level (" + Arrays.toString(ResourceLeakDetector.Level.values()) + ")");
}
} else {
viaCommandSender.sendMessage("Current leak detection level is " + ResourceLeakDetector.getLevel());
}
return true;
}
@Override
public List<String> onTabComplete(ViaCommandSender sender, String[] args) {
if (args.length == 1) {
return Arrays.stream(ResourceLeakDetector.Level.values())
.map(Enum::name)
.filter(it -> it.startsWith(args[0]))
.collect(Collectors.toList());
}
return ViaSubCommand.super.onTabComplete(sender, args);
}
}

View File

@ -18,14 +18,6 @@
package net.raphimc.vialoader.impl.viaversion;
import com.viaversion.viaversion.commands.ViaCommandHandler;
import net.raphimc.vialoader.commands.subs.ConnectionsSubCommand;
import net.raphimc.vialoader.commands.subs.LeakDetectSubCommand;
public class VLCommandHandler extends ViaCommandHandler {
public VLCommandHandler() {
this.registerSubCommand(new LeakDetectSubCommand());
this.registerSubCommand(new ConnectionsSubCommand());
}
}