Skip to content

Commit 5747b9f

Browse files
committed
Dummy sections with already registered servers
Also added some TODOs and some little changes to the configuration
1 parent 7b5cdce commit 5747b9f

File tree

5 files changed

+36
-30
lines changed

5 files changed

+36
-30
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
[![Build Status](https://travis-ci.com/jaime29010/LobbyBalancer.svg?token=2yUi9WpA9QzSbJx9eTmy&branch=master)](https://travis-ci.com/jaime29010/LobbyBalancer)
55

66
### Things to do:
7+
- [x] Get dummy sections able to have already registered servers on other sections
8+
- [ ] Make `marker-descs` work per section
79
- [ ] Unify the code that loads server into a section (duplicated at SectionManager and ServerSection)
10+
- [ ] Unify some of the code used in the FallbackCommand and SectionCommand
811
- [ ] Make the way of matching a string configurable (wildcard, contains, similar, regex)
912
- [ ] Make the section initialization work in stages instead of being hardcoded
1013
- [ ] Ditch the faucet dependency and use [ConfigMe](https://github.com/AuthMe/ConfigMe) and [DependencyInjector](https://github.com/ljacqu/DependencyInjector) instead

src/main/java/me/jaimemartz/lobbybalancer/LobbyBalancer.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@
2323
import java.util.logging.Level;
2424

2525
public class LobbyBalancer extends Plugin {
26-
public static final String USER_ID = "%%__USER__%%";
27-
public static final String RESOURCE_ID = "%%__RESOURCE__%%";
28-
public static final String NONCE_ID = "%%__NONCE__%%";
2926
private static final int LAST_VER_CONFIG_UPDATE = 20950;
3027

3128
@Getter private ConfigFactory factory;

src/main/java/me/jaimemartz/lobbybalancer/section/SectionManager.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ public void flush() {
104104

105105
public void register(ServerInfo server, ServerSection section) {
106106
if (servers.containsKey(server)) {
107+
if (section.isDummy()) {
108+
return;
109+
}
110+
107111
ServerSection other = servers.get(server);
108112
throw new IllegalArgumentException(String.format("The server \"%s\" is already in the section \"%s\"", server.getName(), other.getName()));
109113
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package me.jaimemartz.lobbybalancer.utils;
2+
3+
public class FileInfo {
4+
public static final String USER_ID = "%%__USER__%%";
5+
public static final String RESOURCE_ID = "%%__RESOURCE__%%";
6+
public static final String NONCE_ID = "%%__NONCE__%%";
7+
}

src/main/resources/config.yml

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -134,48 +134,43 @@ settings:
134134
# FILLER: Returns the server with the most players online that is not full
135135

136136
sections:
137+
auth-lobbies:
138+
provider: RANDOM
139+
servers: ["Auth1", "Auth2", "Auth3"]
140+
137141
general-lobbies:
142+
parent: 'auth-lobbies'
138143
principal: true
139144
provider: RANDOM
140-
section-server: 'general-lobbies'
141145
servers: ["Lobby1", "Lobby2", "Lobby3"]
142-
eggwars-lobbies:
143-
parent: 'general-lobbies'
144-
section-server: 'eggwars-lobbies'
145-
servers: ["EWLobby1", "EWLobby2", "EWLobby3"]
146-
eggwars-games:
147-
provider: FILLER
148-
parent: 'eggwars-lobbies'
149-
servers: ["EW1", "EW2", "EW3", "EW4", "EW5"]
150-
section-command:
151-
name: 'playeggwars'
152-
permission: ''
153-
aliases: []
146+
154147
skywars-lobbies:
155148
parent: 'general-lobbies'
156-
section-server: 'skywars-lobbies'
149+
parent: LOWEST
157150
servers: ["SWLobby1", "SWLobby2", "SWLobby3"]
151+
158152
skywars-games:
159153
provider: FILLER
160154
parent: 'skywars-lobbies'
161-
servers: ["SW1", "SW2", "SW3", "SW4", "SW5"]
155+
servers: [
156+
"SW_A1", "SW_A2", "SW_A3", "SW_A4", "SW_A5",
157+
"SW_B1", "SW_B2", "SW_B3", "SW_B4", "SW_B5"
158+
]
159+
section-server: 'randomskywars'
162160
section-command:
163161
name: 'playskywars'
164162
permission: ''
165-
aliases: []
166-
dummy-section:
167-
provider: RANDOM
163+
aliases: ["skywars"]
164+
skywars-typea:
168165
dummy: true
169166
parent: 'skywars-lobbies'
170-
servers: ["DS1"]
171-
practice:
172-
provider: LOCALIZED
173-
parent: 'general-lobbies'
174-
servers: ["EUPractice", "USPractice"]
175-
section-command:
176-
name: 'practice'
177-
permission: ''
178-
aliases: ["rektnoobs"]
167+
servers: ["SW_A1", "SW_A2", "SW_A3", "SW_A4", "SW_A5"]
168+
section-server: 'skywarstypea'
169+
skywars-typeb:
170+
dummy: true
171+
parent: 'skywars-lobbies'
172+
servers: ["SW_B1", "SW_B2", "SW_B3", "SW_B4", "SW_B5"]
173+
section-server: 'skywarstypeb'
179174

180175
# Do not modify this
181176
version: '${project.version}'

0 commit comments

Comments
 (0)