mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-21 20:56:45 +01:00
Fix flag exception coloring
This commit is contained in:
parent
491a171409
commit
78655102b9
@ -139,7 +139,7 @@ public final class FlagCommand extends Command {
|
||||
TranslatableCaption.of("flag.flag_parse_error"),
|
||||
Template.of("flag_name", flag.getName()),
|
||||
Template.of("flag_value", e.getValue()),
|
||||
Templates.of(player, "error", e.getErrorMessage(), e.getTemplates())
|
||||
Template.of("error", e.getErrorMessage().getComponent(player))
|
||||
);
|
||||
return false;
|
||||
} catch (final Exception e) {
|
||||
@ -348,7 +348,7 @@ public final class FlagCommand extends Command {
|
||||
TranslatableCaption.of("flag.flag_parse_error"),
|
||||
Template.of("flag_name", plotFlag.getName()),
|
||||
Template.of("flag_value", e.getValue()),
|
||||
Templates.of(player, "error", e.getErrorMessage(), e.getTemplates())
|
||||
Template.of("error", e.getErrorMessage().getComponent(player))
|
||||
);
|
||||
return;
|
||||
}
|
||||
@ -410,7 +410,7 @@ public final class FlagCommand extends Command {
|
||||
TranslatableCaption.of("flag.flag_parse_error"),
|
||||
Template.of("flag_name", plotFlag.getName()),
|
||||
Template.of("flag_value", e.getValue()),
|
||||
Templates.of(player, "error", e.getErrorMessage(), e.getTemplates())
|
||||
Template.of("error", e.getErrorMessage().getComponent(player))
|
||||
);
|
||||
return;
|
||||
}
|
||||
@ -482,7 +482,7 @@ public final class FlagCommand extends Command {
|
||||
TranslatableCaption.of("flag.flag_parse_error"),
|
||||
Template.of("flag_name", flag.getName()),
|
||||
Template.of("flag_value", e.getValue()),
|
||||
Templates.of(player, "error", e.getErrorMessage(), e.getTemplates())
|
||||
Template.of("error", String.valueOf(e.getErrorMessage()))
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ public class ComponentPresetManager {
|
||||
"##wool",
|
||||
0,
|
||||
"",
|
||||
"<gold>D</gold><green>i</green><red>s</red><yellow>c</yellow><aqua>o</aqua><dark_green> F</dark_green><dark_aqua>l</dark_aqua><light_purple>o</light_purple><blue>o</blue><dark_red>r</dark_red>",
|
||||
"<rainbow:2>Disco Floor</rainbow>",
|
||||
Arrays.asList("<gold>Spice up your plot floor</gold>"),
|
||||
ItemTypes.YELLOW_WOOL
|
||||
));
|
||||
|
@ -68,8 +68,7 @@ public abstract class LongFlag<F extends NumberFlag<Long, F>> extends NumberFlag
|
||||
throw new FlagParseException(
|
||||
this,
|
||||
input,
|
||||
TranslatableCaption.of("invalid.not_a_number"),
|
||||
Template.of("value", input)
|
||||
TranslatableCaption.of("flags.flag_error_long")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,6 @@
|
||||
package com.plotsquared.core.plot.flag.types;
|
||||
|
||||
import com.plotsquared.core.configuration.caption.Caption;
|
||||
import com.plotsquared.core.configuration.caption.Templates;
|
||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||
import com.plotsquared.core.plot.flag.FlagParseException;
|
||||
import com.plotsquared.core.plot.flag.PlotFlag;
|
||||
@ -55,10 +54,7 @@ public abstract class NumberFlag<N extends Number & Comparable<N>, F extends Plo
|
||||
public F parse(@NonNull String input) throws FlagParseException {
|
||||
final N parsed = parseNumber(input);
|
||||
if (parsed.compareTo(minimum) < 0 || parsed.compareTo(maximum) > 0) {
|
||||
throw new FlagParseException(this, input, TranslatableCaption.of("invalid.number_not_in_range"),
|
||||
Templates.of("min", minimum),
|
||||
Templates.of("max", maximum)
|
||||
);
|
||||
throw new FlagParseException(this, input, TranslatableCaption.of("flags.flag_error_integer"));
|
||||
}
|
||||
return flagOf(parsed);
|
||||
|
||||
|
@ -29,7 +29,6 @@ import com.plotsquared.core.configuration.caption.Caption;
|
||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||
import com.plotsquared.core.plot.flag.FlagParseException;
|
||||
import com.plotsquared.core.plot.flag.PlotFlag;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public abstract class TimedFlag<T, F extends PlotFlag<TimedFlag.Timed<T>, F>>
|
||||
@ -52,16 +51,14 @@ public abstract class TimedFlag<T, F extends PlotFlag<TimedFlag.Timed<T>, F>>
|
||||
throw new FlagParseException(
|
||||
this,
|
||||
input,
|
||||
TranslatableCaption.of("invalid.not_a_number"),
|
||||
Template.of("value", split[0])
|
||||
TranslatableCaption.of("flags.flag_error_integer")
|
||||
);
|
||||
}
|
||||
if (interval < 1) {
|
||||
throw new FlagParseException(
|
||||
this,
|
||||
input,
|
||||
TranslatableCaption.of("invalid.number_not_positive"),
|
||||
Template.of("value", split[0])
|
||||
TranslatableCaption.of("flags.flag_error_integer")
|
||||
);
|
||||
}
|
||||
if (split.length == 1) {
|
||||
|
@ -203,8 +203,8 @@
|
||||
"invalid.not_valid_plot_id": "<prefix><red>That's not a valid plot ID.</red>",
|
||||
"invalid.found_no_plots": "<prefix><red>Found no plots with your search query.</red>",
|
||||
"invalid.number_not_in_range": "<prefix><red>That's not a valid number within the range: <gray>(<min>, <max>)</gray></red>",
|
||||
"invalid.number_not_positive": "<prefix><red>That's not a positive number: <gray><value></gray></red>",
|
||||
"invalid.not_a_number": "<prefix><red><gray><value></gray> is not a valid number.</red>",
|
||||
"invalid.number_not_positive": "<red>That's not a positive number: <gray><value></gray></red>",
|
||||
"invalid.not_a_number": "<red><gray><value></gray> is not a valid number.</red>",
|
||||
"condense.invalid_area": "<prefix><red>Invalid area.</red>",
|
||||
"condense.task_already_started": "<prefix><red>Task already started.</red>",
|
||||
"condense.invalid_radius": "<prefix><red>Invalid radius.</red>",
|
||||
@ -572,20 +572,14 @@
|
||||
"flags.flag_description_keep_inventory": "<gray>Prevents players from dropping their items when they die inside of the plot.</gray>",
|
||||
"flags.flag_description_prevent_creative_copy": "<gray>Prevents people from copying item NBT data in the plot unless they're added as members.</gray>",
|
||||
"flags.flag_description_leaf_decay": "<gray>Set to `false` to prevent leaves from decaying.",
|
||||
"flags.flag_error_boolean": "<prefix>Flag value must be a boolean (true | false).",
|
||||
"flags.flag_error_enum": "<prefix>Must be one of: <list>",
|
||||
"flags.flag_error_gamemode": "<prefix>Flag value must be a gamemode: 'survival', 'creative', 'adventure' or 'spectator.",
|
||||
"flags.flag_error_integer": "<prefix>Flag value must be a whole number.",
|
||||
"flags.flag_error_integer_list": "<prefix>Flag value must be an integer list.",
|
||||
"flags.flag_error_keep": "<prefix>Flag value must be a timestamp or a boolean.",
|
||||
"flags.flag_error_long": "<prefix>Flag value must be a whole number (large numbers allowed).",
|
||||
"flags.flag_error_plotblocklist": "<prefix>Flag value must be a block list.",
|
||||
"flags.flag_error_invalid_block": "<prefix>The provided value is not a valid block or block category.",
|
||||
"flags.flag_error_double": "<prefix>Flag value must be a decimal number.",
|
||||
"flags.flag_error_string": "<prefix>Flag value must be alphanumeric. Some special characters are allowed.",
|
||||
"flags.flag_error_stringlist": "<prefix>Flag value must be a string list.",
|
||||
"flags.flag_error_weather": "<prefix>Flag must be a weather: 'rain' or 'sun'.",
|
||||
"flags.flag_error_music": "<prefix>Flag value must be a valid music disc ID.",
|
||||
"flags.flag_error_boolean": "Flag value must be a boolean (true | false).",
|
||||
"flags.flag_error_enum": "Must be one of: <list>",
|
||||
"flags.flag_error_integer": "Flag value must be a whole positive number.",
|
||||
"flags.flag_error_keep": "Flag value must be a timestamp or a boolean.",
|
||||
"flags.flag_error_long": "Flag value must be a whole positive number (large numbers allowed).",
|
||||
"flags.flag_error_invalid_block": "The provided value is not a valid block or block category.",
|
||||
"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.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>",
|
||||
"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