mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-21 15:41:43 +01:00
Skip upgrading random teleport config when tpr.yml isn't initialized yet (#6003)
If there's no tpr.yml, upgrading the random teleport config will fail and the plugin cannot be loaded.
This commit is contained in:
parent
8e53214b50
commit
667b0f7523
@ -164,26 +164,28 @@ public class EssentialsUpgrade {
|
||||
|
||||
final EssentialsConfiguration config = ess.getRandomTeleport().getConfig();
|
||||
|
||||
final LazyLocation center = config.getLocation("center");
|
||||
final Location centerLoc = center != null ? center.location() : null;
|
||||
if (center != null && centerLoc != null) {
|
||||
final double minRange = config.getDouble("min-range", Double.MIN_VALUE);
|
||||
final double maxRange = config.getDouble("max-range", Double.MIN_VALUE);
|
||||
for (final World world : ess.getServer().getWorlds()) {
|
||||
final String propPrefix = "locations." + world.getName() + ".";
|
||||
config.setProperty(propPrefix + "center", centerLoc);
|
||||
if (config.getRootNode() != null) {
|
||||
final LazyLocation center = config.getLocation("center");
|
||||
final Location centerLoc = center != null ? center.location() : null;
|
||||
if (center != null && centerLoc != null) {
|
||||
final double minRange = config.getDouble("min-range", Double.MIN_VALUE);
|
||||
final double maxRange = config.getDouble("max-range", Double.MIN_VALUE);
|
||||
for (final World world : ess.getServer().getWorlds()) {
|
||||
final String propPrefix = "locations." + world.getName() + ".";
|
||||
config.setProperty(propPrefix + "center", centerLoc);
|
||||
|
||||
if (minRange != Double.MIN_VALUE) {
|
||||
config.setProperty(propPrefix + "min-range", minRange);
|
||||
}
|
||||
if (maxRange != Double.MIN_VALUE) {
|
||||
config.setProperty(propPrefix + "max-range", maxRange);
|
||||
if (minRange != Double.MIN_VALUE) {
|
||||
config.setProperty(propPrefix + "min-range", minRange);
|
||||
}
|
||||
if (maxRange != Double.MIN_VALUE) {
|
||||
config.setProperty(propPrefix + "max-range", maxRange);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
config.removeProperty("center");
|
||||
config.removeProperty("center");
|
||||
|
||||
config.blockingSave();
|
||||
config.blockingSave();
|
||||
}
|
||||
|
||||
doneFile.setProperty("updateRandomTeleport", true);
|
||||
doneFile.save();
|
||||
|
Loading…
Reference in New Issue
Block a user