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