Change to bungeecord playerinfo forwarding for better server support
This commit is contained in:
parent
50c386951a
commit
d7ecefb3ff
@ -52,68 +52,25 @@ public final class FlexConnect extends JavaPlugin {
|
|||||||
configsModified = true;
|
configsModified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check paper config
|
// Check spigot config
|
||||||
boolean paperConfigModified = false;
|
boolean spigotConfigModified = false;
|
||||||
final YamlConfiguration paperConfig = this.getServer().spigot().getPaperConfig();
|
final YamlConfiguration spigotConfig = this.getServer().spigot().getSpigotConfig();
|
||||||
|
|
||||||
// Legacy paper configs (1.18 or older)
|
if (!spigotConfig.getBoolean("settings.bungeecord")) {
|
||||||
if (paperConfig.contains("settings.velocity-support.enabled")) {
|
spigotConfig.set("settings.bungeecord", true);
|
||||||
if (!paperConfig.getBoolean("settings.velocity-support.enabled")) {
|
spigotConfigModified = true;
|
||||||
paperConfig.set("settings.velocity-support.enabled", true);
|
|
||||||
paperConfigModified = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (paperConfig.contains("settings.velocity-support.online-mode")) {
|
|
||||||
if (!paperConfig.getBoolean("settings.velocity-support.online-mode")) {
|
|
||||||
paperConfig.set("settings.velocity-support.online-mode", true);
|
|
||||||
paperConfigModified = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (paperConfig.contains("settings.velocity-support.secret")) {
|
|
||||||
if (!paperConfig.getString("settings.velocity-support.secret").equals("flexplex")) {
|
|
||||||
paperConfig.set("settings.velocity-support.secret", "flexplex");
|
|
||||||
paperConfigModified = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Current paper configurations 1.19+
|
if (spigotConfigModified) {
|
||||||
if (paperConfig.contains("proxies.velocity.enabled")) {
|
|
||||||
if (!paperConfig.getBoolean("proxies.velocity.enabled")) {
|
|
||||||
paperConfig.set("proxies.velocity.enabled", true);
|
|
||||||
paperConfigModified = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (paperConfig.contains("proxies.velocity.online-mode")) {
|
|
||||||
if (!paperConfig.getBoolean("proxies.velocity.online-mode")) {
|
|
||||||
paperConfig.set("proxies.velocity.online-mode", true);
|
|
||||||
paperConfigModified = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (paperConfig.contains("proxies.velocity.secret")) {
|
|
||||||
if (!paperConfig.getString("proxies.velocity.secret").equals("flexplex")) {
|
|
||||||
paperConfig.set("proxies.velocity.secret", "flexplex");
|
|
||||||
paperConfigModified = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// In both configurations
|
|
||||||
if (paperConfig.contains("settings.unsupported-settings.perform-username-validation")) {
|
|
||||||
if (paperConfig.getBoolean("settings.unsupported-settings.perform-username-validation")) {
|
|
||||||
paperConfig.set("settings.unsupported-settings.perform-username-validation", false);
|
|
||||||
paperConfigModified = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (paperConfigModified) {
|
|
||||||
try {
|
try {
|
||||||
paperConfig.save("paper.yml");
|
spigotConfig.save("spigot.yml");
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
this.getLogger().warning("Automatic changes has been made to paper.yml config file.");
|
this.getLogger().warning("Automatic changes has been made to spigot.yml config file.");
|
||||||
configsModified = true;
|
configsModified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actions if configs were modified
|
// Actions if configs were modified
|
||||||
if (configsModified) {
|
if (configsModified) {
|
||||||
this.getLogger().warning("Changes has been made to config files. Server will now shutdown automatically.");
|
this.getLogger().warning("Changes has been made to config files. Server will now shutdown automatically.");
|
||||||
|
Loading…
Reference in New Issue
Block a user