mirror of
https://github.com/BGHDDevelopment/PlayerBalancer.git
synced 2024-09-17 10:14:10 +02:00
Added the dummy setting on sections, it is like the provider NONE but this only works when the player enters the section through the ServerConnectEvent
This commit is contained in:
parent
a8f6c9a964
commit
ba26697920
@ -21,7 +21,7 @@ import java.util.concurrent.ThreadLocalRandom;
|
||||
import static me.jaimemartz.lobbybalancer.LobbyBalancer.getPlayerCount;
|
||||
|
||||
public enum ProviderType {
|
||||
NONE(0, "Returns no server (dummy provider)") {
|
||||
NONE(0, "Returns no server") {
|
||||
@Override
|
||||
public ServerInfo requestTarget(LobbyBalancer plugin, ServerSection section, List<ServerInfo> list, ProxiedPlayer player) {
|
||||
return null;
|
||||
|
@ -4,7 +4,6 @@ import me.jaimemartz.faucet.Messager;
|
||||
import me.jaimemartz.lobbybalancer.LobbyBalancer;
|
||||
import me.jaimemartz.lobbybalancer.configuration.ConfigEntries;
|
||||
import me.jaimemartz.lobbybalancer.connection.ConnectionIntent;
|
||||
import me.jaimemartz.lobbybalancer.connection.ProviderType;
|
||||
import me.jaimemartz.lobbybalancer.connection.ServerAssignRegistry;
|
||||
import me.jaimemartz.lobbybalancer.manager.PlayerLocker;
|
||||
import me.jaimemartz.lobbybalancer.section.ServerSection;
|
||||
@ -52,6 +51,10 @@ public class ServerConnectListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
if (section.isDummy()) {
|
||||
return;
|
||||
}
|
||||
|
||||
new ConnectionIntent(plugin, player, section) {
|
||||
@Override
|
||||
public void connect(ServerInfo server) {
|
||||
|
@ -20,6 +20,7 @@ public class ServerSection {
|
||||
|
||||
private final String name;
|
||||
private boolean principal;
|
||||
private boolean dummy;
|
||||
private ServerSection parent;
|
||||
private boolean inherit = false;
|
||||
private List<ServerInfo> servers;
|
||||
@ -47,6 +48,8 @@ public class ServerSection {
|
||||
}
|
||||
}
|
||||
|
||||
dummy = section.getBoolean("dummy", false);
|
||||
|
||||
if (ConfigUtils.isSet(section, "parent")) {
|
||||
parent = manager.getByName(section.getString("parent"));
|
||||
|
||||
@ -159,6 +162,10 @@ public class ServerSection {
|
||||
return principal;
|
||||
}
|
||||
|
||||
public boolean isDummy() {
|
||||
return dummy;
|
||||
}
|
||||
|
||||
public ServerSection getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
# Remember to set enabled under settings to true
|
||||
|
||||
# Providers of this plugin
|
||||
# NONE: Returns no server (dummy provider)
|
||||
# NONE: Returns no server
|
||||
# DIRECT: Returns the only server in the list
|
||||
# LOCALIZED: Returns the server that matches a region (testing)
|
||||
# LOWEST: Returns the server with the least players online
|
||||
@ -168,6 +168,12 @@ sections:
|
||||
name: 'playskywars'
|
||||
permission: ''
|
||||
aliases: []
|
||||
dummy-section:
|
||||
provider: RANDOM
|
||||
dummy: true
|
||||
parent: 'skywars-lobbies'
|
||||
section-server:
|
||||
servers: ["DS1"]
|
||||
practice:
|
||||
provider: LOCALIZED
|
||||
parent: 'general-lobbies'
|
||||
|
Loading…
Reference in New Issue
Block a user