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; 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;
} }