should finish api

This commit is contained in:
ajgeiss0702
2021-07-02 10:53:09 -07:00
parent 232bcdea09
commit c8562e0018
6 changed files with 95 additions and 1 deletions
@@ -0,0 +1,17 @@
package us.ajg0702.queue.api;
public interface AliasManager {
/**
* Gets an alias from the server/group's name
* @param server The original name of the server
* @return The set alias (set in the config)
*/
String getAlias(String server);
/**
* Gets the name of the server/group from an alias
* @param alias The alias
* @return The name of the server/group
*/
String getServer(String alias);
}
@@ -0,0 +1,22 @@
package us.ajg0702.queue.api;
import us.ajg0702.queue.api.players.AdaptedPlayer;
import us.ajg0702.queue.api.players.QueuePlayer;
import java.util.List;
public interface Logic {
/**
* Returns if the plugin is premium or not
* @return True if premium, false if not
*/
boolean isPremium();
/**
* The priority logic that is executed if the plugin is premium.
* @param list The current queue
* @param server The server/group name that is being queued for
* @param player The player that is being queued
*/
void priorityLogic(List<QueuePlayer> list, String server, AdaptedPlayer player);
}
@@ -1,5 +1,6 @@
package us.ajg0702.queue.api;
import com.google.common.collect.ImmutableList;
import us.ajg0702.queue.api.players.AdaptedPlayer;
import us.ajg0702.queue.api.queues.QueueServer;
@@ -11,6 +12,27 @@ public interface QueueManager {
* @param server The server or group to add the player to
* @return True if adding was successfull, false if not.
*/
public boolean addToQueue(AdaptedPlayer player, QueueServer server);
boolean addToQueue(AdaptedPlayer player, QueueServer server);
/**
* Adds a player to a queue
* @param player The player to be added
* @param serverName The name of the server or group to add the player too
* @return True if adding was successfull, false if not.
*/
boolean addToQueue(AdaptedPlayer player, String serverName);
/**
* Gets a list of QueueServers (servers and groups)
* @return A list of QueueServerss
*/
ImmutableList<QueueServer> getServers();
/**
* Gets a list of QueueServer (servers and groups) names
* @return A list of QueueServer names
*/
ImmutableList<String> getServerNames();
}
@@ -1,4 +1,19 @@
package us.ajg0702.queue.api.players;
import javax.annotation.Nullable;
import java.util.UUID;
public interface QueuePlayer {
/**
* Returns the player's UUID
* @return the player's UUID
*/
UUID getUniqueId();
/**
* Get the player this represents.
* Can be null because the player could not be online
* @return The player if they are online, null otherwise
*/
@Nullable AdaptedPlayer getPlayer();
}
@@ -110,6 +110,22 @@ public interface QueueServer {
*/
boolean isFull();
/**
* Removes a player from the queue
* @param player The player to remove
*/
void removePlayer(QueuePlayer player);
/**
* Adds a player to a queue
* NOTE: It is reccomended to use QueueManager#addToQueue
* @param player The QueuePlayer that is being added
*/
void addPlayer(QueuePlayer player);
/**
* elliot is bad
* @return true because elliot is bad