mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
fix: load flags after we is initliased
- fixes #4073 - it could be possible to add a callback in the WE initilised event listener, but that overcomplicates it a bit and this is fine tbh
This commit is contained in:
parent
d95c74d8c9
commit
1e9a27ccea
@ -51,6 +51,8 @@ import com.plotsquared.core.util.MathMan;
|
|||||||
import com.plotsquared.core.util.PlotExpression;
|
import com.plotsquared.core.util.PlotExpression;
|
||||||
import com.plotsquared.core.util.RegionUtil;
|
import com.plotsquared.core.util.RegionUtil;
|
||||||
import com.plotsquared.core.util.StringMan;
|
import com.plotsquared.core.util.StringMan;
|
||||||
|
import com.plotsquared.core.util.task.TaskManager;
|
||||||
|
import com.plotsquared.core.util.task.TaskTime;
|
||||||
import com.sk89q.worldedit.math.BlockVector2;
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
@ -391,6 +393,15 @@ public abstract class PlotArea implements ComponentLike {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.spawnEggs = config.getBoolean("event.spawn.egg");
|
||||||
|
this.spawnCustom = config.getBoolean("event.spawn.custom");
|
||||||
|
this.spawnBreeding = config.getBoolean("event.spawn.breeding");
|
||||||
|
|
||||||
|
Runnable loadFlags = () -> {
|
||||||
|
ConsolePlayer.getConsole().sendMessage(
|
||||||
|
TranslatableCaption.of("flags.loading_area_flags"),
|
||||||
|
TagResolver.resolver("area", Tag.inserting(Component.text(this.id == null ? this.worldName : this.id)))
|
||||||
|
);
|
||||||
List<String> flags = config.getStringList("flags.default");
|
List<String> flags = config.getStringList("flags.default");
|
||||||
if (flags.isEmpty()) {
|
if (flags.isEmpty()) {
|
||||||
flags = config.getStringList("flags");
|
flags = config.getStringList("flags");
|
||||||
@ -411,10 +422,6 @@ public abstract class PlotArea implements ComponentLike {
|
|||||||
TagResolver.resolver("flags", Tag.inserting(Component.text(flags.toString())))
|
TagResolver.resolver("flags", Tag.inserting(Component.text(flags.toString())))
|
||||||
);
|
);
|
||||||
|
|
||||||
this.spawnEggs = config.getBoolean("event.spawn.egg");
|
|
||||||
this.spawnCustom = config.getBoolean("event.spawn.custom");
|
|
||||||
this.spawnBreeding = config.getBoolean("event.spawn.breeding");
|
|
||||||
|
|
||||||
List<String> roadflags = config.getStringList("road.flags");
|
List<String> roadflags = config.getStringList("road.flags");
|
||||||
if (roadflags.isEmpty()) {
|
if (roadflags.isEmpty()) {
|
||||||
roadflags = new ArrayList<>();
|
roadflags = new ArrayList<>();
|
||||||
@ -432,6 +439,16 @@ public abstract class PlotArea implements ComponentLike {
|
|||||||
TranslatableCaption.of("flags.road_flags"),
|
TranslatableCaption.of("flags.road_flags"),
|
||||||
TagResolver.resolver("flags", Tag.inserting(Component.text(roadflags.toString())))
|
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);
|
loadConfiguration(config);
|
||||||
}
|
}
|
||||||
|
@ -631,6 +631,8 @@
|
|||||||
"flags.flag_error_double": "Flag value must be a decimal number.",
|
"flags.flag_error_double": "Flag value must be a decimal number.",
|
||||||
"flags.flag_error_music": "Flag value must be a valid music disc ID.",
|
"flags.flag_error_music": "Flag value must be a valid music disc ID.",
|
||||||
"flags.flag_error_title": "Flag value must be in the format </red><grey>\"A title\" \"The subtitle\"</grey><red>.",
|
"flags.flag_error_title": "Flag value must be in the format </red><grey>\"A title\" \"The subtitle\"</grey><red>.",
|
||||||
|
"flags.delaying_loading_area_flags": "<prefix><gray>Delaying loading flags for area `</gray><dark_aqua><area></dark_aqua><gray>` as WorldEdit is not initialised yet.</gray>",
|
||||||
|
"flags.loading_area_flags": "<prefix><gray>Loading flags for area: </gray><dark_aqua><area></dark_aqua>",
|
||||||
"flags.area_flags": "<prefix><gray>Area flags: </gray><dark_aqua><flags></dark_aqua>",
|
"flags.area_flags": "<prefix><gray>Area flags: </gray><dark_aqua><flags></dark_aqua>",
|
||||||
"flags.road_flags": "<prefix><gray>Road flags: </gray><dark_aqua><flags></dark_aqua>",
|
"flags.road_flags": "<prefix><gray>Road flags: </gray><dark_aqua><flags></dark_aqua>",
|
||||||
"commands.description.add": "<gray>Allow a user to build in a plot while the plot owner is online.</gray>",
|
"commands.description.add": "<gray>Allow a user to build in a plot while the plot owner is online.</gray>",
|
||||||
|
Loading…
Reference in New Issue
Block a user