Add support for 1.19 paper
All checks were successful
continuous-integration/drone/tag Build is passing

This commit is contained in:
Jonttuuu 2022-07-27 17:38:32 +03:00
parent 3db153e360
commit 50c386951a

View File

@ -55,22 +55,54 @@ public final class FlexConnect extends JavaPlugin {
// Check paper config
boolean paperConfigModified = false;
final YamlConfiguration paperConfig = this.getServer().spigot().getPaperConfig();
// 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.getBoolean("settings.velocity-support.enabled")) {
}
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 (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 {