the basics are working on velocity now

This commit is contained in:
ajgeiss0702
2021-07-12 14:14:34 -07:00
parent 80f9eb262d
commit 6f24594945
15 changed files with 457 additions and 25 deletions
@@ -9,6 +9,8 @@ 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.listqueues.ListCommand;
import us.ajg0702.queue.commands.commands.manage.ManageCommand;
import us.ajg0702.queue.commands.commands.queue.QueueCommand;
import us.ajg0702.queue.common.QueueMain;
import us.ajg0702.queue.platforms.velocity.commands.VelocityCommand;
@@ -59,7 +61,9 @@ public class VelocityQueue {
List<BaseCommand> commands = Arrays.asList(
new QueueCommand(main),
new LeaveCommand(main)
new LeaveCommand(main),
new ListCommand(main),
new ManageCommand(main)
);
for(BaseCommand command : commands) {
@@ -1,11 +1,11 @@
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;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
import us.ajg0702.queue.api.players.AdaptedPlayer;
import us.ajg0702.queue.api.server.AdaptedServer;
@@ -27,6 +27,7 @@ public class VelocityPlayer implements AdaptedPlayer, Audience {
@Override
public void sendMessage(Component message) {
if(PlainTextComponentSerializer.plainText().serialize(message).isEmpty()) return;
handle.sendMessage(message);
}
@@ -27,14 +27,14 @@ public class VelocityServerPing implements AdaptedServerPing {
@Override
public int getPlayerCount() {
Optional<ServerPing.Players> players = handle.getPlayers();
if(players.isPresent()) return 0;
if(!players.isPresent()) return 0;
return players.get().getOnline();
}
@Override
public int getMaxPlayers() {
Optional<ServerPing.Players> players = handle.getPlayers();
if(players.isPresent()) return 0;
if(!players.isPresent()) return 0;
return players.get().getMax();
}