Change to bungeecord playerinfo forwarding for better server support
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing

This commit is contained in:
Jonttuuu 2022-08-29 12:27:07 +03:00
parent 50c386951a
commit d7ecefb3ff

View File

@ -52,65 +52,22 @@ public final class FlexConnect extends JavaPlugin {
configsModified = true;
}
// Check paper config
boolean paperConfigModified = false;
final YamlConfiguration paperConfig = this.getServer().spigot().getPaperConfig();
// Check spigot config
boolean spigotConfigModified = false;
final YamlConfiguration spigotConfig = this.getServer().spigot().getSpigotConfig();
// Legacy paper configs (1.18 or older)
if (paperConfig.contains("settings.velocity-support.enabled")) {
if (!paperConfig.getBoolean("settings.velocity-support.enabled")) {
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;
}
if (!spigotConfig.getBoolean("settings.bungeecord")) {
spigotConfig.set("settings.bungeecord", true);
spigotConfigModified = true;
}
// Current paper configurations 1.19+
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) {
if (spigotConfigModified) {
try {
paperConfig.save("paper.yml");
spigotConfig.save("spigot.yml");
} catch (final IOException e) {
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;
}