diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flags/FlagParseException.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flags/FlagParseException.java index 29ea1d334..cfb9f5180 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flags/FlagParseException.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flags/FlagParseException.java @@ -1,19 +1,21 @@ package com.github.intellectualsites.plotsquared.plot.flags; import com.github.intellectualsites.plotsquared.plot.config.Caption; +import com.github.intellectualsites.plotsquared.plot.config.CaptionUtility; public class FlagParseException extends Exception { private final PlotFlag flag; private final String value; - private final Caption errorMessage; + private final String errorMessage; - public FlagParseException(final PlotFlag flag, final String value, final Caption errorMessage) { + public FlagParseException(final PlotFlag flag, final String value, final Caption errorMessage, + final Object ... args) { super(String.format("Failed to parse flag of type '%s'. Value '%s' was not accepted.", flag.getName(), value)); this.flag = flag; this.value = value; - this.errorMessage = errorMessage; + this.errorMessage = CaptionUtility.format(errorMessage, args); } /** @@ -34,7 +36,8 @@ public class FlagParseException extends Exception { return this.flag; } - public Caption getErrorMessage() { + public String getErrorMessage() { return errorMessage; } + }