Dummy sections with already registered servers

Also added some TODOs and some little changes to the configuration
This commit is contained in:
Jaime Martinez Rincon 2017-06-28 20:04:02 +02:00
parent 7b5cdce134
commit 5747b9f064
5 changed files with 36 additions and 30 deletions

View File

@ -4,7 +4,10 @@
[![Build Status](https://travis-ci.com/jaime29010/LobbyBalancer.svg?token=2yUi9WpA9QzSbJx9eTmy&branch=master)](https://travis-ci.com/jaime29010/LobbyBalancer)
### Things to do:
- [x] Get dummy sections able to have already registered servers on other sections
- [ ] Make `marker-descs` work per section
- [ ] Unify the code that loads server into a section (duplicated at SectionManager and ServerSection)
- [ ] Unify some of the code used in the FallbackCommand and SectionCommand
- [ ] Make the way of matching a string configurable (wildcard, contains, similar, regex)
- [ ] Make the section initialization work in stages instead of being hardcoded
- [ ] Ditch the faucet dependency and use [ConfigMe](https://github.com/AuthMe/ConfigMe) and [DependencyInjector](https://github.com/ljacqu/DependencyInjector) instead

View File

@ -23,9 +23,6 @@ import java.io.IOException;
import java.util.logging.Level;
public class LobbyBalancer extends Plugin {
public static final String USER_ID = "%%__USER__%%";
public static final String RESOURCE_ID = "%%__RESOURCE__%%";
public static final String NONCE_ID = "%%__NONCE__%%";
private static final int LAST_VER_CONFIG_UPDATE = 20950;
@Getter private ConfigFactory factory;

View File

@ -104,6 +104,10 @@ public class SectionManager {
public void register(ServerInfo server, ServerSection section) {
if (servers.containsKey(server)) {
if (section.isDummy()) {
return;
}
ServerSection other = servers.get(server);
throw new IllegalArgumentException(String.format("The server \"%s\" is already in the section \"%s\"", server.getName(), other.getName()));
}

View File

@ -0,0 +1,7 @@
package me.jaimemartz.lobbybalancer.utils;
public class FileInfo {
public static final String USER_ID = "%%__USER__%%";
public static final String RESOURCE_ID = "%%__RESOURCE__%%";
public static final String NONCE_ID = "%%__NONCE__%%";
}

View File

@ -134,48 +134,43 @@ settings:
# FILLER: Returns the server with the most players online that is not full
sections:
auth-lobbies:
provider: RANDOM
servers: ["Auth1", "Auth2", "Auth3"]
general-lobbies:
parent: 'auth-lobbies'
principal: true
provider: RANDOM
section-server: 'general-lobbies'
servers: ["Lobby1", "Lobby2", "Lobby3"]
eggwars-lobbies:
parent: 'general-lobbies'
section-server: 'eggwars-lobbies'
servers: ["EWLobby1", "EWLobby2", "EWLobby3"]
eggwars-games:
provider: FILLER
parent: 'eggwars-lobbies'
servers: ["EW1", "EW2", "EW3", "EW4", "EW5"]
section-command:
name: 'playeggwars'
permission: ''
aliases: []
skywars-lobbies:
parent: 'general-lobbies'
section-server: 'skywars-lobbies'
parent: LOWEST
servers: ["SWLobby1", "SWLobby2", "SWLobby3"]
skywars-games:
provider: FILLER
parent: 'skywars-lobbies'
servers: ["SW1", "SW2", "SW3", "SW4", "SW5"]
servers: [
"SW_A1", "SW_A2", "SW_A3", "SW_A4", "SW_A5",
"SW_B1", "SW_B2", "SW_B3", "SW_B4", "SW_B5"
]
section-server: 'randomskywars'
section-command:
name: 'playskywars'
permission: ''
aliases: []
dummy-section:
provider: RANDOM
aliases: ["skywars"]
skywars-typea:
dummy: true
parent: 'skywars-lobbies'
servers: ["DS1"]
practice:
provider: LOCALIZED
parent: 'general-lobbies'
servers: ["EUPractice", "USPractice"]
section-command:
name: 'practice'
permission: ''
aliases: ["rektnoobs"]
servers: ["SW_A1", "SW_A2", "SW_A3", "SW_A4", "SW_A5"]
section-server: 'skywarstypea'
skywars-typeb:
dummy: true
parent: 'skywars-lobbies'
servers: ["SW_B1", "SW_B2", "SW_B3", "SW_B4", "SW_B5"]
section-server: 'skywarstypeb'
# Do not modify this
version: '${project.version}'