mirror of
https://github.com/BGHDDevelopment/PlayerBalancer.git
synced 2024-11-04 09:59:56 +01:00
Now all sections types may not have a provider
This commit is contained in:
parent
ba26697920
commit
b54ed5c5d5
@ -50,11 +50,7 @@ public class FallbackCommand extends Command {
|
||||
String bind = rules.getString(section.getName());
|
||||
ServerSection target = plugin.getSectionManager().getByName(bind);
|
||||
|
||||
if (target == null) {
|
||||
target = section.getParent();
|
||||
}
|
||||
|
||||
return target;
|
||||
return target == null ? section.getParent() : target;
|
||||
}
|
||||
} else {
|
||||
if (ConfigEntries.FALLBACK_PRINCIPAL_ENABLED.get()) {
|
||||
|
@ -53,14 +53,6 @@ public class ServerKickListener implements Listener {
|
||||
return null;
|
||||
}
|
||||
|
||||
Configuration rules = plugin.getConfig().getSection("settings.reconnect-kick.rules");
|
||||
String name = rules.getString(section.getName());
|
||||
ServerSection target = plugin.getSectionManager().getByName(name);
|
||||
|
||||
if (target == null) {
|
||||
target = section.getParent();
|
||||
}
|
||||
|
||||
AtomicBoolean matches = new AtomicBoolean(false);
|
||||
String reason = TextComponent.toPlainText(event.getKickReasonComponent());
|
||||
for (String pattern : ConfigEntries.RECONNECT_KICK_REASONS.get()) {
|
||||
@ -79,7 +71,11 @@ public class ServerKickListener implements Listener {
|
||||
}
|
||||
|
||||
if (matches.get()) {
|
||||
return target;
|
||||
Configuration rules = plugin.getConfig().getSection("settings.reconnect-kick.rules");
|
||||
String name = rules.getString(section.getName());
|
||||
ServerSection target = plugin.getSectionManager().getByName(name);
|
||||
|
||||
return target == null ? section.getParent() : target;
|
||||
}
|
||||
} else {
|
||||
if (ConfigEntries.FALLBACK_PRINCIPAL_ENABLED.get()) {
|
||||
|
@ -56,11 +56,6 @@ public class ServerSection {
|
||||
if (parent == null) {
|
||||
throw new IllegalArgumentException(String.format("The section \"%s\" has an invalid parent set", name));
|
||||
}
|
||||
} else {
|
||||
//Principal sections do not necessarily must have a parent section, but might
|
||||
if (!principal) {
|
||||
throw new IllegalArgumentException(String.format("The section \"%s\" does not have a parent set", name));
|
||||
}
|
||||
}
|
||||
|
||||
if (ConfigUtils.isSet(section, "servers")) {
|
||||
@ -166,6 +161,10 @@ public class ServerSection {
|
||||
return dummy;
|
||||
}
|
||||
|
||||
public boolean hasParent() {
|
||||
return parent != null;
|
||||
}
|
||||
|
||||
public ServerSection getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user