PlotSquared/Core/src/main/java/com/plotsquared/core/command/DebugExec.java

235 lines
10 KiB
Java
Raw Normal View History

/*
* PlotSquared, a land and world management plugin for Minecraft.
* Copyright (C) IntellectualSites <https://intellectualsites.com>
* Copyright (C) IntellectualSites team and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
2020-04-15 21:26:54 +02:00
package com.plotsquared.core.command;
2015-01-24 01:00:57 +01:00
2020-07-14 18:49:40 +02:00
import com.google.inject.Inject;
import com.plotsquared.core.PlotSquared;
2020-07-21 21:39:52 +02:00
import com.plotsquared.core.configuration.caption.StaticCaption;
2020-07-18 15:06:51 +02:00
import com.plotsquared.core.configuration.caption.TranslatableCaption;
2020-04-15 21:26:54 +02:00
import com.plotsquared.core.events.PlotFlagRemoveEvent;
import com.plotsquared.core.events.Result;
import com.plotsquared.core.generator.HybridUtils;
2020-04-30 12:33:59 +02:00
import com.plotsquared.core.player.PlotPlayer;
2020-04-15 21:26:54 +02:00
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea;
2020-04-30 12:33:59 +02:00
import com.plotsquared.core.plot.expiration.PlotAnalysis;
import com.plotsquared.core.plot.flag.GlobalFlagContainer;
import com.plotsquared.core.plot.flag.PlotFlag;
2020-07-10 17:32:07 +02:00
import com.plotsquared.core.plot.world.PlotAreaManager;
import com.plotsquared.core.util.EventDispatcher;
2020-04-15 21:26:54 +02:00
import com.plotsquared.core.util.StringMan;
2020-07-24 17:36:48 +02:00
import com.plotsquared.core.util.query.PlotQuery;
2020-04-30 12:33:59 +02:00
import com.plotsquared.core.util.task.RunnableVal;
2020-07-21 21:39:52 +02:00
import net.kyori.adventure.text.minimessage.Template;
import org.checkerframework.checker.nullness.qual.NonNull;
2018-08-10 17:01:10 +02:00
2020-04-30 12:33:59 +02:00
import java.util.Arrays;
2021-03-12 15:05:25 +01:00
import java.util.Collection;
Implement extended world heights from Y-64 to Y319 #3473 (#3473) * Begin to implement extended world heights: - Implemented in Bukkit module (and where required in Core module) * Implement extended world heights into core module * Add min gen height to setup, * Default gen/build heights based on minecraft version * Few fixes * Fix up queues * Address comments * Make road schematic stuff slightly more efficient by sharing queues * Minor fixes, don't overlay error many times for the same y * Fix incorrect schematic paste height, undo changes to HybridUtils * Overhall regenallroads method to make it work, make sure BukkitChunkCoordinator can/will finish * Process chunks in order when regenerating all roads * Address comments * Address comments * Ground level//bedrock is at min gen height - Add comment on == rather than <= being used - It's because it's only checking for the bedrock layer being broken if that's disabled * Fix offset for min build height in SchematicHandler * Better javadoc Co-authored-by: Hannes Greule <SirYwell@users.noreply.github.com> * Address inclusivity issues for max world height * Javadocs/comments/deprecation * Use world min/max heights if present in QueueCoordinator * Address some deprecations for regions and biome setting * Add a count for chunks we're currently trying to load to not skip chunks at the end of a queue's edit * Use minGenHeight + 1 rather than build height in AugmentedUtils * Create utility method for layer index in GenChunk * Correct height in HybridUtils, also use minGenHeight + 1 * Don't magically split to 128 height in regeneration * Add utility methods for world height in QueueCoordinator * Clean up ClassicPlotManager road creation/removal * Start generation at min gen height if bedrock is disabled * min gen height is set in PlotArea * Add note on schem y normalisation * Improve plot getVolume method readability * Don't overly extend height when regenerating road region * y index utility method in ChunknQueueCoordinator * Layer index utility method in LocalChunk * Use version min/max heights if world not present in QueueCoordinator * Fix min -> max * Don't allow players to modify outside build height when using plot set / schematics. - Also fixes schematic height issues * Remove debug * Address comments * Switch loadingChunks to AtomicInteger to be safe (in case of multi-threaded) * Fix "security" issue that was already present * Ensure sign isn't physicsed Co-authored-by: Hannes Greule <SirYwell@users.noreply.github.com>
2022-03-05 19:03:39 +01:00
import java.util.LinkedHashSet;
2020-04-30 12:33:59 +02:00
import java.util.List;
2021-03-12 15:05:25 +01:00
import java.util.Locale;
import java.util.stream.Collectors;
import java.util.stream.Stream;
Pull/2693 (#2694) * Commit WIP flag work. * More ported flag types, and additions to the flag API. * Make PlotFlag more generic to allow generic flag creation * Pull Captions methods into a Caption interface. * Port MusicFlag * Port flight flag * Port UntrustedVisitFlag * Port DenyExitFlag * Remove paper suggestion * Make ListFlag lists immutable * Update Flag containers. Add javadocs. Add missing methods. * Port description flag * Port greeting and farewell flags * Port weather flag * Move getExample implementation to BooleanFlag * Port reserved flags * Port all boolean flags. * Remove unused flag types * Invert liquid-flow flag * Find the real (legacy) flag name * Change NOITFY -> NOTIFY in Captions * Make IntegerFlag extendable * Port integer flags * Update Flag command to current API state * Begin remaking flag command * Create DoubleFlag + extract common parsing stuff * Supply arguments in flag parse exceptions * Implement missing flag subcommands * Update Flag command to current API state * Implement PriceFlag * Port deny-teleport * Port gamemode flags * Port BreakFlag * Port PlaceFlag * Port UseFlag * Remove old unused flag constants * Port blocked-cmds flag * Fix entity util * Port TimeFlag * Use CaptionUtility for formatting * Port keep flag * Fix imports * Reformat code * Remove unused classes * Fix MainUtil.java * Remove FlagCmd * Add flag info header and footer * Comment out flag related stuff in SchematicHandler * Remove FlagManager * Finalize Plot.java * Finalize PlotArea.java * Finalize PlotListener * Fix API issues * Fix a bunch of compile errors * Fix `/plot flag remove` * Fix initialization of GlobalFlagContainer * Apply API changes to events * Update SQLManager to new API * Invert default value for DenyExitFlag * Replace flag.getValue().toString() with flag.toString() * Make FlagContainer instance in Plot final * Fix various command issues * Clean up PlotSettings * Don't show internal flags in flag list * Fix `/plot flag add` * Remove the info inventory as it's 100% broken * Add plot info entries and fix up the default format * Fix default flag state in Captions * 781c200 part 2 * Fix odd grammar in captions * Fix odd grammar in captions v2 * Add create table statements for plot_flags * Remove old flag references in SQLManager * Use the new plot_flags table * Add tab completion to `/plot flag` * Improve parse error handling * Make flag permission check recognize parse exceptions * Initial progress towards flag conversion * Fix minor issues * Don't validate flags during flag conversion * Allow unrecognized flags to be parsed * Filter out internal flags from command sugguestions * Use the wrong caption when there's no plot description set * Limit command suggestions for boolean flags * Make blocktypelistflags accept blockcategories * Require categories to be prefixed with '#' and fix some minor display issues * Fix plot database conversion * Update PlotFlagEvent.java Updated return description * Fix command annotation wrapping * Add FLAG_UPDATE event for FlagContainer listeners * Make getParentContainer nullable * Document castUnsafe in FlagContainer * Document FlagContainer constructors * Add missing documentation to FlagContainer * Document FlagParseException * Fix wording in FlagContainer javadoc * Document InternalFlag * Document PlotFlag * Minor changes * Remove revisit comments Co-authored-by: Hannes Greule <SirYwell@users.noreply.github.com> Co-authored-by: NotMyFault <mc.cache@web.de> Co-authored-by: Matt <4009945+MattBDev@users.noreply.github.com>
2020-02-24 18:42:02 +01:00
@CommandDeclaration(command = "debugexec",
permission = "plots.admin",
aliases = {"exec", "$"},
category = CommandCategory.DEBUG)
Pull/2693 (#2694) * Commit WIP flag work. * More ported flag types, and additions to the flag API. * Make PlotFlag more generic to allow generic flag creation * Pull Captions methods into a Caption interface. * Port MusicFlag * Port flight flag * Port UntrustedVisitFlag * Port DenyExitFlag * Remove paper suggestion * Make ListFlag lists immutable * Update Flag containers. Add javadocs. Add missing methods. * Port description flag * Port greeting and farewell flags * Port weather flag * Move getExample implementation to BooleanFlag * Port reserved flags * Port all boolean flags. * Remove unused flag types * Invert liquid-flow flag * Find the real (legacy) flag name * Change NOITFY -> NOTIFY in Captions * Make IntegerFlag extendable * Port integer flags * Update Flag command to current API state * Begin remaking flag command * Create DoubleFlag + extract common parsing stuff * Supply arguments in flag parse exceptions * Implement missing flag subcommands * Update Flag command to current API state * Implement PriceFlag * Port deny-teleport * Port gamemode flags * Port BreakFlag * Port PlaceFlag * Port UseFlag * Remove old unused flag constants * Port blocked-cmds flag * Fix entity util * Port TimeFlag * Use CaptionUtility for formatting * Port keep flag * Fix imports * Reformat code * Remove unused classes * Fix MainUtil.java * Remove FlagCmd * Add flag info header and footer * Comment out flag related stuff in SchematicHandler * Remove FlagManager * Finalize Plot.java * Finalize PlotArea.java * Finalize PlotListener * Fix API issues * Fix a bunch of compile errors * Fix `/plot flag remove` * Fix initialization of GlobalFlagContainer * Apply API changes to events * Update SQLManager to new API * Invert default value for DenyExitFlag * Replace flag.getValue().toString() with flag.toString() * Make FlagContainer instance in Plot final * Fix various command issues * Clean up PlotSettings * Don't show internal flags in flag list * Fix `/plot flag add` * Remove the info inventory as it's 100% broken * Add plot info entries and fix up the default format * Fix default flag state in Captions * 781c200 part 2 * Fix odd grammar in captions * Fix odd grammar in captions v2 * Add create table statements for plot_flags * Remove old flag references in SQLManager * Use the new plot_flags table * Add tab completion to `/plot flag` * Improve parse error handling * Make flag permission check recognize parse exceptions * Initial progress towards flag conversion * Fix minor issues * Don't validate flags during flag conversion * Allow unrecognized flags to be parsed * Filter out internal flags from command sugguestions * Use the wrong caption when there's no plot description set * Limit command suggestions for boolean flags * Make blocktypelistflags accept blockcategories * Require categories to be prefixed with '#' and fix some minor display issues * Fix plot database conversion * Update PlotFlagEvent.java Updated return description * Fix command annotation wrapping * Add FLAG_UPDATE event for FlagContainer listeners * Make getParentContainer nullable * Document castUnsafe in FlagContainer * Document FlagContainer constructors * Add missing documentation to FlagContainer * Document FlagParseException * Fix wording in FlagContainer javadoc * Document InternalFlag * Document PlotFlag * Minor changes * Remove revisit comments Co-authored-by: Hannes Greule <SirYwell@users.noreply.github.com> Co-authored-by: NotMyFault <mc.cache@web.de> Co-authored-by: Matt <4009945+MattBDev@users.noreply.github.com>
2020-02-24 18:42:02 +01:00
public class DebugExec extends SubCommand {
2020-07-10 17:32:07 +02:00
private final PlotAreaManager plotAreaManager;
private final EventDispatcher eventDispatcher;
2020-07-14 18:49:40 +02:00
private final HybridUtils hybridUtils;
2016-03-22 18:53:17 +01:00
@Inject
public DebugExec(
final @NonNull PlotAreaManager plotAreaManager,
final @NonNull EventDispatcher eventDispatcher,
final @NonNull HybridUtils hybridUtils
) {
2020-07-10 17:32:07 +02:00
this.plotAreaManager = plotAreaManager;
this.eventDispatcher = eventDispatcher;
2020-07-14 18:49:40 +02:00
this.hybridUtils = hybridUtils;
}
2016-03-22 18:53:17 +01:00
@Override
public boolean onCommand(final PlotPlayer<?> player, String[] args) {
List<String> allowedParams = Arrays
2021-08-18 11:58:18 +02:00
.asList(
"analyze",
"calibrate-analysis",
"start-expire",
"stop-expire",
"remove-flag",
"start-rgar",
"stop-rgar"
);
2015-09-13 06:04:31 +02:00
if (args.length > 0) {
2016-03-23 02:41:37 +01:00
String arg = args[0].toLowerCase();
2015-09-13 06:04:31 +02:00
switch (arg) {
case "analyze" -> {
2016-03-23 02:41:37 +01:00
Plot plot = player.getCurrentPlot();
2015-09-13 06:04:31 +02:00
if (plot == null) {
2020-07-18 15:06:51 +02:00
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
return false;
}
PlotAnalysis analysis = plot.getComplexity(null);
2015-09-13 06:04:31 +02:00
if (analysis != null) {
2020-07-21 21:39:52 +02:00
player.sendMessage(
TranslatableCaption.of("debugexec.changes_column"),
Template.of("value", String.valueOf(analysis.changes))
2020-07-21 21:39:52 +02:00
);
return true;
}
2020-07-21 21:39:52 +02:00
player.sendMessage(TranslatableCaption.of("debugexec.starting_task"));
2021-05-01 18:33:02 +02:00
this.hybridUtils.analyzePlot(plot, new RunnableVal<>() {
@Override
public void run(PlotAnalysis value) {
2020-08-17 18:15:29 +02:00
player.sendMessage(
TranslatableCaption.of("debugexec.analyze_done"),
Template.of("command", "/plot debugexec analyze")
2020-08-17 18:15:29 +02:00
);
}
});
2015-06-26 11:46:06 +02:00
return true;
}
case "calibrate-analysis" -> {
2015-09-13 06:04:31 +02:00
if (args.length != 2) {
2020-07-21 21:39:52 +02:00
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("value", "/plot debugexec analyze <threshold>")
2020-07-21 21:39:52 +02:00
);
player.sendMessage(TranslatableCaption.of("debugexec.threshold_default"));
return false;
}
double threshold;
2015-09-13 06:04:31 +02:00
try {
threshold = Integer.parseInt(args[1]) / 100d;
2016-05-12 23:09:35 +02:00
} catch (NumberFormatException ignored) {
2020-07-21 21:39:52 +02:00
player.sendMessage(
TranslatableCaption.of("debugexec.invalid_threshold"),
Template.of("value", args[1])
2020-07-21 21:39:52 +02:00
);
player.sendMessage(TranslatableCaption.of("debugexec.threshold_default_double"));
return false;
}
PlotAnalysis.calcOptimalModifiers(
() -> player.sendMessage(TranslatableCaption.of("debugexec.calibration_done")),
threshold
);
return true;
}
case "start-expire" -> {
if (PlotSquared.platform().expireManager().runAutomatedTask()) {
player.sendMessage(TranslatableCaption.of("debugexec.expiry_started"));
} else {
player.sendMessage(TranslatableCaption.of("debugexec.expiry_already_started"));
}
return true;
}
case "stop-expire" -> {
if (!PlotSquared.platform().expireManager().cancelTask()) {
2020-07-21 21:39:52 +02:00
player.sendMessage(TranslatableCaption.of("debugexec.task_halted"));
2021-03-12 15:05:25 +01:00
} else {
player.sendMessage(TranslatableCaption.of("debugexec.task_cancelled"));
2015-02-20 07:34:19 +01:00
}
2021-03-12 15:05:25 +01:00
return true;
}
case "remove-flag" -> {
2015-09-13 06:04:31 +02:00
if (args.length != 2) {
2020-07-22 00:08:51 +02:00
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("value", "/plot debugexec remove-flag <flag>")
2020-07-22 00:08:51 +02:00
);
return false;
}
2016-03-23 02:41:37 +01:00
String flag = args[1];
Pull/2693 (#2694) * Commit WIP flag work. * More ported flag types, and additions to the flag API. * Make PlotFlag more generic to allow generic flag creation * Pull Captions methods into a Caption interface. * Port MusicFlag * Port flight flag * Port UntrustedVisitFlag * Port DenyExitFlag * Remove paper suggestion * Make ListFlag lists immutable * Update Flag containers. Add javadocs. Add missing methods. * Port description flag * Port greeting and farewell flags * Port weather flag * Move getExample implementation to BooleanFlag * Port reserved flags * Port all boolean flags. * Remove unused flag types * Invert liquid-flow flag * Find the real (legacy) flag name * Change NOITFY -> NOTIFY in Captions * Make IntegerFlag extendable * Port integer flags * Update Flag command to current API state * Begin remaking flag command * Create DoubleFlag + extract common parsing stuff * Supply arguments in flag parse exceptions * Implement missing flag subcommands * Update Flag command to current API state * Implement PriceFlag * Port deny-teleport * Port gamemode flags * Port BreakFlag * Port PlaceFlag * Port UseFlag * Remove old unused flag constants * Port blocked-cmds flag * Fix entity util * Port TimeFlag * Use CaptionUtility for formatting * Port keep flag * Fix imports * Reformat code * Remove unused classes * Fix MainUtil.java * Remove FlagCmd * Add flag info header and footer * Comment out flag related stuff in SchematicHandler * Remove FlagManager * Finalize Plot.java * Finalize PlotArea.java * Finalize PlotListener * Fix API issues * Fix a bunch of compile errors * Fix `/plot flag remove` * Fix initialization of GlobalFlagContainer * Apply API changes to events * Update SQLManager to new API * Invert default value for DenyExitFlag * Replace flag.getValue().toString() with flag.toString() * Make FlagContainer instance in Plot final * Fix various command issues * Clean up PlotSettings * Don't show internal flags in flag list * Fix `/plot flag add` * Remove the info inventory as it's 100% broken * Add plot info entries and fix up the default format * Fix default flag state in Captions * 781c200 part 2 * Fix odd grammar in captions * Fix odd grammar in captions v2 * Add create table statements for plot_flags * Remove old flag references in SQLManager * Use the new plot_flags table * Add tab completion to `/plot flag` * Improve parse error handling * Make flag permission check recognize parse exceptions * Initial progress towards flag conversion * Fix minor issues * Don't validate flags during flag conversion * Allow unrecognized flags to be parsed * Filter out internal flags from command sugguestions * Use the wrong caption when there's no plot description set * Limit command suggestions for boolean flags * Make blocktypelistflags accept blockcategories * Require categories to be prefixed with '#' and fix some minor display issues * Fix plot database conversion * Update PlotFlagEvent.java Updated return description * Fix command annotation wrapping * Add FLAG_UPDATE event for FlagContainer listeners * Make getParentContainer nullable * Document castUnsafe in FlagContainer * Document FlagContainer constructors * Add missing documentation to FlagContainer * Document FlagParseException * Fix wording in FlagContainer javadoc * Document InternalFlag * Document PlotFlag * Minor changes * Remove revisit comments Co-authored-by: Hannes Greule <SirYwell@users.noreply.github.com> Co-authored-by: NotMyFault <mc.cache@web.de> Co-authored-by: Matt <4009945+MattBDev@users.noreply.github.com>
2020-02-24 18:42:02 +01:00
final PlotFlag<?, ?> flagInstance =
GlobalFlagContainer.getInstance().getFlagFromString(flag);
Pull/2693 (#2694) * Commit WIP flag work. * More ported flag types, and additions to the flag API. * Make PlotFlag more generic to allow generic flag creation * Pull Captions methods into a Caption interface. * Port MusicFlag * Port flight flag * Port UntrustedVisitFlag * Port DenyExitFlag * Remove paper suggestion * Make ListFlag lists immutable * Update Flag containers. Add javadocs. Add missing methods. * Port description flag * Port greeting and farewell flags * Port weather flag * Move getExample implementation to BooleanFlag * Port reserved flags * Port all boolean flags. * Remove unused flag types * Invert liquid-flow flag * Find the real (legacy) flag name * Change NOITFY -> NOTIFY in Captions * Make IntegerFlag extendable * Port integer flags * Update Flag command to current API state * Begin remaking flag command * Create DoubleFlag + extract common parsing stuff * Supply arguments in flag parse exceptions * Implement missing flag subcommands * Update Flag command to current API state * Implement PriceFlag * Port deny-teleport * Port gamemode flags * Port BreakFlag * Port PlaceFlag * Port UseFlag * Remove old unused flag constants * Port blocked-cmds flag * Fix entity util * Port TimeFlag * Use CaptionUtility for formatting * Port keep flag * Fix imports * Reformat code * Remove unused classes * Fix MainUtil.java * Remove FlagCmd * Add flag info header and footer * Comment out flag related stuff in SchematicHandler * Remove FlagManager * Finalize Plot.java * Finalize PlotArea.java * Finalize PlotListener * Fix API issues * Fix a bunch of compile errors * Fix `/plot flag remove` * Fix initialization of GlobalFlagContainer * Apply API changes to events * Update SQLManager to new API * Invert default value for DenyExitFlag * Replace flag.getValue().toString() with flag.toString() * Make FlagContainer instance in Plot final * Fix various command issues * Clean up PlotSettings * Don't show internal flags in flag list * Fix `/plot flag add` * Remove the info inventory as it's 100% broken * Add plot info entries and fix up the default format * Fix default flag state in Captions * 781c200 part 2 * Fix odd grammar in captions * Fix odd grammar in captions v2 * Add create table statements for plot_flags * Remove old flag references in SQLManager * Use the new plot_flags table * Add tab completion to `/plot flag` * Improve parse error handling * Make flag permission check recognize parse exceptions * Initial progress towards flag conversion * Fix minor issues * Don't validate flags during flag conversion * Allow unrecognized flags to be parsed * Filter out internal flags from command sugguestions * Use the wrong caption when there's no plot description set * Limit command suggestions for boolean flags * Make blocktypelistflags accept blockcategories * Require categories to be prefixed with '#' and fix some minor display issues * Fix plot database conversion * Update PlotFlagEvent.java Updated return description * Fix command annotation wrapping * Add FLAG_UPDATE event for FlagContainer listeners * Make getParentContainer nullable * Document castUnsafe in FlagContainer * Document FlagContainer constructors * Add missing documentation to FlagContainer * Document FlagParseException * Fix wording in FlagContainer javadoc * Document InternalFlag * Document PlotFlag * Minor changes * Remove revisit comments Co-authored-by: Hannes Greule <SirYwell@users.noreply.github.com> Co-authored-by: NotMyFault <mc.cache@web.de> Co-authored-by: Matt <4009945+MattBDev@users.noreply.github.com>
2020-02-24 18:42:02 +01:00
if (flagInstance != null) {
2020-07-24 17:36:48 +02:00
for (Plot plot : PlotQuery.newQuery().whereBasePlot()) {
PlotFlagRemoveEvent event = this.eventDispatcher
.callFlagRemove(flagInstance, plot);
if (event.getEventResult() != Result.DENY) {
plot.removeFlag(event.getFlag());
}
2015-06-24 22:33:43 +02:00
}
}
2020-07-22 00:08:51 +02:00
player.sendMessage(
TranslatableCaption.of("debugexec.cleared_flag"),
Template.of("value", flag)
2020-07-22 00:08:51 +02:00
);
return true;
}
case "start-rgar" -> {
2015-09-13 06:04:31 +02:00
if (args.length != 2) {
2020-07-22 00:08:51 +02:00
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("value", "Invalid syntax: /plot debugexec start-rgar <world>")
2020-07-22 00:08:51 +02:00
);
return false;
}
2020-07-10 17:32:07 +02:00
PlotArea area = this.plotAreaManager.getPlotAreaByString(args[1]);
2016-02-10 19:59:51 +01:00
if (area == null) {
2020-07-22 00:08:51 +02:00
player.sendMessage(
TranslatableCaption.of("errors.not_valid_plot_world"),
Template.of("value", args[1])
2020-07-22 00:08:51 +02:00
);
return false;
}
boolean result;
2015-09-13 06:04:31 +02:00
if (HybridUtils.regions != null) {
Implement extended world heights from Y-64 to Y319 #3473 (#3473) * Begin to implement extended world heights: - Implemented in Bukkit module (and where required in Core module) * Implement extended world heights into core module * Add min gen height to setup, * Default gen/build heights based on minecraft version * Few fixes * Fix up queues * Address comments * Make road schematic stuff slightly more efficient by sharing queues * Minor fixes, don't overlay error many times for the same y * Fix incorrect schematic paste height, undo changes to HybridUtils * Overhall regenallroads method to make it work, make sure BukkitChunkCoordinator can/will finish * Process chunks in order when regenerating all roads * Address comments * Address comments * Ground level//bedrock is at min gen height - Add comment on == rather than <= being used - It's because it's only checking for the bedrock layer being broken if that's disabled * Fix offset for min build height in SchematicHandler * Better javadoc Co-authored-by: Hannes Greule <SirYwell@users.noreply.github.com> * Address inclusivity issues for max world height * Javadocs/comments/deprecation * Use world min/max heights if present in QueueCoordinator * Address some deprecations for regions and biome setting * Add a count for chunks we're currently trying to load to not skip chunks at the end of a queue's edit * Use minGenHeight + 1 rather than build height in AugmentedUtils * Create utility method for layer index in GenChunk * Correct height in HybridUtils, also use minGenHeight + 1 * Don't magically split to 128 height in regeneration * Add utility methods for world height in QueueCoordinator * Clean up ClassicPlotManager road creation/removal * Start generation at min gen height if bedrock is disabled * min gen height is set in PlotArea * Add note on schem y normalisation * Improve plot getVolume method readability * Don't overly extend height when regenerating road region * y index utility method in ChunknQueueCoordinator * Layer index utility method in LocalChunk * Use version min/max heights if world not present in QueueCoordinator * Fix min -> max * Don't allow players to modify outside build height when using plot set / schematics. - Also fixes schematic height issues * Remove debug * Address comments * Switch loadingChunks to AtomicInteger to be safe (in case of multi-threaded) * Fix "security" issue that was already present * Ensure sign isn't physicsed Co-authored-by: Hannes Greule <SirYwell@users.noreply.github.com>
2022-03-05 19:03:39 +01:00
result = this.hybridUtils.scheduleRoadUpdate(area, HybridUtils.regions, 0, new LinkedHashSet<>());
2015-09-13 06:04:31 +02:00
} else {
2020-07-14 18:49:40 +02:00
result = this.hybridUtils.scheduleRoadUpdate(area, 0);
}
2015-09-13 06:04:31 +02:00
if (!result) {
2020-07-22 00:08:51 +02:00
player.sendMessage(TranslatableCaption.of("debugexec.mass_schematic_update_in_progress"));
return false;
}
return true;
}
case "stop-rgar" -> {
2015-09-13 06:04:31 +02:00
if (!HybridUtils.UPDATE) {
2020-07-22 00:08:51 +02:00
player.sendMessage(TranslatableCaption.of("debugexec.task_not_running"));
return false;
}
2015-08-02 13:56:18 +02:00
HybridUtils.UPDATE = false;
2021-02-02 16:48:01 +01:00
player.sendMessage(TranslatableCaption.of("debugexec.task_cancelled"));
return true;
}
2015-02-20 07:34:19 +01:00
}
2015-01-24 01:00:57 +01:00
}
2021-03-12 15:05:25 +01:00
player.sendMessage(StaticCaption.of("<prefix><gold>Possible sub commands: </gold><gray>/plot debugexec <"
+ StringMan.join(allowedParams, " | ") + "></gray>"));
return false;
2015-01-24 01:00:57 +01:00
}
2021-03-12 15:05:25 +01:00
@Override
public Collection<Command> tab(final PlotPlayer<?> player, String[] args, boolean space) {
return Stream.of("analyze", "calibrate-analysis", "start-expire", "stop-expire", "remove-flag", "start-rgar", "stop-rgar")
.filter(value -> value.startsWith(args[0].toLowerCase(Locale.ENGLISH)))
.map(value -> new Command(null, false, value, "plots.admin", RequiredType.NONE, null) {
}).collect(Collectors.toList());
}
2015-01-24 01:00:57 +01:00
}