progress
This commit is contained in:
+5
-1
@@ -8,6 +8,7 @@ import com.velocitypowered.api.plugin.Plugin;
|
||||
import com.velocitypowered.api.plugin.annotation.DataDirectory;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import us.ajg0702.queue.commands.BaseCommand;
|
||||
import us.ajg0702.queue.commands.commands.leavequeue.LeaveCommand;
|
||||
import us.ajg0702.queue.commands.commands.queue.QueueCommand;
|
||||
import us.ajg0702.queue.common.QueueMain;
|
||||
import us.ajg0702.queue.platforms.velocity.commands.VelocityCommand;
|
||||
@@ -56,7 +57,10 @@ public class VelocityQueue {
|
||||
CommandManager commandManager = proxyServer.getCommandManager();
|
||||
|
||||
|
||||
List<BaseCommand> commands = Arrays.asList(new QueueCommand(main));
|
||||
List<BaseCommand> commands = Arrays.asList(
|
||||
new QueueCommand(main),
|
||||
new LeaveCommand(main)
|
||||
);
|
||||
|
||||
for(BaseCommand command : commands) {
|
||||
commandManager.register(
|
||||
|
||||
+6
@@ -3,6 +3,7 @@ package us.ajg0702.queue.platforms.velocity.commands;
|
||||
import com.velocitypowered.api.command.CommandSource;
|
||||
import com.velocitypowered.api.proxy.ConsoleCommandSource;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import us.ajg0702.queue.api.commands.ICommandSender;
|
||||
|
||||
public class VelocitySender implements ICommandSender {
|
||||
@@ -23,6 +24,11 @@ public class VelocitySender implements ICommandSender {
|
||||
return !(handle instanceof ConsoleCommandSource);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(Component message) {
|
||||
handle.sendMessage(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandSource getHandle() {
|
||||
return handle;
|
||||
|
||||
+1
@@ -1,6 +1,7 @@
|
||||
package us.ajg0702.queue.platforms.velocity.players;
|
||||
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import com.velocitypowered.api.proxy.ServerConnection;
|
||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ public class ServerBuilderImpl implements ServerBuilder {
|
||||
@Override
|
||||
public AdaptedServer getServer(String name) {
|
||||
Optional<RegisteredServer> serverOptional = proxyServer.getServer(name);
|
||||
if(serverOptional.isEmpty()) return null;
|
||||
if(serverOptional.isPresent()) return null;
|
||||
return new VelocityServer(serverOptional.get());
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -27,14 +27,14 @@ public class VelocityServerPing implements AdaptedServerPing {
|
||||
@Override
|
||||
public int getPlayerCount() {
|
||||
Optional<ServerPing.Players> players = handle.getPlayers();
|
||||
if(players.isEmpty()) return 0;
|
||||
if(players.isPresent()) return 0;
|
||||
return players.get().getOnline();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxPlayers() {
|
||||
Optional<ServerPing.Players> players = handle.getPlayers();
|
||||
if(players.isEmpty()) return 0;
|
||||
if(players.isPresent()) return 0;
|
||||
return players.get().getMax();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user