mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-21 20:56:45 +01:00
Extract method
This commit is contained in:
parent
1e9a27ccea
commit
ffebffec77
@ -397,7 +397,20 @@ public abstract class PlotArea implements ComponentLike {
|
||||
this.spawnCustom = config.getBoolean("event.spawn.custom");
|
||||
this.spawnBreeding = config.getBoolean("event.spawn.breeding");
|
||||
|
||||
Runnable loadFlags = () -> {
|
||||
if (PlotSquared.get().isWeInitialised()) {
|
||||
loadFlags(config);
|
||||
} else {
|
||||
ConsolePlayer.getConsole().sendMessage(
|
||||
TranslatableCaption.of("flags.delaying_loading_area_flags"),
|
||||
TagResolver.resolver("area", Tag.inserting(Component.text(this.id == null ? this.worldName : this.id)))
|
||||
);
|
||||
TaskManager.runTaskLater(() -> loadFlags(config), TaskTime.ticks(1));
|
||||
}
|
||||
|
||||
loadConfiguration(config);
|
||||
}
|
||||
|
||||
private void loadFlags(ConfigurationSection config) {
|
||||
ConsolePlayer.getConsole().sendMessage(
|
||||
TranslatableCaption.of("flags.loading_area_flags"),
|
||||
TagResolver.resolver("area", Tag.inserting(Component.text(this.id == null ? this.worldName : this.id)))
|
||||
@ -433,24 +446,12 @@ public abstract class PlotArea implements ComponentLike {
|
||||
}
|
||||
}
|
||||
}
|
||||
this.roadFlags = roadflags.size() > 0;
|
||||
this.roadFlags = !roadflags.isEmpty();
|
||||
parseFlags(this.getRoadFlagContainer(), roadflags);
|
||||
ConsolePlayer.getConsole().sendMessage(
|
||||
TranslatableCaption.of("flags.road_flags"),
|
||||
TagResolver.resolver("flags", Tag.inserting(Component.text(roadflags.toString())))
|
||||
);
|
||||
};
|
||||
if (PlotSquared.get().isWeInitialised()) {
|
||||
loadFlags.run();
|
||||
} else {
|
||||
ConsolePlayer.getConsole().sendMessage(
|
||||
TranslatableCaption.of("flags.delaying_loading_area_flags"),
|
||||
TagResolver.resolver("area", Tag.inserting(Component.text(this.id == null ? this.worldName : this.id)))
|
||||
);
|
||||
TaskManager.runTaskLater(loadFlags, TaskTime.ticks(1));
|
||||
}
|
||||
|
||||
loadConfiguration(config);
|
||||
}
|
||||
|
||||
public abstract void loadConfiguration(ConfigurationSection config);
|
||||
|
Loading…
Reference in New Issue
Block a user