Skip to content

Commit 376b2ec

Browse files
drop command
1 parent 098df48 commit 376b2ec

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
plugin_version=3.0.12
1+
plugin_version=3.0.13
22
velocity_api_version=3.4.0-SNAPSHOT
33
minecraft_version=1.20.6
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package org.zeroBzeroT.anarchyqueue;
2+
3+
import com.velocitypowered.api.command.CommandSource;
4+
import com.velocitypowered.api.command.SimpleCommand;
5+
import com.velocitypowered.api.proxy.ConsoleCommandSource;
6+
import com.velocitypowered.api.proxy.ProxyServer;
7+
import net.kyori.adventure.text.Component;
8+
import com.velocitypowered.api.proxy.Player;
9+
10+
public class DropCommand implements SimpleCommand {
11+
12+
private final ProxyServer server;
13+
14+
public DropCommand(ProxyServer server) {
15+
this.server = server;
16+
}
17+
18+
@Override
19+
public void execute(Invocation invocation) {
20+
CommandSource source = invocation.source();
21+
String[] args = invocation.arguments();
22+
23+
if (source instanceof ConsoleCommandSource && args.length > 0) {
24+
// Use the plugin's proxy server instance
25+
Player target = server.getPlayer(args[0]).orElse(null);
26+
27+
if (target != null) {
28+
target.disconnect(Component.text("You have been disconnected."));
29+
} else {
30+
source.sendMessage(Component.text("Player not found!"));
31+
}
32+
}
33+
}
34+
}

src/main/java/org/zeroBzeroT/anarchyqueue/Main.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public Main(ProxyServer server, CommandManager commandManager, ComponentLogger l
4242
instance = this;
4343
this.metricsFactory = metricsFactory;
4444
server.getCommandManager().register("queue", new QueueCommand());
45+
server.getCommandManager().register("drop", new DropCommand(server));
4546
}
4647

4748
public static Main getInstance() {

0 commit comments

Comments
 (0)