lots of progress
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package us.ajg0702.queue.api;
|
||||
|
||||
import us.ajg0702.queue.api.players.AdaptedPlayer;
|
||||
|
||||
public interface PlatformMethods {
|
||||
/**
|
||||
* BungeeUtils.sendCustomData(p, "position", pos+"");
|
||||
* BungeeUtils.sendCustomData(p, "positionof", len+"");
|
||||
* BungeeUtils.sendCustomData(p, "queuename", pl.aliases.getAlias(s));
|
||||
* BungeeUtils.sendCustomData(p, "inqueue", "true");
|
||||
* BungeeUtils.sendCustomData(p, "inqueueevent", "true");
|
||||
*/
|
||||
void sendJoinQueueChannelMessages();
|
||||
|
||||
/**
|
||||
* Sends a plugin message on the plugin messaging channel
|
||||
* @param player The player to send the message through
|
||||
* @param channel The (sub)channel
|
||||
* @param data The data
|
||||
*/
|
||||
void sendPluginMessage(AdaptedPlayer player, String channel, String... data);
|
||||
|
||||
}
|
||||
@@ -75,9 +75,9 @@ public interface QueueManager {
|
||||
|
||||
/**
|
||||
* Send a chat queue status message to a specific player in a specific queue
|
||||
* @param player The player that is in the queue
|
||||
* @param queuePlayer The player that is in the queue
|
||||
*/
|
||||
void sendMessage(QueuePlayer player);
|
||||
void sendMessage(QueuePlayer queuePlayer);
|
||||
|
||||
/**
|
||||
* Find a server by its name
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package us.ajg0702.queue.api;
|
||||
|
||||
import us.ajg0702.queue.api.queues.QueueServer;
|
||||
import us.ajg0702.queue.api.server.AdaptedServer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ServerBuilder {
|
||||
List<QueueServer> getServers();
|
||||
|
||||
QueueServer buildGroup(String name, List<AdaptedServer> servers);
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package us.ajg0702.queue.api.players;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import us.ajg0702.queue.api.server.AdaptedServer;
|
||||
import us.ajg0702.queue.api.util.Handle;
|
||||
|
||||
import java.util.UUID;
|
||||
@@ -22,6 +23,12 @@ public interface AdaptedPlayer extends Handle {
|
||||
*/
|
||||
void sendMessage(Component message);
|
||||
|
||||
/**
|
||||
* Sends an actionbar message to the player
|
||||
* @param message The message to send
|
||||
*/
|
||||
void sendActionBar(Component message);
|
||||
|
||||
/**
|
||||
* Send a player a message from a string
|
||||
* Converted to Component internally
|
||||
@@ -47,4 +54,10 @@ public interface AdaptedPlayer extends Handle {
|
||||
* @return The player's uuid
|
||||
*/
|
||||
UUID getUniqueId();
|
||||
|
||||
/**
|
||||
* Sends the player to a different server.
|
||||
* Does not use the queue.
|
||||
*/
|
||||
void connect(AdaptedServer server);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package us.ajg0702.queue.api.queues;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import us.ajg0702.queue.api.players.AdaptedPlayer;
|
||||
import us.ajg0702.queue.api.players.QueuePlayer;
|
||||
import us.ajg0702.queue.api.server.AdaptedServer;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
@@ -163,7 +164,33 @@ public interface QueueServer {
|
||||
*/
|
||||
String getAlias();
|
||||
|
||||
/**
|
||||
* Get the servers that this QueueServer represents
|
||||
* @return A list of servers that this QueueServer represents
|
||||
*/
|
||||
ImmutableList<AdaptedServer> getServers();
|
||||
|
||||
/**
|
||||
* Gets the names of the servers in this group
|
||||
* @return A list of names
|
||||
*/
|
||||
ImmutableList<String> getServerNames();
|
||||
|
||||
|
||||
/**
|
||||
* Returns if this server is a group
|
||||
* @return True if this server is a group
|
||||
*/
|
||||
boolean isGroup();
|
||||
|
||||
/**
|
||||
* Finds the player in this queue and returns the representative QueuePlayer
|
||||
* @return The QueuePlayer representing the player, null if not found
|
||||
*/
|
||||
QueuePlayer findPlayer(AdaptedPlayer player);
|
||||
|
||||
|
||||
AdaptedServer getIdealServer(AdaptedPlayer player);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package us.ajg0702.queue.api.server;
|
||||
|
||||
import us.ajg0702.queue.api.players.AdaptedPlayer;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public interface AdaptedServer {
|
||||
|
||||
/**
|
||||
* Gets the ServerInfo for this server
|
||||
* @return The AdaptedServerInfo for this server
|
||||
*/
|
||||
AdaptedServerInfo getServerInfo();
|
||||
|
||||
/**
|
||||
* Pings the server and gets info back
|
||||
* @return A CompletableFuture with the ServerPing
|
||||
*/
|
||||
CompletableFuture<AdaptedServerPing> ping();
|
||||
|
||||
/**
|
||||
* If the player can access the server
|
||||
* Uses bungeecord's restricted server feature
|
||||
* Will always return true on other platforms
|
||||
* @param player The player to check
|
||||
* @return False if the server is restricted and the player does not have permission to join.
|
||||
*/
|
||||
boolean canAccess(AdaptedPlayer player);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package us.ajg0702.queue.api.server;
|
||||
|
||||
public interface AdaptedServerInfo {
|
||||
|
||||
/**
|
||||
* Gets the name of the server
|
||||
* @return The name of the server
|
||||
*/
|
||||
String getName();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package us.ajg0702.queue.api.server;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
|
||||
public interface AdaptedServerPing {
|
||||
/**
|
||||
* Gets the component of the description (aka MOTD)
|
||||
* @return A compoent of the description
|
||||
*/
|
||||
Component getDescriptionComponent();
|
||||
|
||||
/**
|
||||
* Gets the description stripped of any color or styling
|
||||
* @return The description, but no colors
|
||||
*/
|
||||
String getPlainDescription();
|
||||
|
||||
/**
|
||||
* Gets the number of players currently online
|
||||
* @return The number of players online
|
||||
*/
|
||||
int getPlayerCount();
|
||||
|
||||
/**
|
||||
* Gets the maximum number of players that can join.
|
||||
* @return The maximum number of players that can join
|
||||
*/
|
||||
int getMaxPlayers();
|
||||
}
|
||||
Reference in New Issue
Block a user