wip: balancer modes
This commit is contained in:
@@ -0,0 +1,8 @@
|
|||||||
|
package us.ajg0702.queue.api.queues;
|
||||||
|
|
||||||
|
import us.ajg0702.queue.api.players.AdaptedPlayer;
|
||||||
|
import us.ajg0702.queue.api.server.AdaptedServer;
|
||||||
|
|
||||||
|
public interface Balancer {
|
||||||
|
AdaptedServer getIdealServer(AdaptedPlayer player);
|
||||||
|
}
|
||||||
@@ -232,6 +232,12 @@ public interface QueueServer {
|
|||||||
*/
|
*/
|
||||||
void setSupportedProtocols(List<Integer> list);
|
void setSupportedProtocols(List<Integer> list);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the balancer this server is using
|
||||||
|
* @return The balancer this server is using
|
||||||
|
*/
|
||||||
|
Balancer getBalancer();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* elliot is bad
|
* elliot is bad
|
||||||
|
|||||||
@@ -116,7 +116,9 @@ public class QueueManagerImpl implements QueueManager {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(player.getServerName().equals(server.getName())) {
|
List<AdaptedServer> notInServers = new ArrayList<>(server.getServers());
|
||||||
|
notInServers.removeIf(adaptedServer -> !adaptedServer.getName().equals(player.getServerName()));
|
||||||
|
if(notInServers.size() > 0) {
|
||||||
player.sendMessage(msgs.getComponent("errors.already-connected", "SERVER:"+server.getAlias()));
|
player.sendMessage(msgs.getComponent("errors.already-connected", "SERVER:"+server.getAlias()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -268,3 +268,12 @@ enable-updater: true
|
|||||||
# then they will be put in the queue for survival
|
# then they will be put in the queue for survival
|
||||||
# This works for both servers and groups
|
# This works for both servers and groups
|
||||||
slash-servers: []
|
slash-servers: []
|
||||||
|
|
||||||
|
# What balancer should we use?
|
||||||
|
# If a group is not specified here, then the default one is used
|
||||||
|
# Example entry: - bedwars: minigame
|
||||||
|
# Balancers:
|
||||||
|
# default - Will send the player to the server in the group with the least number of players
|
||||||
|
# minigame - Will send the player to the server with the most players, until that server is full, which it will then send to the next full server
|
||||||
|
balancer-types:
|
||||||
|
- bedwars: minigame
|
||||||
Reference in New Issue
Block a user