diff --git a/src/main/java/net/knarcraft/paidsigns/PaidSigns.java b/src/main/java/net/knarcraft/paidsigns/PaidSigns.java
index b7a8b7b..e174617 100644
--- a/src/main/java/net/knarcraft/paidsigns/PaidSigns.java
+++ b/src/main/java/net/knarcraft/paidsigns/PaidSigns.java
@@ -2,6 +2,7 @@ package net.knarcraft.paidsigns;
import net.knarcraft.knarlib.KnarLib;
import net.knarcraft.knarlib.formatting.Translator;
+import net.knarcraft.knarlib.util.UpdateChecker;
import net.knarcraft.paidsigns.command.AddCommand;
import net.knarcraft.paidsigns.command.AddConditionCommand;
import net.knarcraft.paidsigns.command.AddConditionTabCompleter;
@@ -38,6 +39,7 @@ import org.bukkit.plugin.java.JavaPlugin;
public final class PaidSigns extends JavaPlugin {
private static PaidSigns paidSigns;
+ private static Translator translator;
private PaidSignManager signManager;
private String language;
private boolean ignoreCase;
@@ -63,6 +65,15 @@ public final class PaidSigns extends JavaPlugin {
return paidSigns;
}
+ /**
+ * Gets the translator to use for this plugin
+ *
+ * @return
The translator to use for this plugin
+ */
+ public static Translator getTranslator() {
+ return translator;
+ }
+
@Override
public void onEnable() {
KnarLib.setPlugin(this);
@@ -71,8 +82,9 @@ public final class PaidSigns extends JavaPlugin {
loadConfig();
//Initialize translator
- Translator.registerMessageCategory(PaidSignsTranslatableMessage.BOOLEAN_TRUE);
- Translator.loadLanguages(language);
+ translator = new Translator();
+ translator.registerMessageCategory(PaidSignsTranslatableMessage.BOOLEAN_TRUE);
+ translator.loadLanguages(language);
signManager = new PaidSignManager(PaidSignManager.loadSigns());
TrackedSignManager.loadTrackedSigns();
@@ -82,6 +94,9 @@ public final class PaidSigns extends JavaPlugin {
pluginManager.registerEvents(new SignBreakListener(), this);
registerCommands();
+
+ UpdateChecker.checkForUpdate(this, "https://api.spigotmc.org/legacy/update.php?resource=105842",
+ () -> this.getDescription().getVersion(), null);
}
@Override
@@ -94,7 +109,7 @@ public final class PaidSigns extends JavaPlugin {
public void reload() {
this.reloadConfig();
loadConfig();
- Translator.loadLanguages(language);
+ translator.loadLanguages(language);
signManager = new PaidSignManager(PaidSignManager.loadSigns());
TrackedSignManager.loadTrackedSigns();
}
diff --git a/src/main/java/net/knarcraft/paidsigns/command/AddCommand.java b/src/main/java/net/knarcraft/paidsigns/command/AddCommand.java
index 4fc3f1a..a38c4b2 100644
--- a/src/main/java/net/knarcraft/paidsigns/command/AddCommand.java
+++ b/src/main/java/net/knarcraft/paidsigns/command/AddCommand.java
@@ -30,7 +30,8 @@ public class AddCommand extends TokenizedCommand {
try {
cost = Double.parseDouble(arguments.get(1));
} catch (NumberFormatException exception) {
- StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_INVALID_NUMBER);
+ StringFormatter.displayErrorMessage(sender, PaidSigns.getTranslator(),
+ PaidSignsTranslatableMessage.ERROR_INVALID_NUMBER);
return false;
}
String permission = "";
@@ -71,17 +72,20 @@ public class AddCommand extends TokenizedCommand {
try {
PaidSign sign = new PaidSign(signName, cost, permission, ignoreCase, ignoreColor, matchAnyCondition);
if (manager.getPaidSign(signName) != null) {
- StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_NAME_DUPLICATE);
+ StringFormatter.displayErrorMessage(sender, PaidSigns.getTranslator(),
+ PaidSignsTranslatableMessage.ERROR_NAME_DUPLICATE);
return false;
}
manager.addPaidSign(sign);
- StringFormatter.displaySuccessMessage(sender, PaidSignsTranslatableMessage.SUCCESS_ADDED_PAID_SIGN);
+ StringFormatter.displaySuccessMessage(sender, PaidSigns.getTranslator(),
+ PaidSignsTranslatableMessage.SUCCESS_ADDED_PAID_SIGN);
return true;
} catch (IOException e) {
- StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_EXCEPTION_OCCURRED);
+ StringFormatter.displayErrorMessage(sender, PaidSigns.getTranslator(),
+ PaidSignsTranslatableMessage.ERROR_EXCEPTION_OCCURRED);
return false;
} catch (IllegalArgumentException e) {
- StringFormatter.displayErrorMessage(sender, StringFormatter.replacePlaceholder(
+ StringFormatter.displayErrorMessage(sender, StringFormatter.replacePlaceholder(PaidSigns.getTranslator(),
PaidSignsTranslatableMessage.ERROR_INVALID_INPUT, "{input}", e.getMessage()));
}
return false;
diff --git a/src/main/java/net/knarcraft/paidsigns/command/AddConditionCommand.java b/src/main/java/net/knarcraft/paidsigns/command/AddConditionCommand.java
index 56033e1..59bd251 100644
--- a/src/main/java/net/knarcraft/paidsigns/command/AddConditionCommand.java
+++ b/src/main/java/net/knarcraft/paidsigns/command/AddConditionCommand.java
@@ -30,11 +30,13 @@ public class AddConditionCommand extends TokenizedCommand {
try {
lineNumber = (short) (Short.parseShort(arguments.get(1)) - 1);
if (lineNumber < 0 || lineNumber > 3) {
- StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_INVALID_NUMBER);
+ StringFormatter.displayErrorMessage(sender, PaidSigns.getTranslator(),
+ PaidSignsTranslatableMessage.ERROR_INVALID_NUMBER);
return false;
}
} catch (NumberFormatException exception) {
- StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_INVALID_NUMBER);
+ StringFormatter.displayErrorMessage(sender, PaidSigns.getTranslator(),
+ PaidSignsTranslatableMessage.ERROR_INVALID_NUMBER);
return false;
}
String stringToMatch = arguments.get(2);
@@ -73,17 +75,20 @@ public class AddConditionCommand extends TokenizedCommand {
PaidSignManager signManager = PaidSigns.getInstance().getSignManager();
PaidSign sign = signManager.getPaidSign(name);
if (sign == null) {
- StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_PAID_SIGN_NOT_FOUND);
+ StringFormatter.displayErrorMessage(sender, PaidSigns.getTranslator(),
+ PaidSignsTranslatableMessage.ERROR_PAID_SIGN_NOT_FOUND);
return false;
}
sign.addCondition(lineNumber, stringToMatch, executeRegEx, ignoreCase, ignoreColor);
try {
signManager.saveSigns();
} catch (IOException e) {
- StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_EXCEPTION_OCCURRED);
+ StringFormatter.displayErrorMessage(sender, PaidSigns.getTranslator(),
+ PaidSignsTranslatableMessage.ERROR_EXCEPTION_OCCURRED);
return false;
}
- StringFormatter.displaySuccessMessage(sender, PaidSignsTranslatableMessage.SUCCESS_ADDED_PAID_SIGN_CONDITION);
+ StringFormatter.displaySuccessMessage(sender, PaidSigns.getTranslator(),
+ PaidSignsTranslatableMessage.SUCCESS_ADDED_PAID_SIGN_CONDITION);
return true;
}
diff --git a/src/main/java/net/knarcraft/paidsigns/command/EditCommand.java b/src/main/java/net/knarcraft/paidsigns/command/EditCommand.java
index 390a83d..398440d 100644
--- a/src/main/java/net/knarcraft/paidsigns/command/EditCommand.java
+++ b/src/main/java/net/knarcraft/paidsigns/command/EditCommand.java
@@ -31,7 +31,8 @@ public class EditCommand extends TokenizedCommand {
PaidSign sign = PaidSigns.getInstance().getSignManager().getPaidSign(arguments.get(0));
if (sign == null) {
- StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_PAID_SIGN_NOT_FOUND);
+ StringFormatter.displayErrorMessage(sender, PaidSigns.getTranslator(),
+ PaidSignsTranslatableMessage.ERROR_PAID_SIGN_NOT_FOUND);
return false;
}
@@ -44,7 +45,8 @@ public class EditCommand extends TokenizedCommand {
return parseGivenProperty(sign, sender);
}
} catch (IOException e) {
- StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_EXCEPTION_OCCURRED);
+ StringFormatter.displayErrorMessage(sender, PaidSigns.getTranslator(),
+ PaidSignsTranslatableMessage.ERROR_EXCEPTION_OCCURRED);
return false;
}
}
@@ -61,7 +63,8 @@ public class EditCommand extends TokenizedCommand {
@NotNull CommandSender sender) throws NumberFormatException {
short signLine = (short) (Short.parseShort(arguments.get(1)) - 1);
if (signLine < 0 || signLine > 3 || sign.getConditions().get(signLine) == null) {
- StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_NO_SUCH_CONDITION);
+ StringFormatter.displayErrorMessage(sender, PaidSigns.getTranslator(),
+ PaidSignsTranslatableMessage.ERROR_NO_SUCH_CONDITION);
return false;
}
if (argumentSize < 4) {
@@ -70,7 +73,8 @@ public class EditCommand extends TokenizedCommand {
PaidSignConditionProperty conditionProperty = PaidSignConditionProperty.getFromString(arguments.get(2));
if (conditionProperty == null) {
- StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_PROPERTY_NOT_RECOGNIZED);
+ StringFormatter.displayErrorMessage(sender, PaidSigns.getTranslator(),
+ PaidSignsTranslatableMessage.ERROR_PROPERTY_NOT_RECOGNIZED);
return false;
}
String value = arguments.get(3);
@@ -89,7 +93,8 @@ public class EditCommand extends TokenizedCommand {
@NotNull CommandSender sender) throws IOException {
PaidSignProperty property = PaidSignProperty.getFromString(arguments.get(1));
if (property == null) {
- StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_PROPERTY_NOT_RECOGNIZED);
+ StringFormatter.displayErrorMessage(sender, PaidSigns.getTranslator(),
+ PaidSignsTranslatableMessage.ERROR_PROPERTY_NOT_RECOGNIZED);
return false;
}
String value = arguments.get(2);
@@ -97,7 +102,8 @@ public class EditCommand extends TokenizedCommand {
updateProperty(sender, sign, property, value);
return true;
} catch (NumberFormatException exception) {
- StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_INVALID_NUMBER);
+ StringFormatter.displayErrorMessage(sender, PaidSigns.getTranslator(),
+ PaidSignsTranslatableMessage.ERROR_INVALID_NUMBER);
return false;
}
}
@@ -135,7 +141,8 @@ public class EditCommand extends TokenizedCommand {
manager.removePaidSign(sign.getName());
manager.addPaidSign(updatedSign);
- StringFormatter.displaySuccessMessage(sender, PaidSignsTranslatableMessage.SUCCESS_UPDATED_PAID_SIGN);
+ StringFormatter.displaySuccessMessage(sender, PaidSigns.getTranslator(),
+ PaidSignsTranslatableMessage.SUCCESS_UPDATED_PAID_SIGN);
}
/**
@@ -171,11 +178,13 @@ public class EditCommand extends TokenizedCommand {
try {
PaidSigns.getInstance().getSignManager().saveSigns();
} catch (IOException e) {
- StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_EXCEPTION_OCCURRED);
+ StringFormatter.displayErrorMessage(sender, PaidSigns.getTranslator(),
+ PaidSignsTranslatableMessage.ERROR_EXCEPTION_OCCURRED);
return false;
}
- StringFormatter.displaySuccessMessage(sender, PaidSignsTranslatableMessage.SUCCESS_UPDATED_PAID_SIGN_CONDITION);
+ StringFormatter.displaySuccessMessage(sender, PaidSigns.getTranslator(),
+ PaidSignsTranslatableMessage.SUCCESS_UPDATED_PAID_SIGN_CONDITION);
return true;
}
diff --git a/src/main/java/net/knarcraft/paidsigns/command/ListCommand.java b/src/main/java/net/knarcraft/paidsigns/command/ListCommand.java
index 50ef28f..afe0e73 100644
--- a/src/main/java/net/knarcraft/paidsigns/command/ListCommand.java
+++ b/src/main/java/net/knarcraft/paidsigns/command/ListCommand.java
@@ -1,7 +1,6 @@
package net.knarcraft.paidsigns.command;
import net.knarcraft.knarlib.formatting.StringFormatter;
-import net.knarcraft.knarlib.formatting.Translator;
import net.knarcraft.paidsigns.PaidSigns;
import net.knarcraft.paidsigns.container.PaidSign;
import net.knarcraft.paidsigns.container.PaidSignCondition;
@@ -55,7 +54,7 @@ public class ListCommand extends TokenizedCommand {
Set signNames = PaidSigns.getInstance().getSignManager().getAllPaidSigns().keySet();
List signNameList = new ArrayList<>(signNames);
Collections.sort(signNameList);
- String infoFormat = Translator.getTranslatedMessage(PaidSignsTranslatableMessage.PAID_SIGNS_INFO_FORMAT);
+ String infoFormat = PaidSigns.getTranslator().getTranslatedMessage(PaidSignsTranslatableMessage.PAID_SIGNS_INFO_FORMAT);
//Display up to 10 signs per page
int signsPerPage = 7;
@@ -72,11 +71,11 @@ public class ListCommand extends TokenizedCommand {
boolean hasNextPage = alreadyDisplayed + signsPerPage < signNameList.size();
String nextPagePrompt = "";
if (hasNextPage) {
- nextPagePrompt = replacePlaceholder(Translator.getTranslatedMessage(
+ nextPagePrompt = replacePlaceholder(PaidSigns.getTranslator().getTranslatedMessage(
PaidSignsTranslatableMessage.PAID_SIGNS_NEXT_PROMPT), "{nextPage}", String.valueOf((pageNumber + 2)));
}
- sender.sendMessage(StringFormatter.replacePlaceholders(Translator.getTranslatedMessage(
+ sender.sendMessage(StringFormatter.replacePlaceholders(PaidSigns.getTranslator().getTranslatedMessage(
PaidSignsTranslatableMessage.PAID_SIGNS_INFO), new String[]{"{signs}", "{nextPagePrompt}"},
new String[]{signs.toString(), nextPagePrompt}));
}
@@ -90,7 +89,7 @@ public class ListCommand extends TokenizedCommand {
private boolean parsePaidSignSelection(CommandSender sender) {
PaidSign paidSign = PaidSigns.getInstance().getSignManager().getPaidSign(arguments.get(0));
if (paidSign == null) {
- displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_PAID_SIGN_NOT_FOUND);
+ displayErrorMessage(sender, PaidSigns.getTranslator(), PaidSignsTranslatableMessage.ERROR_PAID_SIGN_NOT_FOUND);
return false;
}
if (argumentSize < 2) {
@@ -100,16 +99,18 @@ public class ListCommand extends TokenizedCommand {
try {
lineNumber = (short) (Short.parseShort(arguments.get(1)) - 1);
if (lineNumber < 0 || lineNumber > 3) {
- StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_INVALID_NUMBER);
+ StringFormatter.displayErrorMessage(sender, PaidSigns.getTranslator(),
+ PaidSignsTranslatableMessage.ERROR_INVALID_NUMBER);
return false;
}
} catch (NumberFormatException exception) {
- StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_INVALID_NUMBER);
+ StringFormatter.displayErrorMessage(sender, PaidSigns.getTranslator(),
+ PaidSignsTranslatableMessage.ERROR_INVALID_NUMBER);
return false;
}
if (!paidSign.getConditions().containsKey(lineNumber)) {
- StringFormatter.displayErrorMessage(sender, replacePlaceholder(PaidSignsTranslatableMessage.ERROR_NO_SUCH_CONDITION,
- "{line}", String.valueOf(lineNumber)));
+ StringFormatter.displayErrorMessage(sender, replacePlaceholder(PaidSigns.getTranslator(),
+ PaidSignsTranslatableMessage.ERROR_NO_SUCH_CONDITION, "{line}", String.valueOf(lineNumber)));
return false;
}
PaidSignCondition condition = paidSign.getConditions().get(lineNumber);
@@ -128,11 +129,11 @@ public class ListCommand extends TokenizedCommand {
*/
private void displayPaidSignCondition(CommandSender sender, String signName, short signLine,
PaidSignCondition condition) {
- sender.sendMessage(StringFormatter.replacePlaceholders(PaidSignsTranslatableMessage.PAID_SIGN_CONDITION_INFO,
- new String[]{"{name}", "{line}", "{match}", "{regex}", "{case}", "{color}"},
- new String[]{signName, String.valueOf(signLine + 1), condition.stringToMatch(),
- translateBoolean(condition.executeRegex()), translateBoolean(condition.ignoreCase()),
- translateBoolean(condition.ignoreColor())}));
+ sender.sendMessage(StringFormatter.replacePlaceholders(PaidSigns.getTranslator(),
+ PaidSignsTranslatableMessage.PAID_SIGN_CONDITION_INFO, new String[]{"{name}", "{line}", "{match}",
+ "{regex}", "{case}", "{color}"}, new String[]{signName, String.valueOf(signLine + 1),
+ condition.stringToMatch(), translateBoolean(condition.executeRegex()),
+ translateBoolean(condition.ignoreCase()), translateBoolean(condition.ignoreColor())}));
}
/**
@@ -145,12 +146,13 @@ public class ListCommand extends TokenizedCommand {
Map signConditions = paidSign.getConditions();
StringBuilder conditions = new StringBuilder();
for (short lineIndex : signConditions.keySet()) {
- String format = Translator.getTranslatedMessage(PaidSignsTranslatableMessage.PAID_SIGN_INFO_CONDITION_FORMAT);
+ String format = PaidSigns.getTranslator().getTranslatedMessage(
+ PaidSignsTranslatableMessage.PAID_SIGN_INFO_CONDITION_FORMAT);
conditions.append(StringFormatter.replacePlaceholders(format, new String[]{"{line}", "{condition}"},
new String[]{String.valueOf((lineIndex + 1)), signConditions.get(lineIndex).stringToMatch()}));
}
- sender.sendMessage(replacePlaceholders(Translator.getTranslatedMessage(
+ sender.sendMessage(replacePlaceholders(PaidSigns.getTranslator().getTranslatedMessage(
PaidSignsTranslatableMessage.PAID_SIGN_INFO), new String[]{"{name}", "{cost}", "{permission}", "{case}",
"{color}", "{any}", "{conditions}"}, new String[]{paidSign.getName(), String.valueOf(paidSign.getCost()),
paidSign.getPermission(), translateBoolean(paidSign.getIgnoreCase()),
@@ -166,9 +168,9 @@ public class ListCommand extends TokenizedCommand {
*/
public static String translateBoolean(boolean booleanValue) {
if (booleanValue) {
- return Translator.getTranslatedMessage(PaidSignsTranslatableMessage.BOOLEAN_TRUE);
+ return PaidSigns.getTranslator().getTranslatedMessage(PaidSignsTranslatableMessage.BOOLEAN_TRUE);
} else {
- return Translator.getTranslatedMessage(PaidSignsTranslatableMessage.BOOLEAN_FALSE);
+ return PaidSigns.getTranslator().getTranslatedMessage(PaidSignsTranslatableMessage.BOOLEAN_FALSE);
}
}
diff --git a/src/main/java/net/knarcraft/paidsigns/command/ReloadTabCommand.java b/src/main/java/net/knarcraft/paidsigns/command/ReloadTabCommand.java
index ac630d0..9bdf771 100644
--- a/src/main/java/net/knarcraft/paidsigns/command/ReloadTabCommand.java
+++ b/src/main/java/net/knarcraft/paidsigns/command/ReloadTabCommand.java
@@ -20,7 +20,8 @@ public class ReloadTabCommand implements TabExecutor {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label,
@NotNull String[] args) {
PaidSigns.getInstance().reload();
- StringFormatter.displaySuccessMessage(sender, PaidSignsTranslatableMessage.SUCCESS_RELOADED);
+ StringFormatter.displaySuccessMessage(sender, PaidSigns.getTranslator(),
+ PaidSignsTranslatableMessage.SUCCESS_RELOADED);
return true;
}
diff --git a/src/main/java/net/knarcraft/paidsigns/command/RemoveConditionCommand.java b/src/main/java/net/knarcraft/paidsigns/command/RemoveConditionCommand.java
index 3c21e7e..9d39bc5 100644
--- a/src/main/java/net/knarcraft/paidsigns/command/RemoveConditionCommand.java
+++ b/src/main/java/net/knarcraft/paidsigns/command/RemoveConditionCommand.java
@@ -28,22 +28,25 @@ public class RemoveConditionCommand extends TokenizedCommand {
try {
lineNumber = (short) (Short.parseShort(arguments.get(1)) - 1);
if (lineNumber < 0 || lineNumber > 3) {
- StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_INVALID_NUMBER);
+ StringFormatter.displayErrorMessage(sender, PaidSigns.getTranslator(),
+ PaidSignsTranslatableMessage.ERROR_INVALID_NUMBER);
return false;
}
} catch (NumberFormatException exception) {
- StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_INVALID_NUMBER);
+ StringFormatter.displayErrorMessage(sender, PaidSigns.getTranslator(),
+ PaidSignsTranslatableMessage.ERROR_INVALID_NUMBER);
return false;
}
PaidSignManager signManager = PaidSigns.getInstance().getSignManager();
PaidSign sign = signManager.getPaidSign(name);
if (sign == null) {
- StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_PAID_SIGN_NOT_FOUND);
+ StringFormatter.displayErrorMessage(sender, PaidSigns.getTranslator(),
+ PaidSignsTranslatableMessage.ERROR_PAID_SIGN_NOT_FOUND);
return false;
}
if (!sign.getConditions().containsKey(lineNumber)) {
- StringFormatter.displayErrorMessage(sender, StringFormatter.replacePlaceholder(
+ StringFormatter.displayErrorMessage(sender, StringFormatter.replacePlaceholder(PaidSigns.getTranslator(),
PaidSignsTranslatableMessage.ERROR_NO_SUCH_CONDITION, "{line}",
String.valueOf((lineNumber + 1))));
return false;
@@ -53,10 +56,12 @@ public class RemoveConditionCommand extends TokenizedCommand {
try {
signManager.saveSigns();
} catch (IOException e) {
- StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_EXCEPTION_OCCURRED);
+ StringFormatter.displayErrorMessage(sender, PaidSigns.getTranslator(),
+ PaidSignsTranslatableMessage.ERROR_EXCEPTION_OCCURRED);
return false;
}
- StringFormatter.displaySuccessMessage(sender, PaidSignsTranslatableMessage.SUCCESS_REMOVED_CONDITION);
+ StringFormatter.displaySuccessMessage(sender, PaidSigns.getTranslator(),
+ PaidSignsTranslatableMessage.SUCCESS_REMOVED_CONDITION);
return true;
}
diff --git a/src/main/java/net/knarcraft/paidsigns/command/RemoveTabCommand.java b/src/main/java/net/knarcraft/paidsigns/command/RemoveTabCommand.java
index 22801e6..08ae9c4 100644
--- a/src/main/java/net/knarcraft/paidsigns/command/RemoveTabCommand.java
+++ b/src/main/java/net/knarcraft/paidsigns/command/RemoveTabCommand.java
@@ -31,13 +31,16 @@ public class RemoveTabCommand implements TabExecutor {
try {
if (PaidSigns.getInstance().getSignManager().removePaidSign(name)) {
- StringFormatter.displaySuccessMessage(sender, PaidSignsTranslatableMessage.SUCCESS_REMOVED_PAID_SIGN);
+ StringFormatter.displaySuccessMessage(sender, PaidSigns.getTranslator(),
+ PaidSignsTranslatableMessage.SUCCESS_REMOVED_PAID_SIGN);
} else {
- StringFormatter.displaySuccessMessage(sender, PaidSignsTranslatableMessage.ERROR_PAID_SIGN_NOT_FOUND);
+ StringFormatter.displaySuccessMessage(sender, PaidSigns.getTranslator(),
+ PaidSignsTranslatableMessage.ERROR_PAID_SIGN_NOT_FOUND);
}
return true;
} catch (IOException e) {
- StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_EXCEPTION_OCCURRED);
+ StringFormatter.displayErrorMessage(sender, PaidSigns.getTranslator(),
+ PaidSignsTranslatableMessage.ERROR_EXCEPTION_OCCURRED);
}
return false;
}
diff --git a/src/main/java/net/knarcraft/paidsigns/command/TokenizedCommand.java b/src/main/java/net/knarcraft/paidsigns/command/TokenizedCommand.java
index dfb440d..8617534 100644
--- a/src/main/java/net/knarcraft/paidsigns/command/TokenizedCommand.java
+++ b/src/main/java/net/knarcraft/paidsigns/command/TokenizedCommand.java
@@ -1,6 +1,7 @@
package net.knarcraft.paidsigns.command;
import net.knarcraft.knarlib.formatting.StringFormatter;
+import net.knarcraft.paidsigns.PaidSigns;
import net.knarcraft.paidsigns.formatting.PaidSignsTranslatableMessage;
import net.knarcraft.paidsigns.utility.Tokenizer;
import org.bukkit.command.Command;
@@ -39,7 +40,8 @@ public class TokenizedCommand implements CommandExecutor {
Pattern.compile(regularExpression);
return false;
} catch (PatternSyntaxException exception) {
- StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_INVALID_REGULAR_EXPRESSION);
+ StringFormatter.displayErrorMessage(sender, PaidSigns.getTranslator(),
+ PaidSignsTranslatableMessage.ERROR_INVALID_REGULAR_EXPRESSION);
return true;
}
}
diff --git a/src/main/java/net/knarcraft/paidsigns/listener/SignListener.java b/src/main/java/net/knarcraft/paidsigns/listener/SignListener.java
index 89de36a..578ec1c 100644
--- a/src/main/java/net/knarcraft/paidsigns/listener/SignListener.java
+++ b/src/main/java/net/knarcraft/paidsigns/listener/SignListener.java
@@ -151,8 +151,8 @@ public class SignListener implements Listener {
*/
private String replaceCost(double cost, TranslatableMessage message) {
String unit = EconomyManager.getCurrency(cost != 1);
- return String.format(StringFormatter.replacePlaceholders(message, new String[]{"{cost}", "{unit}"},
- new String[]{"%.2f", "%s"}), cost, unit);
+ return String.format(StringFormatter.replacePlaceholders(PaidSigns.getTranslator(), message,
+ new String[]{"{cost}", "{unit}"}, new String[]{"%.2f", "%s"}), cost, unit);
}
}
diff --git a/src/main/java/net/knarcraft/paidsigns/manager/TrackedSignManager.java b/src/main/java/net/knarcraft/paidsigns/manager/TrackedSignManager.java
index ffea755..586a13d 100644
--- a/src/main/java/net/knarcraft/paidsigns/manager/TrackedSignManager.java
+++ b/src/main/java/net/knarcraft/paidsigns/manager/TrackedSignManager.java
@@ -156,8 +156,9 @@ public final class TrackedSignManager {
EconomyManager.deposit(offlinePlayer, refundSum);
if (offlinePlayer instanceof Player player) {
StringFormatter.displaySuccessMessage(player, String.format(StringFormatter.replacePlaceholders(
- PaidSignsTranslatableMessage.SUCCESS_REFUNDED, new String[]{"{cost}", "{unit}"},
- new String[]{"%.2f", "%s"}), refundSum, EconomyManager.getCurrency(refundSum != 1)));
+ PaidSigns.getTranslator(), PaidSignsTranslatableMessage.SUCCESS_REFUNDED,
+ new String[]{"{cost}", "{unit}"}, new String[]{"%.2f", "%s"}), refundSum,
+ EconomyManager.getCurrency(refundSum != 1)));
}
}