Optimize the sign feature

This commit is contained in:
sandtechnology committed 2021-07-10 22:18:25 +08:00
1 parent 34036648cc
commit 0ce203fa56
2 files changed
+15 -11

No files matched your search

@@ -676,12 +676,6 @@ public class ContainerShop implements Shop {
public void setSignText(@NotNull String[] lines) {
Util.ensureThread(false);
List<Sign> signs = this.getSigns();
boolean signGlowing = plugin.getConfig().getBoolean("shop.sign-glowing");
DyeColor dyeColor = null;
try {
dyeColor = DyeColor.valueOf(plugin.getConfig().getString("shop.sign-dye-color"));
} catch (Exception ignored) {
}
for (Sign sign : signs) {
if (Arrays.equals(sign.getLines(), lines)) {
continue;
@@ -689,11 +683,15 @@ public class ContainerShop implements Shop {
for (int i = 0; i < lines.length; i++) {
sign.setLine(i, lines[i]);
}
if (plugin.getGameVersion().isSignTextDyeSupport() && dyeColor != null) {
sign.setColor(dyeColor);
if (plugin.getGameVersion().isSignTextDyeSupport()) {
DyeColor dyeColor = Util.getDyeColor();
if (dyeColor != null) {
sign.setColor(dyeColor);
}
}
if (signGlowing && plugin.getGameVersion().isSignGlowingSupport()) {
sign.setGlowingText(true);
if (plugin.getGameVersion().isSignGlowingSupport()) {
boolean isGlowing = plugin.getConfig().getBoolean("shop.sign-glowing");
sign.setGlowingText(isGlowing);
}
sign.update(true);
plugin.getServer().getPluginManager().callEvent(new ShopSignUpdateEvent(this, sign));
@@ -84,6 +84,9 @@ public class Util {
private static List<String> worldBlacklist = new ArrayList<>(5);
@Getter
private static boolean disableDebugLogger = false;
@Getter
@Nullable
private static DyeColor dyeColor = null;
private static boolean currencySymbolOnRight;
private static String alternateCurrencySymbol;
private static boolean disableVaultFormat;
@@ -675,7 +678,10 @@ public class Util {
}
worldBlacklist = plugin.getConfig().getStringList("shop.blacklist-world");
disableDebugLogger = plugin.getConfig().getBoolean("debug.disable-debuglogger", false);
try {
dyeColor = DyeColor.valueOf(plugin.getConfig().getString("shop.sign-dye-color"));
} catch (Exception ignored) {
}
currencySymbolOnRight = plugin.getConfig().getBoolean("shop.currency-symbol-on-right", false);
alternateCurrencySymbol = plugin.getConfig().getString("shop.alternate-currency-symbol", "$");
disableVaultFormat = plugin.getConfig().getBoolean("shop.disable-vault-format", false);