Uses KnarLib where possible
This commit is contained in:
parent
6a7d106d31
commit
bb63fb59d1
22
pom.xml
22
pom.xml
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
<description>Add costs for creating plugin signs</description>
|
<description>Add costs for creating plugin signs</description>
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>17</java.version>
|
<java.version>16</java.version>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
<url>https://git.knarcraft.net/EpicKnarvik97/PaidSigns</url>
|
<url>https://git.knarcraft.net/EpicKnarvik97/PaidSigns</url>
|
||||||
@ -41,6 +41,20 @@
|
|||||||
</goals>
|
</goals>
|
||||||
<configuration>
|
<configuration>
|
||||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||||
|
<filters>
|
||||||
|
<filter>
|
||||||
|
<artifact>net.knarcraft:knarlib</artifact>
|
||||||
|
<includes>
|
||||||
|
<include>net/knarcraft/knarlib/**</include>
|
||||||
|
</includes>
|
||||||
|
</filter>
|
||||||
|
<filter>
|
||||||
|
<excludes>
|
||||||
|
<exclude>*.MF</exclude>
|
||||||
|
<exclude>*.yml</exclude>
|
||||||
|
</excludes>
|
||||||
|
</filter>
|
||||||
|
</filters>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
@ -88,5 +102,11 @@
|
|||||||
<version>23.0.0</version>
|
<version>23.0.0</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.knarcraft</groupId>
|
||||||
|
<artifactId>knarlib</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package net.knarcraft.paidsigns;
|
package net.knarcraft.paidsigns;
|
||||||
|
|
||||||
|
import net.knarcraft.knarlib.KnarLib;
|
||||||
|
import net.knarcraft.knarlib.formatting.Translator;
|
||||||
import net.knarcraft.paidsigns.command.AddCommand;
|
import net.knarcraft.paidsigns.command.AddCommand;
|
||||||
import net.knarcraft.paidsigns.command.AddConditionCommand;
|
import net.knarcraft.paidsigns.command.AddConditionCommand;
|
||||||
import net.knarcraft.paidsigns.command.AddConditionTabCompleter;
|
import net.knarcraft.paidsigns.command.AddConditionTabCompleter;
|
||||||
@ -13,7 +15,7 @@ import net.knarcraft.paidsigns.command.ReloadTabCommand;
|
|||||||
import net.knarcraft.paidsigns.command.RemoveConditionCommand;
|
import net.knarcraft.paidsigns.command.RemoveConditionCommand;
|
||||||
import net.knarcraft.paidsigns.command.RemoveConditionTabCompleter;
|
import net.knarcraft.paidsigns.command.RemoveConditionTabCompleter;
|
||||||
import net.knarcraft.paidsigns.command.RemoveTabCommand;
|
import net.knarcraft.paidsigns.command.RemoveTabCommand;
|
||||||
import net.knarcraft.paidsigns.formatting.Translator;
|
import net.knarcraft.paidsigns.formatting.PaidSignsTranslatableMessage;
|
||||||
import net.knarcraft.paidsigns.listener.SignBreakListener;
|
import net.knarcraft.paidsigns.listener.SignBreakListener;
|
||||||
import net.knarcraft.paidsigns.listener.SignListener;
|
import net.knarcraft.paidsigns.listener.SignListener;
|
||||||
import net.knarcraft.paidsigns.manager.EconomyManager;
|
import net.knarcraft.paidsigns.manager.EconomyManager;
|
||||||
@ -63,9 +65,15 @@ public final class PaidSigns extends JavaPlugin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
|
KnarLib.setPlugin(this);
|
||||||
|
|
||||||
setupVault();
|
setupVault();
|
||||||
loadConfig();
|
loadConfig();
|
||||||
|
|
||||||
|
//Initialize translator
|
||||||
|
Translator.registerMessageCategory(PaidSignsTranslatableMessage.BOOLEAN_TRUE);
|
||||||
Translator.loadLanguages(language);
|
Translator.loadLanguages(language);
|
||||||
|
|
||||||
signManager = new PaidSignManager(PaidSignManager.loadSigns());
|
signManager = new PaidSignManager(PaidSignManager.loadSigns());
|
||||||
TrackedSignManager.loadTrackedSigns();
|
TrackedSignManager.loadTrackedSigns();
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package net.knarcraft.paidsigns.command;
|
package net.knarcraft.paidsigns.command;
|
||||||
|
|
||||||
|
import net.knarcraft.knarlib.formatting.StringFormatter;
|
||||||
import net.knarcraft.paidsigns.PaidSigns;
|
import net.knarcraft.paidsigns.PaidSigns;
|
||||||
import net.knarcraft.paidsigns.container.PaidSign;
|
import net.knarcraft.paidsigns.container.PaidSign;
|
||||||
import net.knarcraft.paidsigns.formatting.StringFormatter;
|
import net.knarcraft.paidsigns.formatting.PaidSignsTranslatableMessage;
|
||||||
import net.knarcraft.paidsigns.formatting.TranslatableMessage;
|
|
||||||
import net.knarcraft.paidsigns.manager.PaidSignManager;
|
import net.knarcraft.paidsigns.manager.PaidSignManager;
|
||||||
import net.knarcraft.paidsigns.property.OptionState;
|
import net.knarcraft.paidsigns.property.OptionState;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -30,7 +30,7 @@ public class AddCommand extends TokenizedCommand {
|
|||||||
try {
|
try {
|
||||||
cost = Double.parseDouble(arguments.get(1));
|
cost = Double.parseDouble(arguments.get(1));
|
||||||
} catch (NumberFormatException exception) {
|
} catch (NumberFormatException exception) {
|
||||||
sender.sendMessage(StringFormatter.getTranslatedErrorMessage(TranslatableMessage.ERROR_INVALID_NUMBER));
|
StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_INVALID_NUMBER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String permission = "";
|
String permission = "";
|
||||||
@ -71,18 +71,18 @@ public class AddCommand extends TokenizedCommand {
|
|||||||
try {
|
try {
|
||||||
PaidSign sign = new PaidSign(signName, cost, permission, ignoreCase, ignoreColor, matchAnyCondition);
|
PaidSign sign = new PaidSign(signName, cost, permission, ignoreCase, ignoreColor, matchAnyCondition);
|
||||||
if (manager.getPaidSign(signName) != null) {
|
if (manager.getPaidSign(signName) != null) {
|
||||||
sender.sendMessage(StringFormatter.getTranslatedErrorMessage(TranslatableMessage.ERROR_NAME_DUPLICATE));
|
StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_NAME_DUPLICATE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
manager.addPaidSign(sign);
|
manager.addPaidSign(sign);
|
||||||
sender.sendMessage(StringFormatter.getTranslatedInfoMessage(TranslatableMessage.SUCCESS_ADDED_PAID_SIGN));
|
StringFormatter.displaySuccessMessage(sender, PaidSignsTranslatableMessage.SUCCESS_ADDED_PAID_SIGN);
|
||||||
return true;
|
return true;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
sender.sendMessage(StringFormatter.getTranslatedErrorMessage(TranslatableMessage.ERROR_EXCEPTION_OCCURRED));
|
StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_EXCEPTION_OCCURRED);
|
||||||
return false;
|
return false;
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
sender.sendMessage(StringFormatter.replacePlaceholder(StringFormatter.getTranslatedErrorMessage(
|
StringFormatter.displayErrorMessage(sender, StringFormatter.replacePlaceholder(
|
||||||
TranslatableMessage.ERROR_INVALID_INPUT), "{input}", e.getMessage()));
|
PaidSignsTranslatableMessage.ERROR_INVALID_INPUT, "{input}", e.getMessage()));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package net.knarcraft.paidsigns.command;
|
package net.knarcraft.paidsigns.command;
|
||||||
|
|
||||||
|
import net.knarcraft.knarlib.formatting.StringFormatter;
|
||||||
import net.knarcraft.paidsigns.PaidSigns;
|
import net.knarcraft.paidsigns.PaidSigns;
|
||||||
import net.knarcraft.paidsigns.container.PaidSign;
|
import net.knarcraft.paidsigns.container.PaidSign;
|
||||||
import net.knarcraft.paidsigns.formatting.StringFormatter;
|
import net.knarcraft.paidsigns.formatting.PaidSignsTranslatableMessage;
|
||||||
import net.knarcraft.paidsigns.formatting.TranslatableMessage;
|
|
||||||
import net.knarcraft.paidsigns.manager.PaidSignManager;
|
import net.knarcraft.paidsigns.manager.PaidSignManager;
|
||||||
import net.knarcraft.paidsigns.property.OptionState;
|
import net.knarcraft.paidsigns.property.OptionState;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -30,11 +30,11 @@ public class AddConditionCommand extends TokenizedCommand {
|
|||||||
try {
|
try {
|
||||||
lineNumber = (short) (Short.parseShort(arguments.get(1)) - 1);
|
lineNumber = (short) (Short.parseShort(arguments.get(1)) - 1);
|
||||||
if (lineNumber < 0 || lineNumber > 3) {
|
if (lineNumber < 0 || lineNumber > 3) {
|
||||||
sender.sendMessage(StringFormatter.getTranslatedErrorMessage(TranslatableMessage.ERROR_INVALID_NUMBER));
|
StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_INVALID_NUMBER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException exception) {
|
} catch (NumberFormatException exception) {
|
||||||
sender.sendMessage(StringFormatter.getTranslatedErrorMessage(TranslatableMessage.ERROR_INVALID_NUMBER));
|
StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_INVALID_NUMBER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String stringToMatch = arguments.get(2);
|
String stringToMatch = arguments.get(2);
|
||||||
@ -73,18 +73,17 @@ public class AddConditionCommand extends TokenizedCommand {
|
|||||||
PaidSignManager signManager = PaidSigns.getInstance().getSignManager();
|
PaidSignManager signManager = PaidSigns.getInstance().getSignManager();
|
||||||
PaidSign sign = signManager.getPaidSign(name);
|
PaidSign sign = signManager.getPaidSign(name);
|
||||||
if (sign == null) {
|
if (sign == null) {
|
||||||
sender.sendMessage(StringFormatter.getTranslatedErrorMessage(TranslatableMessage.ERROR_PAID_SIGN_NOT_FOUND));
|
StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_PAID_SIGN_NOT_FOUND);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
sign.addCondition(lineNumber, stringToMatch, executeRegEx, ignoreCase, ignoreColor);
|
sign.addCondition(lineNumber, stringToMatch, executeRegEx, ignoreCase, ignoreColor);
|
||||||
try {
|
try {
|
||||||
signManager.saveSigns();
|
signManager.saveSigns();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
sender.sendMessage(StringFormatter.getTranslatedErrorMessage(TranslatableMessage.ERROR_EXCEPTION_OCCURRED));
|
StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_EXCEPTION_OCCURRED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
sender.sendMessage(StringFormatter.getTranslatedInfoMessage(
|
StringFormatter.displaySuccessMessage(sender, PaidSignsTranslatableMessage.SUCCESS_ADDED_PAID_SIGN_CONDITION);
|
||||||
TranslatableMessage.SUCCESS_ADDED_PAID_SIGN_CONDITION));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package net.knarcraft.paidsigns.command;
|
package net.knarcraft.paidsigns.command;
|
||||||
|
|
||||||
import net.knarcraft.paidsigns.utility.TabCompleteHelper;
|
import net.knarcraft.knarlib.util.TabCompletionHelper;
|
||||||
|
import net.knarcraft.paidsigns.utility.PaidSignsTabCompleteHelper;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@ -28,17 +29,17 @@ public class AddConditionTabCompleter extends TokenizedTabCompleter {
|
|||||||
initializeValues();
|
initializeValues();
|
||||||
}
|
}
|
||||||
if (argumentSize == 1) {
|
if (argumentSize == 1) {
|
||||||
return TabCompleteHelper.filterMatchingStartsWith(TabCompleteHelper.getPaidSignNames(), arguments.get(0));
|
return TabCompletionHelper.filterMatchingStartsWith(PaidSignsTabCompleteHelper.getPaidSignNames(), arguments.get(0));
|
||||||
} else if (argumentSize == 2) {
|
} else if (argumentSize == 2) {
|
||||||
return TabCompleteHelper.filterMatchingStartsWith(this.lineIndices, arguments.get(1));
|
return TabCompletionHelper.filterMatchingStartsWith(this.lineIndices, arguments.get(1));
|
||||||
} else if (argumentSize == 3) {
|
} else if (argumentSize == 3) {
|
||||||
return TabCompleteHelper.filterMatchingStartsWith(stringsToMatch, arguments.get(2));
|
return TabCompletionHelper.filterMatchingStartsWith(stringsToMatch, arguments.get(2));
|
||||||
} else if (argumentSize == 4) {
|
} else if (argumentSize == 4) {
|
||||||
return TabCompleteHelper.filterMatchingStartsWith(booleans, arguments.get(3));
|
return TabCompletionHelper.filterMatchingStartsWith(booleans, arguments.get(3));
|
||||||
} else if (argumentSize == 5) {
|
} else if (argumentSize == 5) {
|
||||||
return TabCompleteHelper.filterMatchingStartsWith(optionStates, arguments.get(4));
|
return TabCompletionHelper.filterMatchingStartsWith(optionStates, arguments.get(4));
|
||||||
} else if (argumentSize == 6) {
|
} else if (argumentSize == 6) {
|
||||||
return TabCompleteHelper.filterMatchingStartsWith(optionStates, arguments.get(5));
|
return TabCompletionHelper.filterMatchingStartsWith(optionStates, arguments.get(5));
|
||||||
}
|
}
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
@ -47,10 +48,10 @@ public class AddConditionTabCompleter extends TokenizedTabCompleter {
|
|||||||
* Initializes the values available for tab completion
|
* Initializes the values available for tab completion
|
||||||
*/
|
*/
|
||||||
private void initializeValues() {
|
private void initializeValues() {
|
||||||
lineIndices = TabCompleteHelper.getSignLines();
|
lineIndices = PaidSignsTabCompleteHelper.getSignLines();
|
||||||
stringsToMatch = TabCompleteHelper.getExampleConditionStrings();
|
stringsToMatch = PaidSignsTabCompleteHelper.getExampleConditionStrings();
|
||||||
booleans = TabCompleteHelper.getBooleans();
|
booleans = PaidSignsTabCompleteHelper.getBooleans();
|
||||||
optionStates = TabCompleteHelper.getOptionStates();
|
optionStates = PaidSignsTabCompleteHelper.getOptionStates();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package net.knarcraft.paidsigns.command;
|
package net.knarcraft.paidsigns.command;
|
||||||
|
|
||||||
import net.knarcraft.paidsigns.utility.TabCompleteHelper;
|
import net.knarcraft.knarlib.util.TabCompletionHelper;
|
||||||
|
import net.knarcraft.paidsigns.utility.PaidSignsTabCompleteHelper;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@ -29,17 +30,17 @@ public class AddTabCompleter extends TokenizedTabCompleter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (argumentSize == 1) {
|
if (argumentSize == 1) {
|
||||||
return TabCompleteHelper.filterMatchingStartsWith(names, arguments.get(0));
|
return TabCompletionHelper.filterMatchingStartsWith(names, arguments.get(0));
|
||||||
} else if (argumentSize == 2) {
|
} else if (argumentSize == 2) {
|
||||||
return TabCompleteHelper.filterMatchingStartsWith(costs, arguments.get(1));
|
return TabCompletionHelper.filterMatchingStartsWith(costs, arguments.get(1));
|
||||||
} else if (argumentSize == 3) {
|
} else if (argumentSize == 3) {
|
||||||
return TabCompleteHelper.tabCompletePermission(arguments.get(arguments.size() - 1));
|
return PaidSignsTabCompleteHelper.tabCompletePermission(arguments.get(arguments.size() - 1));
|
||||||
} else if (argumentSize == 4) {
|
} else if (argumentSize == 4) {
|
||||||
return TabCompleteHelper.filterMatchingStartsWith(options, arguments.get(3));
|
return TabCompletionHelper.filterMatchingStartsWith(options, arguments.get(3));
|
||||||
} else if (argumentSize == 5) {
|
} else if (argumentSize == 5) {
|
||||||
return TabCompleteHelper.filterMatchingStartsWith(options, arguments.get(4));
|
return TabCompletionHelper.filterMatchingStartsWith(options, arguments.get(4));
|
||||||
} else if (argumentSize == 6) {
|
} else if (argumentSize == 6) {
|
||||||
return TabCompleteHelper.filterMatchingStartsWith(booleans, arguments.get(5));
|
return TabCompletionHelper.filterMatchingStartsWith(booleans, arguments.get(5));
|
||||||
}
|
}
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
@ -48,10 +49,10 @@ public class AddTabCompleter extends TokenizedTabCompleter {
|
|||||||
* Initializes the values available for tab completion
|
* Initializes the values available for tab completion
|
||||||
*/
|
*/
|
||||||
private static void initializeValues() {
|
private static void initializeValues() {
|
||||||
names = TabCompleteHelper.getExamplePaidSignNames();
|
names = PaidSignsTabCompleteHelper.getExamplePaidSignNames();
|
||||||
costs = TabCompleteHelper.getCosts();
|
costs = PaidSignsTabCompleteHelper.getCosts();
|
||||||
options = TabCompleteHelper.getOptionStates();
|
options = PaidSignsTabCompleteHelper.getOptionStates();
|
||||||
booleans = TabCompleteHelper.getBooleans();
|
booleans = PaidSignsTabCompleteHelper.getBooleans();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package net.knarcraft.paidsigns.command;
|
package net.knarcraft.paidsigns.command;
|
||||||
|
|
||||||
|
import net.knarcraft.knarlib.formatting.StringFormatter;
|
||||||
import net.knarcraft.paidsigns.PaidSigns;
|
import net.knarcraft.paidsigns.PaidSigns;
|
||||||
import net.knarcraft.paidsigns.container.PaidSign;
|
import net.knarcraft.paidsigns.container.PaidSign;
|
||||||
import net.knarcraft.paidsigns.container.PaidSignCondition;
|
import net.knarcraft.paidsigns.container.PaidSignCondition;
|
||||||
import net.knarcraft.paidsigns.formatting.StringFormatter;
|
import net.knarcraft.paidsigns.formatting.PaidSignsTranslatableMessage;
|
||||||
import net.knarcraft.paidsigns.formatting.TranslatableMessage;
|
|
||||||
import net.knarcraft.paidsigns.manager.PaidSignManager;
|
import net.knarcraft.paidsigns.manager.PaidSignManager;
|
||||||
import net.knarcraft.paidsigns.property.OptionState;
|
import net.knarcraft.paidsigns.property.OptionState;
|
||||||
import net.knarcraft.paidsigns.property.PaidSignConditionProperty;
|
import net.knarcraft.paidsigns.property.PaidSignConditionProperty;
|
||||||
@ -31,7 +31,7 @@ public class EditCommand extends TokenizedCommand {
|
|||||||
|
|
||||||
PaidSign sign = PaidSigns.getInstance().getSignManager().getPaidSign(arguments.get(0));
|
PaidSign sign = PaidSigns.getInstance().getSignManager().getPaidSign(arguments.get(0));
|
||||||
if (sign == null) {
|
if (sign == null) {
|
||||||
sender.sendMessage(StringFormatter.getTranslatedErrorMessage(TranslatableMessage.ERROR_PAID_SIGN_NOT_FOUND));
|
StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_PAID_SIGN_NOT_FOUND);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ public class EditCommand extends TokenizedCommand {
|
|||||||
return parseGivenProperty(sign, sender);
|
return parseGivenProperty(sign, sender);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
sender.sendMessage(StringFormatter.getTranslatedErrorMessage(TranslatableMessage.ERROR_EXCEPTION_OCCURRED));
|
StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_EXCEPTION_OCCURRED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -61,7 +61,7 @@ public class EditCommand extends TokenizedCommand {
|
|||||||
@NotNull CommandSender sender) throws NumberFormatException {
|
@NotNull CommandSender sender) throws NumberFormatException {
|
||||||
short signLine = (short) (Short.parseShort(arguments.get(1)) - 1);
|
short signLine = (short) (Short.parseShort(arguments.get(1)) - 1);
|
||||||
if (signLine < 0 || signLine > 3 || sign.getConditions().get(signLine) == null) {
|
if (signLine < 0 || signLine > 3 || sign.getConditions().get(signLine) == null) {
|
||||||
sender.sendMessage(StringFormatter.getTranslatedErrorMessage(TranslatableMessage.ERROR_NO_SUCH_CONDITION));
|
StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_NO_SUCH_CONDITION);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (argumentSize < 4) {
|
if (argumentSize < 4) {
|
||||||
@ -70,8 +70,7 @@ public class EditCommand extends TokenizedCommand {
|
|||||||
|
|
||||||
PaidSignConditionProperty conditionProperty = PaidSignConditionProperty.getFromString(arguments.get(2));
|
PaidSignConditionProperty conditionProperty = PaidSignConditionProperty.getFromString(arguments.get(2));
|
||||||
if (conditionProperty == null) {
|
if (conditionProperty == null) {
|
||||||
sender.sendMessage(StringFormatter.getTranslatedErrorMessage(
|
StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_PROPERTY_NOT_RECOGNIZED);
|
||||||
TranslatableMessage.ERROR_PROPERTY_NOT_RECOGNIZED));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String value = arguments.get(3);
|
String value = arguments.get(3);
|
||||||
@ -90,8 +89,7 @@ public class EditCommand extends TokenizedCommand {
|
|||||||
@NotNull CommandSender sender) throws IOException {
|
@NotNull CommandSender sender) throws IOException {
|
||||||
PaidSignProperty property = PaidSignProperty.getFromString(arguments.get(1));
|
PaidSignProperty property = PaidSignProperty.getFromString(arguments.get(1));
|
||||||
if (property == null) {
|
if (property == null) {
|
||||||
sender.sendMessage(StringFormatter.getTranslatedErrorMessage(
|
StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_PROPERTY_NOT_RECOGNIZED);
|
||||||
TranslatableMessage.ERROR_PROPERTY_NOT_RECOGNIZED));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String value = arguments.get(2);
|
String value = arguments.get(2);
|
||||||
@ -99,7 +97,7 @@ public class EditCommand extends TokenizedCommand {
|
|||||||
updateProperty(sender, sign, property, value);
|
updateProperty(sender, sign, property, value);
|
||||||
return true;
|
return true;
|
||||||
} catch (NumberFormatException exception) {
|
} catch (NumberFormatException exception) {
|
||||||
sender.sendMessage(StringFormatter.getTranslatedErrorMessage(TranslatableMessage.ERROR_INVALID_NUMBER));
|
StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_INVALID_NUMBER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -137,7 +135,7 @@ public class EditCommand extends TokenizedCommand {
|
|||||||
manager.removePaidSign(sign.getName());
|
manager.removePaidSign(sign.getName());
|
||||||
manager.addPaidSign(updatedSign);
|
manager.addPaidSign(updatedSign);
|
||||||
|
|
||||||
sender.sendMessage(StringFormatter.getTranslatedInfoMessage(TranslatableMessage.SUCCESS_UPDATED_PAID_SIGN));
|
StringFormatter.displaySuccessMessage(sender, PaidSignsTranslatableMessage.SUCCESS_UPDATED_PAID_SIGN);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -173,12 +171,11 @@ public class EditCommand extends TokenizedCommand {
|
|||||||
try {
|
try {
|
||||||
PaidSigns.getInstance().getSignManager().saveSigns();
|
PaidSigns.getInstance().getSignManager().saveSigns();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
sender.sendMessage(StringFormatter.getTranslatedErrorMessage(TranslatableMessage.ERROR_EXCEPTION_OCCURRED));
|
StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_EXCEPTION_OCCURRED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage(StringFormatter.getTranslatedInfoMessage(
|
StringFormatter.displaySuccessMessage(sender, PaidSignsTranslatableMessage.SUCCESS_UPDATED_PAID_SIGN_CONDITION);
|
||||||
TranslatableMessage.SUCCESS_UPDATED_PAID_SIGN_CONDITION));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
package net.knarcraft.paidsigns.command;
|
package net.knarcraft.paidsigns.command;
|
||||||
|
|
||||||
|
import net.knarcraft.knarlib.util.TabCompletionHelper;
|
||||||
import net.knarcraft.paidsigns.PaidSigns;
|
import net.knarcraft.paidsigns.PaidSigns;
|
||||||
import net.knarcraft.paidsigns.container.PaidSign;
|
import net.knarcraft.paidsigns.container.PaidSign;
|
||||||
import net.knarcraft.paidsigns.property.PaidSignConditionProperty;
|
import net.knarcraft.paidsigns.property.PaidSignConditionProperty;
|
||||||
import net.knarcraft.paidsigns.property.PaidSignProperty;
|
import net.knarcraft.paidsigns.property.PaidSignProperty;
|
||||||
import net.knarcraft.paidsigns.utility.TabCompleteHelper;
|
import net.knarcraft.paidsigns.utility.PaidSignsTabCompleteHelper;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@ -34,7 +35,7 @@ public class EditTabCompleter extends TokenizedTabCompleter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (argumentSize == 1) {
|
if (argumentSize == 1) {
|
||||||
return TabCompleteHelper.filterMatchingStartsWith(TabCompleteHelper.getPaidSignNames(), arguments.get(0));
|
return TabCompletionHelper.filterMatchingStartsWith(PaidSignsTabCompleteHelper.getPaidSignNames(), arguments.get(0));
|
||||||
} else if (argumentSize >= 2) {
|
} else if (argumentSize >= 2) {
|
||||||
PaidSign sign = PaidSigns.getInstance().getSignManager().getPaidSign(arguments.get(0));
|
PaidSign sign = PaidSigns.getInstance().getSignManager().getPaidSign(arguments.get(0));
|
||||||
if (sign != null) {
|
if (sign != null) {
|
||||||
@ -54,7 +55,7 @@ public class EditTabCompleter extends TokenizedTabCompleter {
|
|||||||
if (argumentSize == 2) {
|
if (argumentSize == 2) {
|
||||||
List<String> conditions = getAvailableSignConditions(sign);
|
List<String> conditions = getAvailableSignConditions(sign);
|
||||||
conditions.addAll(getPaidSignProperties());
|
conditions.addAll(getPaidSignProperties());
|
||||||
return TabCompleteHelper.filterMatchingStartsWith(conditions, arguments.get(1));
|
return TabCompletionHelper.filterMatchingStartsWith(conditions, arguments.get(1));
|
||||||
} else if (argumentSize >= 3) {
|
} else if (argumentSize >= 3) {
|
||||||
try {
|
try {
|
||||||
return tabCompleteSignLine(sign);
|
return tabCompleteSignLine(sign);
|
||||||
@ -79,11 +80,11 @@ public class EditTabCompleter extends TokenizedTabCompleter {
|
|||||||
if (signLine < 0 || signLine > 3 || sign.getConditions().get(signLine) == null) {
|
if (signLine < 0 || signLine > 3 || sign.getConditions().get(signLine) == null) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
} else if (argumentSize == 3) {
|
} else if (argumentSize == 3) {
|
||||||
return TabCompleteHelper.filterMatchingStartsWith(getPaidSignConditionProperties(), arguments.get(2));
|
return TabCompletionHelper.filterMatchingStartsWith(getPaidSignConditionProperties(), arguments.get(2));
|
||||||
} else if (argumentSize == 4) {
|
} else if (argumentSize == 4) {
|
||||||
PaidSignConditionProperty property = PaidSignConditionProperty.getFromString(arguments.get(2));
|
PaidSignConditionProperty property = PaidSignConditionProperty.getFromString(arguments.get(2));
|
||||||
if (property != null) {
|
if (property != null) {
|
||||||
return TabCompleteHelper.filterMatchingStartsWith(conditionPropertyExampleValues.get(property),
|
return TabCompletionHelper.filterMatchingStartsWith(conditionPropertyExampleValues.get(property),
|
||||||
arguments.get(3));
|
arguments.get(3));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -99,9 +100,9 @@ public class EditTabCompleter extends TokenizedTabCompleter {
|
|||||||
PaidSignProperty paidSignProperty = PaidSignProperty.getFromString(arguments.get(1));
|
PaidSignProperty paidSignProperty = PaidSignProperty.getFromString(arguments.get(1));
|
||||||
if (paidSignProperty != null) {
|
if (paidSignProperty != null) {
|
||||||
if (paidSignProperty == PaidSignProperty.PERMISSION) {
|
if (paidSignProperty == PaidSignProperty.PERMISSION) {
|
||||||
return TabCompleteHelper.tabCompletePermission(arguments.get(2));
|
return PaidSignsTabCompleteHelper.tabCompletePermission(arguments.get(2));
|
||||||
} else {
|
} else {
|
||||||
return TabCompleteHelper.filterMatchingStartsWith(propertyExampleValues.get(paidSignProperty),
|
return TabCompletionHelper.filterMatchingStartsWith(propertyExampleValues.get(paidSignProperty),
|
||||||
arguments.get(2));
|
arguments.get(2));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -154,11 +155,11 @@ public class EditTabCompleter extends TokenizedTabCompleter {
|
|||||||
*/
|
*/
|
||||||
private void initializePropertyExampleValues() {
|
private void initializePropertyExampleValues() {
|
||||||
propertyExampleValues = new HashMap<>();
|
propertyExampleValues = new HashMap<>();
|
||||||
propertyExampleValues.put(PaidSignProperty.COST, TabCompleteHelper.getCosts());
|
propertyExampleValues.put(PaidSignProperty.COST, PaidSignsTabCompleteHelper.getCosts());
|
||||||
propertyExampleValues.put(PaidSignProperty.NAME, TabCompleteHelper.getPaidSignNames());
|
propertyExampleValues.put(PaidSignProperty.NAME, PaidSignsTabCompleteHelper.getPaidSignNames());
|
||||||
propertyExampleValues.put(PaidSignProperty.IGNORE_CASE, TabCompleteHelper.getOptionStates());
|
propertyExampleValues.put(PaidSignProperty.IGNORE_CASE, PaidSignsTabCompleteHelper.getOptionStates());
|
||||||
propertyExampleValues.put(PaidSignProperty.IGNORE_COLOR, TabCompleteHelper.getOptionStates());
|
propertyExampleValues.put(PaidSignProperty.IGNORE_COLOR, PaidSignsTabCompleteHelper.getOptionStates());
|
||||||
propertyExampleValues.put(PaidSignProperty.MATCH_ANY_CONDITION, TabCompleteHelper.getBooleans());
|
propertyExampleValues.put(PaidSignProperty.MATCH_ANY_CONDITION, PaidSignsTabCompleteHelper.getBooleans());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -167,10 +168,10 @@ public class EditTabCompleter extends TokenizedTabCompleter {
|
|||||||
private void initializeConditionPropertyExampleValues() {
|
private void initializeConditionPropertyExampleValues() {
|
||||||
conditionPropertyExampleValues = new HashMap<>();
|
conditionPropertyExampleValues = new HashMap<>();
|
||||||
conditionPropertyExampleValues.put(PaidSignConditionProperty.STRING_TO_MATCH,
|
conditionPropertyExampleValues.put(PaidSignConditionProperty.STRING_TO_MATCH,
|
||||||
TabCompleteHelper.getExampleConditionStrings());
|
PaidSignsTabCompleteHelper.getExampleConditionStrings());
|
||||||
conditionPropertyExampleValues.put(PaidSignConditionProperty.IGNORE_COLOR, TabCompleteHelper.getOptionStates());
|
conditionPropertyExampleValues.put(PaidSignConditionProperty.IGNORE_COLOR, PaidSignsTabCompleteHelper.getOptionStates());
|
||||||
conditionPropertyExampleValues.put(PaidSignConditionProperty.IGNORE_CASE, TabCompleteHelper.getOptionStates());
|
conditionPropertyExampleValues.put(PaidSignConditionProperty.IGNORE_CASE, PaidSignsTabCompleteHelper.getOptionStates());
|
||||||
conditionPropertyExampleValues.put(PaidSignConditionProperty.EXECUTE_REG_EX, TabCompleteHelper.getBooleans());
|
conditionPropertyExampleValues.put(PaidSignConditionProperty.EXECUTE_REG_EX, PaidSignsTabCompleteHelper.getBooleans());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package net.knarcraft.paidsigns.command;
|
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.PaidSigns;
|
||||||
import net.knarcraft.paidsigns.container.PaidSign;
|
import net.knarcraft.paidsigns.container.PaidSign;
|
||||||
import net.knarcraft.paidsigns.container.PaidSignCondition;
|
import net.knarcraft.paidsigns.container.PaidSignCondition;
|
||||||
import net.knarcraft.paidsigns.formatting.StringFormatter;
|
import net.knarcraft.paidsigns.formatting.PaidSignsTranslatableMessage;
|
||||||
import net.knarcraft.paidsigns.formatting.TranslatableMessage;
|
|
||||||
import net.knarcraft.paidsigns.formatting.Translator;
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@ -16,10 +16,9 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import static net.knarcraft.paidsigns.formatting.StringFormatter.getTranslatedErrorMessage;
|
import static net.knarcraft.knarlib.formatting.StringFormatter.displayErrorMessage;
|
||||||
import static net.knarcraft.paidsigns.formatting.StringFormatter.replacePlaceholder;
|
import static net.knarcraft.knarlib.formatting.StringFormatter.replacePlaceholder;
|
||||||
import static net.knarcraft.paidsigns.formatting.StringFormatter.replacePlaceholders;
|
import static net.knarcraft.knarlib.formatting.StringFormatter.replacePlaceholders;
|
||||||
import static net.knarcraft.paidsigns.formatting.StringFormatter.translateBoolean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A representation of the command for listing information about paid signs
|
* A representation of the command for listing information about paid signs
|
||||||
@ -56,7 +55,7 @@ public class ListCommand extends TokenizedCommand {
|
|||||||
Set<String> signNames = PaidSigns.getInstance().getSignManager().getAllPaidSigns().keySet();
|
Set<String> signNames = PaidSigns.getInstance().getSignManager().getAllPaidSigns().keySet();
|
||||||
List<String> signNameList = new ArrayList<>(signNames);
|
List<String> signNameList = new ArrayList<>(signNames);
|
||||||
Collections.sort(signNameList);
|
Collections.sort(signNameList);
|
||||||
String infoFormat = Translator.getTranslatedMessage(TranslatableMessage.PAID_SIGNS_INFO_FORMAT);
|
String infoFormat = Translator.getTranslatedMessage(PaidSignsTranslatableMessage.PAID_SIGNS_INFO_FORMAT);
|
||||||
|
|
||||||
//Display up to 10 signs per page
|
//Display up to 10 signs per page
|
||||||
int signsPerPage = 7;
|
int signsPerPage = 7;
|
||||||
@ -66,19 +65,19 @@ public class ListCommand extends TokenizedCommand {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
String signName = signNameList.get(signIndex);
|
String signName = signNameList.get(signIndex);
|
||||||
signs.append(StringFormatter.replacePlaceholder(infoFormat, "{name}", signName));
|
signs.append(replacePlaceholder(infoFormat, "{name}", signName));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Display that another page exists, if necessary
|
//Display that another page exists, if necessary
|
||||||
boolean hasNextPage = alreadyDisplayed + signsPerPage < signNameList.size();
|
boolean hasNextPage = alreadyDisplayed + signsPerPage < signNameList.size();
|
||||||
String nextPagePrompt = "";
|
String nextPagePrompt = "";
|
||||||
if (hasNextPage) {
|
if (hasNextPage) {
|
||||||
nextPagePrompt = StringFormatter.replacePlaceholder(Translator.getTranslatedMessage(
|
nextPagePrompt = replacePlaceholder(Translator.getTranslatedMessage(
|
||||||
TranslatableMessage.PAID_SIGNS_NEXT_PROMPT), "{nextPage}", String.valueOf((pageNumber + 2)));
|
PaidSignsTranslatableMessage.PAID_SIGNS_NEXT_PROMPT), "{nextPage}", String.valueOf((pageNumber + 2)));
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage(StringFormatter.replacePlaceholders(Translator.getTranslatedMessage(
|
sender.sendMessage(StringFormatter.replacePlaceholders(Translator.getTranslatedMessage(
|
||||||
TranslatableMessage.PAID_SIGNS_INFO), new String[]{"{signs}", "{nextPagePrompt}"},
|
PaidSignsTranslatableMessage.PAID_SIGNS_INFO), new String[]{"{signs}", "{nextPagePrompt}"},
|
||||||
new String[]{signs.toString(), nextPagePrompt}));
|
new String[]{signs.toString(), nextPagePrompt}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,7 +90,7 @@ public class ListCommand extends TokenizedCommand {
|
|||||||
private boolean parsePaidSignSelection(CommandSender sender) {
|
private boolean parsePaidSignSelection(CommandSender sender) {
|
||||||
PaidSign paidSign = PaidSigns.getInstance().getSignManager().getPaidSign(arguments.get(0));
|
PaidSign paidSign = PaidSigns.getInstance().getSignManager().getPaidSign(arguments.get(0));
|
||||||
if (paidSign == null) {
|
if (paidSign == null) {
|
||||||
sender.sendMessage(getTranslatedErrorMessage(TranslatableMessage.ERROR_PAID_SIGN_NOT_FOUND));
|
displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_PAID_SIGN_NOT_FOUND);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (argumentSize < 2) {
|
if (argumentSize < 2) {
|
||||||
@ -101,16 +100,16 @@ public class ListCommand extends TokenizedCommand {
|
|||||||
try {
|
try {
|
||||||
lineNumber = (short) (Short.parseShort(arguments.get(1)) - 1);
|
lineNumber = (short) (Short.parseShort(arguments.get(1)) - 1);
|
||||||
if (lineNumber < 0 || lineNumber > 3) {
|
if (lineNumber < 0 || lineNumber > 3) {
|
||||||
sender.sendMessage(StringFormatter.getTranslatedErrorMessage(TranslatableMessage.ERROR_INVALID_NUMBER));
|
StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_INVALID_NUMBER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException exception) {
|
} catch (NumberFormatException exception) {
|
||||||
sender.sendMessage(getTranslatedErrorMessage(TranslatableMessage.ERROR_INVALID_NUMBER));
|
StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_INVALID_NUMBER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!paidSign.getConditions().containsKey(lineNumber)) {
|
if (!paidSign.getConditions().containsKey(lineNumber)) {
|
||||||
sender.sendMessage(replacePlaceholder(getTranslatedErrorMessage(
|
StringFormatter.displayErrorMessage(sender, replacePlaceholder(PaidSignsTranslatableMessage.ERROR_NO_SUCH_CONDITION,
|
||||||
TranslatableMessage.ERROR_NO_SUCH_CONDITION), "{line}", String.valueOf(lineNumber)));
|
"{line}", String.valueOf(lineNumber)));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PaidSignCondition condition = paidSign.getConditions().get(lineNumber);
|
PaidSignCondition condition = paidSign.getConditions().get(lineNumber);
|
||||||
@ -129,9 +128,9 @@ public class ListCommand extends TokenizedCommand {
|
|||||||
*/
|
*/
|
||||||
private void displayPaidSignCondition(CommandSender sender, String signName, short signLine,
|
private void displayPaidSignCondition(CommandSender sender, String signName, short signLine,
|
||||||
PaidSignCondition condition) {
|
PaidSignCondition condition) {
|
||||||
sender.sendMessage(StringFormatter.replacePlaceholders(Translator.getTranslatedMessage(
|
sender.sendMessage(StringFormatter.replacePlaceholders(PaidSignsTranslatableMessage.PAID_SIGN_CONDITION_INFO,
|
||||||
TranslatableMessage.PAID_SIGN_CONDITION_INFO), new String[]{"{name}", "{line}", "{match}", "{regex}",
|
new String[]{"{name}", "{line}", "{match}", "{regex}", "{case}", "{color}"},
|
||||||
"{case}", "{color}"}, new String[]{signName, String.valueOf(signLine + 1), condition.stringToMatch(),
|
new String[]{signName, String.valueOf(signLine + 1), condition.stringToMatch(),
|
||||||
translateBoolean(condition.executeRegex()), translateBoolean(condition.ignoreCase()),
|
translateBoolean(condition.executeRegex()), translateBoolean(condition.ignoreCase()),
|
||||||
translateBoolean(condition.ignoreColor())}));
|
translateBoolean(condition.ignoreColor())}));
|
||||||
}
|
}
|
||||||
@ -146,17 +145,31 @@ public class ListCommand extends TokenizedCommand {
|
|||||||
Map<Short, PaidSignCondition> signConditions = paidSign.getConditions();
|
Map<Short, PaidSignCondition> signConditions = paidSign.getConditions();
|
||||||
StringBuilder conditions = new StringBuilder();
|
StringBuilder conditions = new StringBuilder();
|
||||||
for (short lineIndex : signConditions.keySet()) {
|
for (short lineIndex : signConditions.keySet()) {
|
||||||
String format = Translator.getTranslatedMessage(TranslatableMessage.PAID_SIGN_INFO_CONDITION_FORMAT);
|
String format = Translator.getTranslatedMessage(PaidSignsTranslatableMessage.PAID_SIGN_INFO_CONDITION_FORMAT);
|
||||||
conditions.append(StringFormatter.replacePlaceholders(format, new String[]{"{line}", "{condition}"},
|
conditions.append(StringFormatter.replacePlaceholders(format, new String[]{"{line}", "{condition}"},
|
||||||
new String[]{String.valueOf((lineIndex + 1)), signConditions.get(lineIndex).stringToMatch()}));
|
new String[]{String.valueOf((lineIndex + 1)), signConditions.get(lineIndex).stringToMatch()}));
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage(replacePlaceholders(Translator.getTranslatedMessage(
|
sender.sendMessage(replacePlaceholders(Translator.getTranslatedMessage(
|
||||||
TranslatableMessage.PAID_SIGN_INFO), new String[]{"{name}", "{cost}", "{permission}", "{case}",
|
PaidSignsTranslatableMessage.PAID_SIGN_INFO), new String[]{"{name}", "{cost}", "{permission}", "{case}",
|
||||||
"{color}", "{any}", "{conditions}"}, new String[]{paidSign.getName(), String.valueOf(paidSign.getCost()),
|
"{color}", "{any}", "{conditions}"}, new String[]{paidSign.getName(), String.valueOf(paidSign.getCost()),
|
||||||
paidSign.getPermission(), translateBoolean(paidSign.getIgnoreCase()),
|
paidSign.getPermission(), translateBoolean(paidSign.getIgnoreCase()),
|
||||||
translateBoolean(paidSign.getIgnoreColor()), translateBoolean(paidSign.matchAnyCondition()),
|
translateBoolean(paidSign.getIgnoreColor()), translateBoolean(paidSign.matchAnyCondition()),
|
||||||
conditions.toString()}));
|
conditions.toString()}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Translates the given boolean value
|
||||||
|
*
|
||||||
|
* @param booleanValue <p>The boolean value to translate</p>
|
||||||
|
* @return <p>The translation of the boolean value</p>
|
||||||
|
*/
|
||||||
|
public static String translateBoolean(boolean booleanValue) {
|
||||||
|
if (booleanValue) {
|
||||||
|
return Translator.getTranslatedMessage(PaidSignsTranslatableMessage.BOOLEAN_TRUE);
|
||||||
|
} else {
|
||||||
|
return Translator.getTranslatedMessage(PaidSignsTranslatableMessage.BOOLEAN_FALSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package net.knarcraft.paidsigns.command;
|
package net.knarcraft.paidsigns.command;
|
||||||
|
|
||||||
|
import net.knarcraft.knarlib.util.TabCompletionHelper;
|
||||||
import net.knarcraft.paidsigns.PaidSigns;
|
import net.knarcraft.paidsigns.PaidSigns;
|
||||||
import net.knarcraft.paidsigns.container.PaidSign;
|
import net.knarcraft.paidsigns.container.PaidSign;
|
||||||
import net.knarcraft.paidsigns.utility.TabCompleteHelper;
|
import net.knarcraft.paidsigns.utility.PaidSignsTabCompleteHelper;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@ -22,7 +23,7 @@ public class ListTabCompleter extends TokenizedTabCompleter {
|
|||||||
@NotNull String[] args) {
|
@NotNull String[] args) {
|
||||||
super.onTabComplete(sender, command, alias, args);
|
super.onTabComplete(sender, command, alias, args);
|
||||||
if (argumentSize == 1) {
|
if (argumentSize == 1) {
|
||||||
return TabCompleteHelper.filterMatchingStartsWith(TabCompleteHelper.getPaidSignNames(), arguments.get(0));
|
return TabCompletionHelper.filterMatchingStartsWith(PaidSignsTabCompleteHelper.getPaidSignNames(), arguments.get(0));
|
||||||
} else if (argumentSize == 2) {
|
} else if (argumentSize == 2) {
|
||||||
PaidSign sign = PaidSigns.getInstance().getSignManager().getPaidSign(arguments.get(0));
|
PaidSign sign = PaidSigns.getInstance().getSignManager().getPaidSign(arguments.get(0));
|
||||||
if (sign != null) {
|
if (sign != null) {
|
||||||
@ -30,7 +31,7 @@ public class ListTabCompleter extends TokenizedTabCompleter {
|
|||||||
for (Short signLine : sign.getConditions().keySet()) {
|
for (Short signLine : sign.getConditions().keySet()) {
|
||||||
availableConditions.add(String.valueOf(signLine + 1));
|
availableConditions.add(String.valueOf(signLine + 1));
|
||||||
}
|
}
|
||||||
return TabCompleteHelper.filterMatchingStartsWith(availableConditions, arguments.get(1));
|
return TabCompletionHelper.filterMatchingStartsWith(availableConditions, arguments.get(1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package net.knarcraft.paidsigns.command;
|
package net.knarcraft.paidsigns.command;
|
||||||
|
|
||||||
|
import net.knarcraft.knarlib.formatting.StringFormatter;
|
||||||
import net.knarcraft.paidsigns.PaidSigns;
|
import net.knarcraft.paidsigns.PaidSigns;
|
||||||
import net.knarcraft.paidsigns.formatting.StringFormatter;
|
import net.knarcraft.paidsigns.formatting.PaidSignsTranslatableMessage;
|
||||||
import net.knarcraft.paidsigns.formatting.TranslatableMessage;
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.TabExecutor;
|
import org.bukkit.command.TabExecutor;
|
||||||
@ -20,7 +20,7 @@ public class ReloadTabCommand implements TabExecutor {
|
|||||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label,
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label,
|
||||||
@NotNull String[] args) {
|
@NotNull String[] args) {
|
||||||
PaidSigns.getInstance().reload();
|
PaidSigns.getInstance().reload();
|
||||||
sender.sendMessage(StringFormatter.getTranslatedInfoMessage(TranslatableMessage.SUCCESS_RELOADED));
|
StringFormatter.displaySuccessMessage(sender, PaidSignsTranslatableMessage.SUCCESS_RELOADED);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package net.knarcraft.paidsigns.command;
|
package net.knarcraft.paidsigns.command;
|
||||||
|
|
||||||
|
import net.knarcraft.knarlib.formatting.StringFormatter;
|
||||||
import net.knarcraft.paidsigns.PaidSigns;
|
import net.knarcraft.paidsigns.PaidSigns;
|
||||||
import net.knarcraft.paidsigns.container.PaidSign;
|
import net.knarcraft.paidsigns.container.PaidSign;
|
||||||
import net.knarcraft.paidsigns.formatting.StringFormatter;
|
import net.knarcraft.paidsigns.formatting.PaidSignsTranslatableMessage;
|
||||||
import net.knarcraft.paidsigns.formatting.TranslatableMessage;
|
|
||||||
import net.knarcraft.paidsigns.manager.PaidSignManager;
|
import net.knarcraft.paidsigns.manager.PaidSignManager;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -28,23 +28,24 @@ public class RemoveConditionCommand extends TokenizedCommand {
|
|||||||
try {
|
try {
|
||||||
lineNumber = (short) (Short.parseShort(arguments.get(1)) - 1);
|
lineNumber = (short) (Short.parseShort(arguments.get(1)) - 1);
|
||||||
if (lineNumber < 0 || lineNumber > 3) {
|
if (lineNumber < 0 || lineNumber > 3) {
|
||||||
sender.sendMessage(StringFormatter.getTranslatedErrorMessage(TranslatableMessage.ERROR_INVALID_NUMBER));
|
StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_INVALID_NUMBER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException exception) {
|
} catch (NumberFormatException exception) {
|
||||||
sender.sendMessage(StringFormatter.getTranslatedErrorMessage(TranslatableMessage.ERROR_INVALID_NUMBER));
|
StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_INVALID_NUMBER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PaidSignManager signManager = PaidSigns.getInstance().getSignManager();
|
PaidSignManager signManager = PaidSigns.getInstance().getSignManager();
|
||||||
PaidSign sign = signManager.getPaidSign(name);
|
PaidSign sign = signManager.getPaidSign(name);
|
||||||
if (sign == null) {
|
if (sign == null) {
|
||||||
sender.sendMessage(StringFormatter.getTranslatedErrorMessage(TranslatableMessage.ERROR_PAID_SIGN_NOT_FOUND));
|
StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_PAID_SIGN_NOT_FOUND);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sign.getConditions().containsKey(lineNumber)) {
|
if (!sign.getConditions().containsKey(lineNumber)) {
|
||||||
sender.sendMessage(StringFormatter.replacePlaceholder(StringFormatter.getTranslatedErrorMessage(
|
StringFormatter.displayErrorMessage(sender, StringFormatter.replacePlaceholder(
|
||||||
TranslatableMessage.ERROR_NO_SUCH_CONDITION), "{line}", String.valueOf((lineNumber + 1))));
|
PaidSignsTranslatableMessage.ERROR_NO_SUCH_CONDITION, "{line}",
|
||||||
|
String.valueOf((lineNumber + 1))));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,10 +53,10 @@ public class RemoveConditionCommand extends TokenizedCommand {
|
|||||||
try {
|
try {
|
||||||
signManager.saveSigns();
|
signManager.saveSigns();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
sender.sendMessage(StringFormatter.getTranslatedErrorMessage(TranslatableMessage.ERROR_EXCEPTION_OCCURRED));
|
StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_EXCEPTION_OCCURRED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
sender.sendMessage(StringFormatter.getTranslatedInfoMessage(TranslatableMessage.SUCCESS_REMOVED_CONDITION));
|
StringFormatter.displaySuccessMessage(sender, PaidSignsTranslatableMessage.SUCCESS_REMOVED_CONDITION);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package net.knarcraft.paidsigns.command;
|
package net.knarcraft.paidsigns.command;
|
||||||
|
|
||||||
|
import net.knarcraft.knarlib.util.TabCompletionHelper;
|
||||||
import net.knarcraft.paidsigns.PaidSigns;
|
import net.knarcraft.paidsigns.PaidSigns;
|
||||||
import net.knarcraft.paidsigns.container.PaidSign;
|
import net.knarcraft.paidsigns.container.PaidSign;
|
||||||
import net.knarcraft.paidsigns.utility.TabCompleteHelper;
|
import net.knarcraft.paidsigns.utility.PaidSignsTabCompleteHelper;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@ -28,7 +29,7 @@ public class RemoveConditionTabCompleter extends TokenizedTabCompleter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (argumentSize == 1) {
|
if (argumentSize == 1) {
|
||||||
return TabCompleteHelper.filterMatchingStartsWith(TabCompleteHelper.getPaidSignNames(), arguments.get(0));
|
return TabCompletionHelper.filterMatchingStartsWith(PaidSignsTabCompleteHelper.getPaidSignNames(), arguments.get(0));
|
||||||
} else if (argumentSize == 2) {
|
} else if (argumentSize == 2) {
|
||||||
PaidSign sign = PaidSigns.getInstance().getSignManager().getPaidSign(arguments.get(0));
|
PaidSign sign = PaidSigns.getInstance().getSignManager().getPaidSign(arguments.get(0));
|
||||||
if (sign != null) {
|
if (sign != null) {
|
||||||
@ -36,7 +37,7 @@ public class RemoveConditionTabCompleter extends TokenizedTabCompleter {
|
|||||||
for (Short signLine : sign.getConditions().keySet()) {
|
for (Short signLine : sign.getConditions().keySet()) {
|
||||||
availableConditions.add(String.valueOf(signLine + 1));
|
availableConditions.add(String.valueOf(signLine + 1));
|
||||||
}
|
}
|
||||||
return TabCompleteHelper.filterMatchingStartsWith(availableConditions, arguments.get(1));
|
return TabCompletionHelper.filterMatchingStartsWith(availableConditions, arguments.get(1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
@ -46,7 +47,7 @@ public class RemoveConditionTabCompleter extends TokenizedTabCompleter {
|
|||||||
* Initializes the values available for tab completion
|
* Initializes the values available for tab completion
|
||||||
*/
|
*/
|
||||||
private void initializeValues() {
|
private void initializeValues() {
|
||||||
lineIndices = TabCompleteHelper.getSignLines();
|
lineIndices = PaidSignsTabCompleteHelper.getSignLines();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package net.knarcraft.paidsigns.command;
|
package net.knarcraft.paidsigns.command;
|
||||||
|
|
||||||
|
import net.knarcraft.knarlib.formatting.StringFormatter;
|
||||||
import net.knarcraft.paidsigns.PaidSigns;
|
import net.knarcraft.paidsigns.PaidSigns;
|
||||||
import net.knarcraft.paidsigns.formatting.StringFormatter;
|
import net.knarcraft.paidsigns.formatting.PaidSignsTranslatableMessage;
|
||||||
import net.knarcraft.paidsigns.formatting.TranslatableMessage;
|
import net.knarcraft.paidsigns.utility.PaidSignsTabCompleteHelper;
|
||||||
import net.knarcraft.paidsigns.utility.TabCompleteHelper;
|
|
||||||
import net.knarcraft.paidsigns.utility.Tokenizer;
|
import net.knarcraft.paidsigns.utility.Tokenizer;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -31,15 +31,13 @@ public class RemoveTabCommand implements TabExecutor {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if (PaidSigns.getInstance().getSignManager().removePaidSign(name)) {
|
if (PaidSigns.getInstance().getSignManager().removePaidSign(name)) {
|
||||||
sender.sendMessage(StringFormatter.getTranslatedInfoMessage(
|
StringFormatter.displaySuccessMessage(sender, PaidSignsTranslatableMessage.SUCCESS_REMOVED_PAID_SIGN);
|
||||||
TranslatableMessage.SUCCESS_REMOVED_PAID_SIGN));
|
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage(StringFormatter.getTranslatedErrorMessage(
|
StringFormatter.displaySuccessMessage(sender, PaidSignsTranslatableMessage.ERROR_PAID_SIGN_NOT_FOUND);
|
||||||
TranslatableMessage.ERROR_PAID_SIGN_NOT_FOUND));
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
sender.sendMessage(StringFormatter.getTranslatedErrorMessage(TranslatableMessage.ERROR_EXCEPTION_OCCURRED));
|
StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_EXCEPTION_OCCURRED);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -52,7 +50,7 @@ public class RemoveTabCommand implements TabExecutor {
|
|||||||
int argumentSize = args[args.length - 1].isEmpty() ? arguments.size() : arguments.size() - 1;
|
int argumentSize = args[args.length - 1].isEmpty() ? arguments.size() : arguments.size() - 1;
|
||||||
|
|
||||||
if (argumentSize < 1) {
|
if (argumentSize < 1) {
|
||||||
return TabCompleteHelper.getPaidSignNames();
|
return PaidSignsTabCompleteHelper.getPaidSignNames();
|
||||||
} else {
|
} else {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package net.knarcraft.paidsigns.command;
|
package net.knarcraft.paidsigns.command;
|
||||||
|
|
||||||
import net.knarcraft.paidsigns.formatting.StringFormatter;
|
import net.knarcraft.knarlib.formatting.StringFormatter;
|
||||||
import net.knarcraft.paidsigns.formatting.TranslatableMessage;
|
import net.knarcraft.paidsigns.formatting.PaidSignsTranslatableMessage;
|
||||||
import net.knarcraft.paidsigns.utility.Tokenizer;
|
import net.knarcraft.paidsigns.utility.Tokenizer;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
@ -39,8 +39,7 @@ public class TokenizedCommand implements CommandExecutor {
|
|||||||
Pattern.compile(regularExpression);
|
Pattern.compile(regularExpression);
|
||||||
return false;
|
return false;
|
||||||
} catch (PatternSyntaxException exception) {
|
} catch (PatternSyntaxException exception) {
|
||||||
sender.sendMessage(StringFormatter.getTranslatedErrorMessage(
|
StringFormatter.displayErrorMessage(sender, PaidSignsTranslatableMessage.ERROR_INVALID_REGULAR_EXPRESSION);
|
||||||
TranslatableMessage.ERROR_INVALID_REGULAR_EXPRESSION));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package net.knarcraft.paidsigns.container;
|
package net.knarcraft.paidsigns.container;
|
||||||
|
|
||||||
import net.knarcraft.paidsigns.utility.ColorHelper;
|
import net.knarcraft.knarlib.property.ColorConversion;
|
||||||
|
import net.knarcraft.knarlib.util.ColorHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A condition for deciding if a paid sign matches a sign line
|
* A condition for deciding if a paid sign matches a sign line
|
||||||
@ -23,8 +24,8 @@ public record PaidSignCondition(String stringToMatch, boolean executeRegex, bool
|
|||||||
String stringToMatch = this.stringToMatch;
|
String stringToMatch = this.stringToMatch;
|
||||||
//Strip color codes if they shouldn't matter
|
//Strip color codes if they shouldn't matter
|
||||||
if (this.ignoreColor) {
|
if (this.ignoreColor) {
|
||||||
stringToMatch = ColorHelper.stripColorCodes(stringToMatch);
|
stringToMatch = ColorHelper.stripColorCodes(stringToMatch, ColorConversion.NORMAL);
|
||||||
line = ColorHelper.stripColorCodes(line);
|
line = ColorHelper.stripColorCodes(line, ColorConversion.NORMAL);
|
||||||
}
|
}
|
||||||
if (this.executeRegex) {
|
if (this.executeRegex) {
|
||||||
//Match using RegEx
|
//Match using RegEx
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
package net.knarcraft.paidsigns.formatting;
|
package net.knarcraft.paidsigns.formatting;
|
||||||
|
|
||||||
|
import net.knarcraft.knarlib.formatting.TranslatableMessage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An enum representing all translatable messages
|
* An enum representing all translatable messages
|
||||||
*/
|
*/
|
||||||
public enum TranslatableMessage {
|
public enum PaidSignsTranslatableMessage implements TranslatableMessage {
|
||||||
|
|
||||||
/**
|
|
||||||
* The prefix to display in messages
|
|
||||||
*/
|
|
||||||
PREFIX,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The message to display when a paid sign is successfully added
|
* The message to display when a paid sign is successfully added
|
||||||
@ -139,5 +136,10 @@ public enum TranslatableMessage {
|
|||||||
* The error to display if an invalid property is given to the edit command
|
* The error to display if an invalid property is given to the edit command
|
||||||
*/
|
*/
|
||||||
ERROR_PROPERTY_NOT_RECOGNIZED,
|
ERROR_PROPERTY_NOT_RECOGNIZED,
|
||||||
|
;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TranslatableMessage[] getAllMessages() {
|
||||||
|
return PaidSignsTranslatableMessage.values();
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,125 +0,0 @@
|
|||||||
package net.knarcraft.paidsigns.formatting;
|
|
||||||
|
|
||||||
import net.md_5.bungee.api.ChatColor;
|
|
||||||
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A formatter for formatting displayed messages
|
|
||||||
*/
|
|
||||||
public final class StringFormatter {
|
|
||||||
|
|
||||||
private StringFormatter() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Translates the given boolean value
|
|
||||||
*
|
|
||||||
* @param booleanValue <p>The boolean value to translate</p>
|
|
||||||
* @return <p>The translation of the boolean value</p>
|
|
||||||
*/
|
|
||||||
public static String translateBoolean(boolean booleanValue) {
|
|
||||||
if (booleanValue) {
|
|
||||||
return Translator.getTranslatedMessage(TranslatableMessage.BOOLEAN_TRUE);
|
|
||||||
} else {
|
|
||||||
return Translator.getTranslatedMessage(TranslatableMessage.BOOLEAN_FALSE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Replaces a placeholder in a string
|
|
||||||
*
|
|
||||||
* @param input <p>The input string to replace in</p>
|
|
||||||
* @param placeholder <p>The placeholder to replace</p>
|
|
||||||
* @param replacement <p>The replacement value</p>
|
|
||||||
* @return <p>The input string with the placeholder replaced</p>
|
|
||||||
*/
|
|
||||||
public static String replacePlaceholder(String input, String placeholder, String replacement) {
|
|
||||||
return input.replace(placeholder, replacement);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Replaces placeholders in a string
|
|
||||||
*
|
|
||||||
* @param input <p>The input string to replace in</p>
|
|
||||||
* @param placeholders <p>The placeholders to replace</p>
|
|
||||||
* @param replacements <p>The replacement values</p>
|
|
||||||
* @return <p>The input string with placeholders replaced</p>
|
|
||||||
*/
|
|
||||||
public static String replacePlaceholders(String input, String[] placeholders, String[] replacements) {
|
|
||||||
for (int i = 0; i < Math.min(placeholders.length, replacements.length); i++) {
|
|
||||||
input = replacePlaceholder(input, placeholders[i], replacements[i]);
|
|
||||||
}
|
|
||||||
return input;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets a translated and formatted info message
|
|
||||||
*
|
|
||||||
* @param translatableMessage <p>The translatable message to translate and format</p>
|
|
||||||
* @return <p>The translated and formatted message</p>
|
|
||||||
*/
|
|
||||||
public static String getTranslatedInfoMessage(TranslatableMessage translatableMessage) {
|
|
||||||
return formatInfoMessage(Translator.getTranslatedMessage(translatableMessage));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets a translated and formatted error message
|
|
||||||
*
|
|
||||||
* @param translatableMessage <p>The translatable message to translate and format</p>
|
|
||||||
* @return <p>The translated and formatted message</p>
|
|
||||||
*/
|
|
||||||
public static String getTranslatedErrorMessage(TranslatableMessage translatableMessage) {
|
|
||||||
return formatErrorMessage(Translator.getTranslatedMessage(translatableMessage));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Formats an information message by adding the prefix and text color
|
|
||||||
*
|
|
||||||
* @param message <p>The message to format</p>
|
|
||||||
* @return <p>The formatted message</p>
|
|
||||||
*/
|
|
||||||
public static String formatInfoMessage(String message) {
|
|
||||||
return ChatColor.DARK_GREEN + formatMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Formats an error message by adding the prefix and text color
|
|
||||||
*
|
|
||||||
* @param message <p>The message to format</p>
|
|
||||||
* @return <p>The formatted message</p>
|
|
||||||
*/
|
|
||||||
public static String formatErrorMessage(String message) {
|
|
||||||
return ChatColor.DARK_RED + formatMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Translates all found color codes to formatting in a string
|
|
||||||
*
|
|
||||||
* @param message <p>The string to search for color codes</p>
|
|
||||||
* @return <p>The message with color codes translated</p>
|
|
||||||
*/
|
|
||||||
public static String translateAllColorCodes(String message) {
|
|
||||||
message = ChatColor.translateAlternateColorCodes('&', message);
|
|
||||||
Pattern pattern = Pattern.compile("(#[a-fA-F0-9]{6})");
|
|
||||||
Matcher matcher = pattern.matcher(message);
|
|
||||||
while (matcher.find()) {
|
|
||||||
message = message.replace(matcher.group(), "" + ChatColor.of(matcher.group()));
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Formats a message by adding the prefix and text color
|
|
||||||
*
|
|
||||||
* @param message <p>The message to format</p>
|
|
||||||
* @return <p>The formatted message</p>
|
|
||||||
*/
|
|
||||||
private static String formatMessage(String message) {
|
|
||||||
return Translator.getTranslatedMessage(TranslatableMessage.PREFIX) + " " +
|
|
||||||
ChatColor.RESET + message;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,118 +0,0 @@
|
|||||||
package net.knarcraft.paidsigns.formatting;
|
|
||||||
|
|
||||||
import net.knarcraft.paidsigns.PaidSigns;
|
|
||||||
import net.knarcraft.paidsigns.utility.FileHelper;
|
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A tool to get strings translated to the correct language
|
|
||||||
*/
|
|
||||||
public final class Translator {
|
|
||||||
|
|
||||||
private static Map<TranslatableMessage, String> translatedMessages;
|
|
||||||
private static Map<TranslatableMessage, String> backupTranslatedMessages;
|
|
||||||
|
|
||||||
private Translator() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Loads the languages used by this translator
|
|
||||||
*/
|
|
||||||
public static void loadLanguages(String selectedLanguage) {
|
|
||||||
backupTranslatedMessages = loadTranslatedMessages("en");
|
|
||||||
translatedMessages = loadCustomTranslatedMessages(selectedLanguage);
|
|
||||||
if (translatedMessages == null) {
|
|
||||||
translatedMessages = loadTranslatedMessages(selectedLanguage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets a translated version of the given translatable message
|
|
||||||
*
|
|
||||||
* @param translatableMessage <p>The message to translate</p>
|
|
||||||
* @return <p>The translated message</p>
|
|
||||||
*/
|
|
||||||
public static String getTranslatedMessage(TranslatableMessage translatableMessage) {
|
|
||||||
if (translatedMessages == null) {
|
|
||||||
return "Translated strings not loaded";
|
|
||||||
}
|
|
||||||
String translatedMessage;
|
|
||||||
if (translatedMessages.containsKey(translatableMessage)) {
|
|
||||||
translatedMessage = translatedMessages.get(translatableMessage);
|
|
||||||
} else if (backupTranslatedMessages.containsKey(translatableMessage)) {
|
|
||||||
translatedMessage = backupTranslatedMessages.get(translatableMessage);
|
|
||||||
} else {
|
|
||||||
translatedMessage = translatableMessage.toString();
|
|
||||||
}
|
|
||||||
return StringFormatter.translateAllColorCodes(translatedMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Loads all translated messages for the given language
|
|
||||||
*
|
|
||||||
* @param language <p>The language chosen by the user</p>
|
|
||||||
* @return <p>A mapping of all strings for the given language</p>
|
|
||||||
*/
|
|
||||||
public static Map<TranslatableMessage, String> loadTranslatedMessages(String language) {
|
|
||||||
try {
|
|
||||||
BufferedReader reader = FileHelper.getBufferedReaderForInternalFile("/strings.yml");
|
|
||||||
return loadTranslatableMessages(language, reader);
|
|
||||||
} catch (FileNotFoundException e) {
|
|
||||||
PaidSigns.getInstance().getLogger().log(Level.SEVERE, "Unable to load translated messages");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tries to load translated messages from a custom strings.yml file
|
|
||||||
*
|
|
||||||
* @param language <p>The selected language</p>
|
|
||||||
* @return <p>The loaded translated strings, or null if no custom language file exists</p>
|
|
||||||
*/
|
|
||||||
public static Map<TranslatableMessage, String> loadCustomTranslatedMessages(String language) {
|
|
||||||
File strings = new File(PaidSigns.getInstance().getDataFolder(), "strings.yml");
|
|
||||||
if (!strings.exists()) {
|
|
||||||
PaidSigns.getInstance().getLogger().log(Level.FINEST, "Strings file not found");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
PaidSigns.getInstance().getLogger().log(Level.INFO, "Loading custom strings...");
|
|
||||||
return loadTranslatableMessages(language, new BufferedReader(new InputStreamReader(new FileInputStream(strings))));
|
|
||||||
} catch (FileNotFoundException e) {
|
|
||||||
PaidSigns.getInstance().getLogger().log(Level.WARNING, "Unable to load custom messages");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Loads translatable messages from the given reader
|
|
||||||
*
|
|
||||||
* @param language <p>The selected language</p>
|
|
||||||
* @param reader <p>The buffered reader to read from</p>
|
|
||||||
* @return <p>The loaded translated strings</p>
|
|
||||||
*/
|
|
||||||
private static Map<TranslatableMessage, String> loadTranslatableMessages(String language, BufferedReader reader) {
|
|
||||||
Map<TranslatableMessage, String> translatedMessages = new HashMap<>();
|
|
||||||
YamlConfiguration configuration = YamlConfiguration.loadConfiguration(reader);
|
|
||||||
|
|
||||||
for (TranslatableMessage message : TranslatableMessage.values()) {
|
|
||||||
String translated = configuration.getString(language + "." + message.toString());
|
|
||||||
if (translated != null) {
|
|
||||||
translatedMessages.put(message, translated);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return translatedMessages;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,10 +1,11 @@
|
|||||||
package net.knarcraft.paidsigns.listener;
|
package net.knarcraft.paidsigns.listener;
|
||||||
|
|
||||||
|
import net.knarcraft.knarlib.formatting.StringFormatter;
|
||||||
|
import net.knarcraft.knarlib.formatting.TranslatableMessage;
|
||||||
import net.knarcraft.paidsigns.PaidSigns;
|
import net.knarcraft.paidsigns.PaidSigns;
|
||||||
import net.knarcraft.paidsigns.container.PaidSign;
|
import net.knarcraft.paidsigns.container.PaidSign;
|
||||||
import net.knarcraft.paidsigns.container.PaidSignConditionMatch;
|
import net.knarcraft.paidsigns.container.PaidSignConditionMatch;
|
||||||
import net.knarcraft.paidsigns.formatting.StringFormatter;
|
import net.knarcraft.paidsigns.formatting.PaidSignsTranslatableMessage;
|
||||||
import net.knarcraft.paidsigns.formatting.TranslatableMessage;
|
|
||||||
import net.knarcraft.paidsigns.manager.EconomyManager;
|
import net.knarcraft.paidsigns.manager.EconomyManager;
|
||||||
import net.knarcraft.paidsigns.manager.TrackedSignManager;
|
import net.knarcraft.paidsigns.manager.TrackedSignManager;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -129,13 +130,11 @@ public class SignListener implements Listener {
|
|||||||
double cost = paidSign.getCost();
|
double cost = paidSign.getCost();
|
||||||
boolean canAfford = EconomyManager.canAfford(player, cost);
|
boolean canAfford = EconomyManager.canAfford(player, cost);
|
||||||
if (!canAfford) {
|
if (!canAfford) {
|
||||||
player.sendMessage(replaceCost(cost, StringFormatter.getTranslatedErrorMessage(
|
StringFormatter.displayErrorMessage(player, replaceCost(cost, PaidSignsTranslatableMessage.ERROR_CANNOT_AFFORD));
|
||||||
TranslatableMessage.ERROR_CANNOT_AFFORD)));
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
} else {
|
} else {
|
||||||
EconomyManager.withdraw(player, cost);
|
EconomyManager.withdraw(player, cost);
|
||||||
player.sendMessage(replaceCost(cost, StringFormatter.getTranslatedInfoMessage(
|
StringFormatter.displaySuccessMessage(player, replaceCost(cost, PaidSignsTranslatableMessage.SUCCESS_PAID_FOR_SIGN));
|
||||||
TranslatableMessage.SUCCESS_PAID_FOR_SIGN)));
|
|
||||||
try {
|
try {
|
||||||
TrackedSignManager.addTrackedSign(event.getBlock().getLocation(), player.getUniqueId(), cost);
|
TrackedSignManager.addTrackedSign(event.getBlock().getLocation(), player.getUniqueId(), cost);
|
||||||
} catch (IOException ignored) {
|
} catch (IOException ignored) {
|
||||||
@ -150,7 +149,7 @@ public class SignListener implements Listener {
|
|||||||
* @param message <p>The original message to replace the cost placeholder for</p>
|
* @param message <p>The original message to replace the cost placeholder for</p>
|
||||||
* @return <p>The message with the cost instead of the cost placeholder</p>
|
* @return <p>The message with the cost instead of the cost placeholder</p>
|
||||||
*/
|
*/
|
||||||
private String replaceCost(double cost, String message) {
|
private String replaceCost(double cost, TranslatableMessage message) {
|
||||||
String unit = EconomyManager.getCurrency(cost != 1);
|
String unit = EconomyManager.getCurrency(cost != 1);
|
||||||
return String.format(StringFormatter.replacePlaceholders(message, new String[]{"{cost}", "{unit}"},
|
return String.format(StringFormatter.replacePlaceholders(message, new String[]{"{cost}", "{unit}"},
|
||||||
new String[]{"%.2f", "%s"}), cost, unit);
|
new String[]{"%.2f", "%s"}), cost, unit);
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package net.knarcraft.paidsigns.manager;
|
package net.knarcraft.paidsigns.manager;
|
||||||
|
|
||||||
|
import net.knarcraft.knarlib.formatting.StringFormatter;
|
||||||
import net.knarcraft.paidsigns.PaidSigns;
|
import net.knarcraft.paidsigns.PaidSigns;
|
||||||
import net.knarcraft.paidsigns.container.TrackedSign;
|
import net.knarcraft.paidsigns.container.TrackedSign;
|
||||||
import net.knarcraft.paidsigns.formatting.StringFormatter;
|
import net.knarcraft.paidsigns.formatting.PaidSignsTranslatableMessage;
|
||||||
import net.knarcraft.paidsigns.formatting.TranslatableMessage;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
@ -155,10 +155,9 @@ public final class TrackedSignManager {
|
|||||||
double refundSum = trackedSign.cost() / 100 * PaidSigns.getInstance().getRefundPercentage();
|
double refundSum = trackedSign.cost() / 100 * PaidSigns.getInstance().getRefundPercentage();
|
||||||
EconomyManager.deposit(offlinePlayer, refundSum);
|
EconomyManager.deposit(offlinePlayer, refundSum);
|
||||||
if (offlinePlayer instanceof Player player) {
|
if (offlinePlayer instanceof Player player) {
|
||||||
player.sendMessage(String.format(StringFormatter.replacePlaceholders(
|
StringFormatter.displaySuccessMessage(player, String.format(StringFormatter.replacePlaceholders(
|
||||||
StringFormatter.getTranslatedInfoMessage(TranslatableMessage.SUCCESS_REFUNDED),
|
PaidSignsTranslatableMessage.SUCCESS_REFUNDED, new String[]{"{cost}", "{unit}"},
|
||||||
new String[]{"{cost}", "{unit}"}, new String[]{"%.2f", "%s"}), refundSum,
|
new String[]{"%.2f", "%s"}), refundSum, EconomyManager.getCurrency(refundSum != 1)));
|
||||||
EconomyManager.getCurrency(refundSum != 1)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,43 +0,0 @@
|
|||||||
package net.knarcraft.paidsigns.utility;
|
|
||||||
|
|
||||||
import net.md_5.bungee.api.ChatColor;
|
|
||||||
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A helper class for dealing with colors
|
|
||||||
*/
|
|
||||||
public final class ColorHelper {
|
|
||||||
|
|
||||||
private ColorHelper() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Strips all color codes from the given message
|
|
||||||
*
|
|
||||||
* @param message <p>The message to strip color codes from</p>
|
|
||||||
* @return <p>The message without color codes</p>
|
|
||||||
*/
|
|
||||||
public static String stripColorCodes(String message) {
|
|
||||||
return ChatColor.stripColor(translateAllColorCodes(message));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Translates all found color codes to formatting in a string
|
|
||||||
*
|
|
||||||
* @param message <p>The string to search for color codes</p>
|
|
||||||
* @return <p>The message with color codes translated</p>
|
|
||||||
*/
|
|
||||||
public static String translateAllColorCodes(String message) {
|
|
||||||
message = ChatColor.translateAlternateColorCodes('&', message);
|
|
||||||
Pattern pattern = Pattern.compile("(#[a-fA-F0-9]{6})");
|
|
||||||
Matcher matcher = pattern.matcher(message);
|
|
||||||
while (matcher.find()) {
|
|
||||||
message = message.replace(matcher.group(), "" + ChatColor.of(matcher.group()));
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,32 +0,0 @@
|
|||||||
package net.knarcraft.paidsigns.utility;
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A helper class for dealing with files
|
|
||||||
*/
|
|
||||||
public final class FileHelper {
|
|
||||||
|
|
||||||
private FileHelper() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets a buffered reader for
|
|
||||||
*
|
|
||||||
* @return <p>A buffered read for reading the file</p>
|
|
||||||
* @throws FileNotFoundException <p>If unable to get an input stream for the given file</p>
|
|
||||||
*/
|
|
||||||
public static BufferedReader getBufferedReaderForInternalFile(String file) throws FileNotFoundException {
|
|
||||||
InputStream inputStream = FileHelper.class.getResourceAsStream(file);
|
|
||||||
if (inputStream == null) {
|
|
||||||
throw new FileNotFoundException("Unable to read the given file");
|
|
||||||
}
|
|
||||||
return new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,9 +1,9 @@
|
|||||||
package net.knarcraft.paidsigns.utility;
|
package net.knarcraft.paidsigns.utility;
|
||||||
|
|
||||||
|
import net.knarcraft.knarlib.util.TabCompletionHelper;
|
||||||
import net.knarcraft.paidsigns.PaidSigns;
|
import net.knarcraft.paidsigns.PaidSigns;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.permissions.Permission;
|
import org.bukkit.permissions.Permission;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -15,36 +15,15 @@ import java.util.StringJoiner;
|
|||||||
/**
|
/**
|
||||||
* A helper class for providing common tab complete options
|
* A helper class for providing common tab complete options
|
||||||
*/
|
*/
|
||||||
public final class TabCompleteHelper {
|
public final class PaidSignsTabCompleteHelper {
|
||||||
|
|
||||||
private static List<String> plugins;
|
private static List<String> plugins;
|
||||||
private static Map<String, List<String>> permissions;
|
private static Map<String, List<String>> permissions;
|
||||||
|
|
||||||
private TabCompleteHelper() {
|
private PaidSignsTabCompleteHelper() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Finds tab complete values that match the start of the typed text
|
|
||||||
*
|
|
||||||
* @param values <p>The values to filter</p>
|
|
||||||
* @param typedText <p>The text the player has started typing</p>
|
|
||||||
* @return <p>The given string values that start with the player's typed text</p>
|
|
||||||
*/
|
|
||||||
public static List<String> filterMatchingStartsWith(@NotNull List<String> values, String typedText) {
|
|
||||||
//This little trick makes sure tab-completion works for paid sign names
|
|
||||||
if (!values.isEmpty() && values.get(0).startsWith("\"")) {
|
|
||||||
typedText = "\"" + typedText;
|
|
||||||
}
|
|
||||||
List<String> configValues = new ArrayList<>();
|
|
||||||
for (String value : values) {
|
|
||||||
if (value.toLowerCase().startsWith(typedText.toLowerCase())) {
|
|
||||||
configValues.add(value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return configValues;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the available boolean values for tab completion
|
* Gets the available boolean values for tab completion
|
||||||
*
|
*
|
||||||
@ -152,7 +131,7 @@ public final class TabCompleteHelper {
|
|||||||
output = new ArrayList<>();
|
output = new ArrayList<>();
|
||||||
} else {
|
} else {
|
||||||
//Filter by the typed text
|
//Filter by the typed text
|
||||||
output = TabCompleteHelper.filterMatchingStartsWith(matchingPermissions, typedNode);
|
output = TabCompletionHelper.filterMatchingStartsWith(matchingPermissions, typedNode);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
output = plugins;
|
output = plugins;
|
@ -1,5 +1,4 @@
|
|||||||
en:
|
en:
|
||||||
PREFIX: "[PaidSigns]"
|
|
||||||
SUCCESS_ADDED_PAID_SIGN: "&bSuccessfully added new paid sign"
|
SUCCESS_ADDED_PAID_SIGN: "&bSuccessfully added new paid sign"
|
||||||
SUCCESS_ADDED_PAID_SIGN_CONDITION: "&bSuccessfully added new paid sign condition"
|
SUCCESS_ADDED_PAID_SIGN_CONDITION: "&bSuccessfully added new paid sign condition"
|
||||||
SUCCESS_UPDATED_PAID_SIGN: "&bSuccessfully updated the paid sign property"
|
SUCCESS_UPDATED_PAID_SIGN: "&bSuccessfully updated the paid sign property"
|
||||||
|
Loading…
Reference in New Issue
Block a user