progress
This commit is contained in:
@@ -14,12 +14,13 @@ repositories {
|
||||
dependencies {
|
||||
compileOnly("net.kyori:adventure-api:4.8.1")
|
||||
compileOnly("com.google.guava:guava:30.1.1-jre")
|
||||
compileOnly("us.ajg0702:ajUtils:1.1.5")
|
||||
compileOnly("us.ajg0702:ajUtils:1.1.6")
|
||||
|
||||
compileOnly("com.velocitypowered:velocity-api:3.0.0")
|
||||
annotationProcessor("com.velocitypowered:velocity-api:3.0.0")
|
||||
|
||||
implementation(project(":common"))
|
||||
implementation(project(":api"))
|
||||
}
|
||||
|
||||
|
||||
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package us.ajg0702.queue.platforms.velocity;
|
||||
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import us.ajg0702.queue.api.PlatformMethods;
|
||||
import us.ajg0702.queue.api.players.AdaptedPlayer;
|
||||
import us.ajg0702.queue.api.players.QueuePlayer;
|
||||
import us.ajg0702.queue.api.queues.QueueServer;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class PlatformMethodImpl implements PlatformMethods {
|
||||
|
||||
ProxyServer proxyServer;
|
||||
Logger logger;
|
||||
|
||||
public PlatformMethodImpl(ProxyServer proxyServer, Logger logger) {
|
||||
this.proxyServer = proxyServer;
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendJoinQueueChannelMessages(QueueServer queueServer, QueuePlayer queuePlayer) {
|
||||
AdaptedPlayer player = queuePlayer.getPlayer();
|
||||
if(player == null) return;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPluginMessage(AdaptedPlayer player, String channel, String... data) {
|
||||
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
package us.ajg0702.queue.platforms.velocity;
|
||||
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||
import us.ajg0702.queue.api.ServerBuilder;
|
||||
import us.ajg0702.queue.api.queues.QueueServer;
|
||||
import us.ajg0702.queue.api.server.AdaptedServer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public class ServerBuilderImpl implements ServerBuilder {
|
||||
|
||||
private final ProxyServer proxyServer;
|
||||
public ServerBuilderImpl(ProxyServer proxyServer) {
|
||||
this.proxyServer = proxyServer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<QueueServer> getServers() {
|
||||
List<QueueServer> result = new ArrayList<>();
|
||||
Collection<RegisteredServer> servers = proxyServer.getAllServers();
|
||||
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueueServer buildGroup(String name, List<AdaptedServer> servers) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+41
-1
@@ -1,8 +1,48 @@
|
||||
package us.ajg0702.queue.platforms.velocity;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.velocitypowered.api.event.Subscribe;
|
||||
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
|
||||
import com.velocitypowered.api.plugin.Plugin;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import us.ajg0702.queue.common.QueueMain;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@Plugin(
|
||||
id = "ajqueue",
|
||||
name = "ajQueue",
|
||||
version = "@VERSION@",
|
||||
url = "https://ajg0702.us",
|
||||
description = "Queue for servers",
|
||||
authors = {"ajgeiss0702"}
|
||||
)
|
||||
|
||||
@Plugin(id = "ajqueue", name = "ajQueue", version = "@VERSION@")
|
||||
public class VelocityQueue {
|
||||
ProxyServer proxyServer;
|
||||
Logger logger;
|
||||
|
||||
QueueMain main;
|
||||
|
||||
File dataFolder;
|
||||
|
||||
@Inject
|
||||
public VelocityQueue(ProxyServer proxyServer, Logger logger, Path dataFolder) {
|
||||
this.proxyServer = proxyServer;
|
||||
this.logger = logger;
|
||||
|
||||
this.dataFolder = dataFolder.toFile();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onProxyInit(ProxyInitializeEvent e) {
|
||||
main = new QueueMain(
|
||||
logger,
|
||||
new ServerBuilderImpl(proxyServer),
|
||||
new PlatformMethodImpl(proxyServer, logger),
|
||||
dataFolder
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
package us.ajg0702.queue.platforms.velocity.players;
|
||||
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.ServerConnection;
|
||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import us.ajg0702.queue.api.players.AdaptedPlayer;
|
||||
import us.ajg0702.queue.api.server.AdaptedServer;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
public class VelocityPlayer implements AdaptedPlayer {
|
||||
|
||||
Player handle;
|
||||
|
||||
public VelocityPlayer(Player player) {
|
||||
handle = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isConnected() {
|
||||
return handle.isActive();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(Component message) {
|
||||
handle.sendMessage(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendActionBar(Component message) {
|
||||
handle.sendActionBar(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(String message) {
|
||||
handle.sendMessage(Component.text().content(message));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(String permission) {
|
||||
return handle.hasPermission(permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServerName() {
|
||||
Optional<ServerConnection> serverConnection = handle.getCurrentServer();
|
||||
if(!serverConnection.isPresent()) return "none";
|
||||
ServerConnection connection = serverConnection.get();
|
||||
return connection.getServerInfo().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getUniqueId() {
|
||||
return handle.getUniqueId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connect(AdaptedServer server) {
|
||||
handle.createConnectionRequest((RegisteredServer) server.getHandle()).connect();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Player getHandle() {
|
||||
return handle;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package us.ajg0702.queue.platforms.velocity;
|
||||
|
||||
public class test {
|
||||
public static int i = 0;
|
||||
}
|
||||
Reference in New Issue
Block a user