mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-11-04 03:03:43 +01:00 
			
		
		
		
	More json progress
This commit is contained in:
		@@ -30,6 +30,7 @@ import com.plotsquared.core.configuration.Captions;
 | 
				
			|||||||
import com.plotsquared.core.configuration.Settings;
 | 
					import com.plotsquared.core.configuration.Settings;
 | 
				
			||||||
import com.plotsquared.core.configuration.caption.CaptionUtility;
 | 
					import com.plotsquared.core.configuration.caption.CaptionUtility;
 | 
				
			||||||
import com.plotsquared.core.configuration.caption.StaticCaption;
 | 
					import com.plotsquared.core.configuration.caption.StaticCaption;
 | 
				
			||||||
 | 
					import com.plotsquared.core.configuration.caption.Templates;
 | 
				
			||||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
 | 
					import com.plotsquared.core.configuration.caption.TranslatableCaption;
 | 
				
			||||||
import com.plotsquared.core.events.PlotFlagAddEvent;
 | 
					import com.plotsquared.core.events.PlotFlagAddEvent;
 | 
				
			||||||
import com.plotsquared.core.events.PlotFlagRemoveEvent;
 | 
					import com.plotsquared.core.events.PlotFlagRemoveEvent;
 | 
				
			||||||
@@ -136,7 +137,7 @@ public final class FlagCommand extends Command {
 | 
				
			|||||||
                        TranslatableCaption.of("flag.flag_parse_error"),
 | 
					                        TranslatableCaption.of("flag.flag_parse_error"),
 | 
				
			||||||
                        Template.of("flag_name", flag.getName()),
 | 
					                        Template.of("flag_name", flag.getName()),
 | 
				
			||||||
                        Template.of("flag_value", e.getValue()),
 | 
					                        Template.of("flag_value", e.getValue()),
 | 
				
			||||||
                        Template.of("error", e.getErrorMessage())
 | 
					                        Templates.of(player, "error", e.getErrorMessage(), e.getTemplates())
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
                return false;
 | 
					                return false;
 | 
				
			||||||
            } catch (final Exception e) {
 | 
					            } catch (final Exception e) {
 | 
				
			||||||
@@ -333,7 +334,7 @@ public final class FlagCommand extends Command {
 | 
				
			|||||||
                    TranslatableCaption.of("flag.flag_parse_error"),
 | 
					                    TranslatableCaption.of("flag.flag_parse_error"),
 | 
				
			||||||
                    Template.of("flag_name", plotFlag.getName()),
 | 
					                    Template.of("flag_name", plotFlag.getName()),
 | 
				
			||||||
                    Template.of("flag_value", e.getValue()),
 | 
					                    Template.of("flag_value", e.getValue()),
 | 
				
			||||||
                    Template.of("error", e.getErrorMessage())
 | 
					                    Templates.of(player, "error", e.getErrorMessage(), e.getTemplates())
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -392,7 +393,7 @@ public final class FlagCommand extends Command {
 | 
				
			|||||||
                    TranslatableCaption.of("flag.flag_parse_error"),
 | 
					                    TranslatableCaption.of("flag.flag_parse_error"),
 | 
				
			||||||
                    Template.of("flag_name", plotFlag.getName()),
 | 
					                    Template.of("flag_name", plotFlag.getName()),
 | 
				
			||||||
                    Template.of("flag_value", e.getValue()),
 | 
					                    Template.of("flag_value", e.getValue()),
 | 
				
			||||||
                    Template.of("error", e.getErrorMessage())
 | 
					                    Templates.of(player, "error", e.getErrorMessage(), e.getTemplates())
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -462,7 +463,7 @@ public final class FlagCommand extends Command {
 | 
				
			|||||||
                        TranslatableCaption.of("flag.flag_parse_error"),
 | 
					                        TranslatableCaption.of("flag.flag_parse_error"),
 | 
				
			||||||
                        Template.of("flag_name", flag.getName()),
 | 
					                        Template.of("flag_name", flag.getName()),
 | 
				
			||||||
                        Template.of("flag_value", e.getValue()),
 | 
					                        Template.of("flag_value", e.getValue()),
 | 
				
			||||||
                        Template.of("error", e.getErrorMessage())
 | 
					                        Templates.of(player, "error", e.getErrorMessage(), e.getTemplates())
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
                return;
 | 
					                return;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@@ -576,32 +577,23 @@ public final class FlagCommand extends Command {
 | 
				
			|||||||
        if (plotFlag != null) {
 | 
					        if (plotFlag != null) {
 | 
				
			||||||
            player.sendMessage(TranslatableCaption.of("flag.flag_info_header"));
 | 
					            player.sendMessage(TranslatableCaption.of("flag.flag_info_header"));
 | 
				
			||||||
            // Flag name
 | 
					            // Flag name
 | 
				
			||||||
            new PlotMessage(Captions.FLAG_INFO_NAME.getTranslated())
 | 
					            player.sendMessage(TranslatableCaption.of("flag.flag_info_name"), Template.of("flag", plotFlag.getName()));
 | 
				
			||||||
                .color(Captions.FLAG_INFO_COLOR_KEY.getTranslated()).text(plotFlag.getName())
 | 
					 | 
				
			||||||
                .color(Captions.FLAG_INFO_COLOR_VALUE.getTranslated()).send(player);
 | 
					 | 
				
			||||||
            // Flag category
 | 
					            // Flag category
 | 
				
			||||||
            new PlotMessage(Captions.FLAG_INFO_CATEGORY.getTranslated())
 | 
					            player.sendMessage(TranslatableCaption.of("flag.flag_info_category"),
 | 
				
			||||||
                .color(Captions.FLAG_INFO_COLOR_KEY.getTranslated())
 | 
					                    Templates.of(player, "value", plotFlag.getFlagCategory()));
 | 
				
			||||||
                .text(plotFlag.getFlagCategory().getTranslated())
 | 
					 | 
				
			||||||
                .color(Captions.FLAG_INFO_COLOR_VALUE.getTranslated()).send(player);
 | 
					 | 
				
			||||||
            // Flag description
 | 
					            // Flag description
 | 
				
			||||||
            new PlotMessage(Captions.FLAG_INFO_DESCRIPTION.getTranslated())
 | 
					            // TODO maybe merge and \n instead?
 | 
				
			||||||
                .color(Captions.FLAG_INFO_COLOR_KEY.getTranslated()).send(player);
 | 
					            player.sendMessage(TranslatableCaption.of("flag.flag_info_description"));
 | 
				
			||||||
            new PlotMessage(plotFlag.getFlagDescription().getTranslated())
 | 
					            player.sendMessage(plotFlag.getFlagDescription());
 | 
				
			||||||
                .color(Captions.FLAG_INFO_COLOR_VALUE.getTranslated()).send(player);
 | 
					 | 
				
			||||||
            // Flag example
 | 
					            // Flag example
 | 
				
			||||||
            new PlotMessage(Captions.FLAG_INFO_EXAMPLE.getTranslated())
 | 
					            player.sendMessage(TranslatableCaption.of("flag.flag_info_example"),
 | 
				
			||||||
                .color(Captions.FLAG_INFO_COLOR_KEY.getTranslated())
 | 
					                    Template.of("flag", plotFlag.getName()),
 | 
				
			||||||
                .text("/plot flag set " + plotFlag.getName() + " " + plotFlag.getExample())
 | 
					                    Template.of("value", plotFlag.getExample()));
 | 
				
			||||||
                .color(Captions.FLAG_INFO_COLOR_VALUE.getTranslated())
 | 
					 | 
				
			||||||
                .suggest("/plot flag set " + plotFlag.getName() + " " + plotFlag.getExample())
 | 
					 | 
				
			||||||
                .send(player);
 | 
					 | 
				
			||||||
            // Default value
 | 
					            // Default value
 | 
				
			||||||
            final String defaultValue = player.getLocation().getPlotArea().getFlagContainer()
 | 
					            final String defaultValue = player.getLocation().getPlotArea().getFlagContainer()
 | 
				
			||||||
                .getFlagErased(plotFlag.getClass()).toString();
 | 
					                .getFlagErased(plotFlag.getClass()).toString();
 | 
				
			||||||
            new PlotMessage(Captions.FLAG_INFO_DEFAULT_VALUE.getTranslated())
 | 
					            player.sendMessage(TranslatableCaption.of("flag.flag_info_default_value"),
 | 
				
			||||||
                .color(Captions.FLAG_INFO_COLOR_KEY.getTranslated()).text(defaultValue)
 | 
					                    Template.of("value", defaultValue));
 | 
				
			||||||
                .color(Captions.FLAG_INFO_COLOR_VALUE.getTranslated()).send(player);
 | 
					 | 
				
			||||||
            // Footer. Done this way to prevent the duplicate-message-thingy from catching it
 | 
					            // Footer. Done this way to prevent the duplicate-message-thingy from catching it
 | 
				
			||||||
            player.sendMessage(TranslatableCaption.of("flag.flag_info_footer"));
 | 
					            player.sendMessage(TranslatableCaption.of("flag.flag_info_footer"));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -26,13 +26,15 @@
 | 
				
			|||||||
package com.plotsquared.core.plot.flag;
 | 
					package com.plotsquared.core.plot.flag;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.plotsquared.core.configuration.caption.Caption;
 | 
					import com.plotsquared.core.configuration.caption.Caption;
 | 
				
			||||||
import com.plotsquared.core.configuration.caption.CaptionUtility;
 | 
					import net.kyori.adventure.text.minimessage.MiniMessage;
 | 
				
			||||||
 | 
					import net.kyori.adventure.text.minimessage.Template;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class FlagParseException extends Exception {
 | 
					public class FlagParseException extends Exception {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private final PlotFlag<?, ?> flag;
 | 
					    private final PlotFlag<?, ?> flag;
 | 
				
			||||||
    private final String value;
 | 
					    private final String value;
 | 
				
			||||||
    private final String errorMessage;
 | 
					    private final Caption errorMessage;
 | 
				
			||||||
 | 
					    private final Template[] templates;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Construct a new flag parse exception to indicate that an attempt to parse a plot
 | 
					     * Construct a new flag parse exception to indicate that an attempt to parse a plot
 | 
				
			||||||
@@ -44,12 +46,13 @@ public class FlagParseException extends Exception {
 | 
				
			|||||||
     * @param args         Arguments used to format the error message
 | 
					     * @param args         Arguments used to format the error message
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public FlagParseException(final PlotFlag<?, ?> flag, final String value,
 | 
					    public FlagParseException(final PlotFlag<?, ?> flag, final String value,
 | 
				
			||||||
        final Caption errorMessage, final Object... args) {
 | 
					        final Caption errorMessage, final Template... args) {
 | 
				
			||||||
        super(String.format("Failed to parse flag of type '%s'. Value '%s' was not accepted.",
 | 
					        super(String.format("Failed to parse flag of type '%s'. Value '%s' was not accepted.",
 | 
				
			||||||
            flag.getName(), value));
 | 
					            flag.getName(), value));
 | 
				
			||||||
        this.flag = flag;
 | 
					        this.flag = flag;
 | 
				
			||||||
        this.value = value;
 | 
					        this.value = value;
 | 
				
			||||||
        this.errorMessage = CaptionUtility.format(null, errorMessage, args);
 | 
					        this.errorMessage = errorMessage;
 | 
				
			||||||
 | 
					        this.templates = args;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@@ -75,8 +78,15 @@ public class FlagParseException extends Exception {
 | 
				
			|||||||
     *
 | 
					     *
 | 
				
			||||||
     * @return Error message.
 | 
					     * @return Error message.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public String getErrorMessage() {
 | 
					    public Caption getErrorMessage() {
 | 
				
			||||||
        return errorMessage;
 | 
					        return errorMessage;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Get the templates that were supplied by the flag instance.
 | 
				
			||||||
 | 
					     * @return Message templates.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public Template[] getTemplates() {
 | 
				
			||||||
 | 
					        return templates;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -62,8 +62,20 @@ public abstract class PlotFlag<T, F extends PlotFlag<T, F>> {
 | 
				
			|||||||
        this.flagDescription =
 | 
					        this.flagDescription =
 | 
				
			||||||
            Preconditions.checkNotNull(flagDescription, "flag description may not be null");
 | 
					            Preconditions.checkNotNull(flagDescription, "flag description may not be null");
 | 
				
			||||||
        // Parse flag name
 | 
					        // Parse flag name
 | 
				
			||||||
 | 
					        // noinspection unchecked
 | 
				
			||||||
 | 
					        this.flagName = getFlagName(this.getClass());
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Return the name of the flag.
 | 
				
			||||||
 | 
					     * @param flagClass Flag class
 | 
				
			||||||
 | 
					     * @param <T> Value type
 | 
				
			||||||
 | 
					     * @param <F> Flag type
 | 
				
			||||||
 | 
					     * @return The name of the flag implemented by the given class
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public static <T, F extends PlotFlag<T, F>> String getFlagName(Class<F> flagClass) {
 | 
				
			||||||
        final StringBuilder flagName = new StringBuilder();
 | 
					        final StringBuilder flagName = new StringBuilder();
 | 
				
			||||||
        final char[] chars = this.getClass().getSimpleName().replace("Flag", "").toCharArray();
 | 
					        final char[] chars = flagClass.getSimpleName().replace("Flag", "").toCharArray();
 | 
				
			||||||
        for (int i = 0; i < chars.length; i++) {
 | 
					        for (int i = 0; i < chars.length; i++) {
 | 
				
			||||||
            if (i == 0) {
 | 
					            if (i == 0) {
 | 
				
			||||||
                flagName.append(Character.toLowerCase(chars[i]));
 | 
					                flagName.append(Character.toLowerCase(chars[i]));
 | 
				
			||||||
@@ -73,7 +85,7 @@ public abstract class PlotFlag<T, F extends PlotFlag<T, F>> {
 | 
				
			|||||||
                flagName.append(chars[i]);
 | 
					                flagName.append(chars[i]);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        this.flagName = flagName.toString();
 | 
					        return flagName.toString();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -26,6 +26,7 @@
 | 
				
			|||||||
package com.plotsquared.core.plot.flag.types;
 | 
					package com.plotsquared.core.plot.flag.types;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.plotsquared.core.configuration.caption.Caption;
 | 
					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.configuration.caption.TranslatableCaption;
 | 
				
			||||||
import com.plotsquared.core.plot.flag.FlagParseException;
 | 
					import com.plotsquared.core.plot.flag.FlagParseException;
 | 
				
			||||||
import com.plotsquared.core.plot.flag.PlotFlag;
 | 
					import com.plotsquared.core.plot.flag.PlotFlag;
 | 
				
			||||||
@@ -51,8 +52,9 @@ public abstract class NumberFlag<N extends Number & Comparable<N>, F extends Plo
 | 
				
			|||||||
    @Override public F parse(@Nonnull String input) throws FlagParseException {
 | 
					    @Override public F parse(@Nonnull String input) throws FlagParseException {
 | 
				
			||||||
        final N parsed = parseNumber(input);
 | 
					        final N parsed = parseNumber(input);
 | 
				
			||||||
        if (parsed.compareTo(minimum) < 0 || parsed.compareTo(maximum) > 0) {
 | 
					        if (parsed.compareTo(minimum) < 0 || parsed.compareTo(maximum) > 0) {
 | 
				
			||||||
            throw new FlagParseException(this, input, TranslatableCaption.of("invalid.number_not_in_range"), minimum,
 | 
					            throw new FlagParseException(this, input, TranslatableCaption.of("invalid.number_not_in_range"),
 | 
				
			||||||
                maximum);
 | 
					                    Templates.of("min", minimum),
 | 
				
			||||||
 | 
					                    Templates.of("max", maximum));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return flagOf(parsed);
 | 
					        return flagOf(parsed);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -294,11 +294,14 @@ public class EventDispatcher {
 | 
				
			|||||||
                        return true;
 | 
					                        return true;
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                return Permissions
 | 
					                if (Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.toString(), false)) {
 | 
				
			||||||
                        .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.toString(),
 | 
					                    return true;
 | 
				
			||||||
                                false) || !(!notifyPerms || MainUtil
 | 
					                }
 | 
				
			||||||
                        .sendMessage(player, Captions.FLAG_TUTORIAL_USAGE,
 | 
					                if (notifyPerms) {
 | 
				
			||||||
                                Captions.FLAG_USE.getTranslated()));
 | 
					                    player.sendMessage(TranslatableCaption.of("commandconfig.flag_tutorial_usage"),
 | 
				
			||||||
 | 
					                            Template.of("flag", PlaceFlag.getFlagName(UseFlag.class)));
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                return false;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            case TRIGGER_PHYSICAL: {
 | 
					            case TRIGGER_PHYSICAL: {
 | 
				
			||||||
                if (plot == null) {
 | 
					                if (plot == null) {
 | 
				
			||||||
@@ -347,9 +350,12 @@ public class EventDispatcher {
 | 
				
			|||||||
                        false)) {
 | 
					                        false)) {
 | 
				
			||||||
                    return true;
 | 
					                    return true;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                return !(!notifyPerms || MainUtil.sendMessage(player, Captions.FLAG_TUTORIAL_USAGE,
 | 
					                if (notifyPerms) {
 | 
				
			||||||
                    Captions.FLAG_MOB_PLACE.getTranslated() + '/' + Captions.FLAG_PLACE
 | 
					                    player.sendMessage(TranslatableCaption.of("commandconfig.flag_tutorial_usage"),
 | 
				
			||||||
                        .getTranslated()));
 | 
					                            Template.of("flag", PlotFlag.getFlagName(MobPlaceFlag.class)
 | 
				
			||||||
 | 
					                                    + '/' + PlotFlag.getFlagName(PlaceFlag.class)));
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                return false;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            case PLACE_MISC: {
 | 
					            case PLACE_MISC: {
 | 
				
			||||||
                if (plot == null) {
 | 
					                if (plot == null) {
 | 
				
			||||||
@@ -375,9 +381,12 @@ public class EventDispatcher {
 | 
				
			|||||||
                        false)) {
 | 
					                        false)) {
 | 
				
			||||||
                    return true;
 | 
					                    return true;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                return !(!notifyPerms || MainUtil.sendMessage(player, Captions.FLAG_TUTORIAL_USAGE,
 | 
					                if (notifyPerms) {
 | 
				
			||||||
                    Captions.FLAG_MISC_PLACE.getTranslated() + '/' + Captions.FLAG_PLACE
 | 
					                    player.sendMessage(TranslatableCaption.of("commandconfig.flag_tutorial_usage"),
 | 
				
			||||||
                        .getTranslated()));
 | 
					                            Template.of("flag", PlotFlag.getFlagName(MiscPlaceFlag.class)
 | 
				
			||||||
 | 
					                                    + '/' + PlotFlag.getFlagName(PlaceFlag.class)));
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                return false;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            case PLACE_VEHICLE:
 | 
					            case PLACE_VEHICLE:
 | 
				
			||||||
                if (plot == null) {
 | 
					                if (plot == null) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -514,11 +514,11 @@
 | 
				
			|||||||
  "flag.flag_info_footer": "<dark_gray><strikethrough>---------<reset> <gold>PlotSquared Flags </gold><dark_gray><strikethrough>---------<reset>",
 | 
					  "flag.flag_info_footer": "<dark_gray><strikethrough>---------<reset> <gold>PlotSquared Flags </gold><dark_gray><strikethrough>---------<reset>",
 | 
				
			||||||
  "flag.flag_list_categories": "<gold><category>: </gold>",
 | 
					  "flag.flag_list_categories": "<gold><category>: </gold>",
 | 
				
			||||||
  "flag.flag_list_flag": "<click:run_command:<command>><hover:show_text:<grey>Click to view information about the flag.</grey>><gray><flag></grey></hover></click><grey><suffix></grey>",
 | 
					  "flag.flag_list_flag": "<click:run_command:<command>><hover:show_text:<grey>Click to view information about the flag.</grey>><gray><flag></grey></hover></click><grey><suffix></grey>",
 | 
				
			||||||
  "flag.flag_info_name": "<gray>Name: </gray>",
 | 
					  "flag.flag_info_name": "<gray>Name: <gold><flag></gold></gray>",
 | 
				
			||||||
  "flag.flag_info_category": "<gray>Category: </gray>",
 | 
					  "flag.flag_info_category": "<gray>Category: </gray>",
 | 
				
			||||||
  "flag.flag_info_description": "<gray>Description: </gray>",
 | 
					  "flag.flag_info_description": "<gray>Description: </gray>",
 | 
				
			||||||
  "flag.flag_info_example": "<gray>Example: </gray>",
 | 
					  "flag.flag_info_example": "<gray>Example: <click:suggest_command:/plot flag set <flag> <value>><gold>/plot flag set <flag> <value><click></gold></gray>",
 | 
				
			||||||
  "flag.flag_info_default_value": "<gray>Default Value: </gray>",
 | 
					  "flag.flag_info_default_value": "<gray>Default Value: <value></gray>",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  "flags.flag_category_string": "<gray>String Flags</gray>",
 | 
					  "flags.flag_category_string": "<gray>String Flags</gray>",
 | 
				
			||||||
  "flags.flag_category_integers": "<gray>Integer Flags</gray>",
 | 
					  "flags.flag_category_integers": "<gray>Integer Flags</gray>",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,8 +27,13 @@ package com.plotsquared.core.plot;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import com.plotsquared.core.database.AbstractDBTest;
 | 
					import com.plotsquared.core.database.AbstractDBTest;
 | 
				
			||||||
import com.plotsquared.core.database.DBFunc;
 | 
					import com.plotsquared.core.database.DBFunc;
 | 
				
			||||||
 | 
					import com.plotsquared.core.plot.flag.PlotFlag;
 | 
				
			||||||
 | 
					import com.plotsquared.core.plot.flag.implementations.UseFlag;
 | 
				
			||||||
import com.sk89q.worldedit.world.item.ItemType;
 | 
					import com.sk89q.worldedit.world.item.ItemType;
 | 
				
			||||||
import org.junit.Before;
 | 
					import org.junit.Before;
 | 
				
			||||||
 | 
					import org.junit.Test;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import static org.junit.Assert.assertEquals;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class FlagTest {
 | 
					public class FlagTest {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -58,4 +63,9 @@ public class FlagTest {
 | 
				
			|||||||
//            assertEquals(flag.get(), flag2.get());
 | 
					//            assertEquals(flag.get(), flag2.get());
 | 
				
			||||||
//        }
 | 
					//        }
 | 
				
			||||||
//    }
 | 
					//    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Test public void testFlagName() {
 | 
				
			||||||
 | 
					        String flagName = PlotFlag.getFlagName(UseFlag.class);
 | 
				
			||||||
 | 
					        assertEquals("use", flagName);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user