Added /ajq pausequeueserver command, which will temporarily not queue you when you are in queue-servers

This commit is contained in:
ajgeiss0702
2023-01-11 10:04:14 -07:00
parent 555ef21192
commit 1372390988
11 changed files with 167 additions and 9 deletions
@@ -2,11 +2,14 @@ package us.ajg0702.queue.platforms.velocity.commands;
import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.proxy.ConsoleCommandSource;
import com.velocitypowered.api.proxy.Player;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
import org.jetbrains.annotations.NotNull;
import us.ajg0702.queue.api.commands.ICommandSender;
import java.util.UUID;
public class VelocitySender implements ICommandSender {
final CommandSource handle;
@@ -26,6 +29,12 @@ public class VelocitySender implements ICommandSender {
return !(handle instanceof ConsoleCommandSource);
}
@Override
public UUID getUniqueId() throws IllegalStateException {
if(!(handle instanceof Player)) throw new IllegalStateException("Cannot get UUID of non-player!");
return ((Player) handle).getUniqueId();
}
@Override
public void sendMessage(@NotNull Component message) {
if(PlainTextComponentSerializer.plainText().serialize(message).isEmpty()) return;
@@ -18,6 +18,7 @@ import us.ajg0702.queue.common.QueueMain;
import us.ajg0702.queue.common.utils.Debug;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.UUID;
@@ -205,4 +206,17 @@ public class VelocityPlayer implements AdaptedPlayer, Audience {
}
return true;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
VelocityPlayer that = (VelocityPlayer) o;
return handle.equals(that.handle);
}
@Override
public int hashCode() {
return Objects.hash(handle);
}
}