diff --git a/api/src/main/java/net/momirealms/customnameplates/api/storage/StorageType.java b/api/src/main/java/net/momirealms/customnameplates/api/storage/StorageType.java index ae3b776..db6aa0e 100644 --- a/api/src/main/java/net/momirealms/customnameplates/api/storage/StorageType.java +++ b/api/src/main/java/net/momirealms/customnameplates/api/storage/StorageType.java @@ -21,10 +21,10 @@ public enum StorageType { JSON, YAML, H2, - SQLite, - MySQL, - MariaDB, - MongoDB, + SQLITE, + MYSQL, + MARIADB, + MONGODB, Redis, NONE } diff --git a/backend/src/main/java/net/momirealms/customnameplates/backend/placeholder/PlaceholderManagerImpl.java b/backend/src/main/java/net/momirealms/customnameplates/backend/placeholder/PlaceholderManagerImpl.java index 2c47760..50e30f2 100644 --- a/backend/src/main/java/net/momirealms/customnameplates/backend/placeholder/PlaceholderManagerImpl.java +++ b/backend/src/main/java/net/momirealms/customnameplates/backend/placeholder/PlaceholderManagerImpl.java @@ -303,13 +303,13 @@ public class PlaceholderManagerImpl implements PlaceholderManager { Image empty = requireNonNull(plugin.getImageManager().imageById(inner.getString("images.empty")), "image.empty should not be null"); Image half = requireNonNull(plugin.getImageManager().imageById(inner.getString("images.half")), "image.half should not be null"); Image full = requireNonNull(plugin.getImageManager().imageById(inner.getString("images.full")), "image.full should not be null"); - String currentValue = section.getString("placeholder.value", "1"); - String maxValue = section.getString("placeholder.max-value", currentValue); + String currentValue = inner.getString("placeholder.value", "1"); + String maxValue = inner.getString("placeholder.max-value", currentValue); VanillaHud vanillaHud = new VanillaHud(empty, half, full, reverse, currentValue, maxValue); List list = List.of(vanillaHud.getCurrent(), vanillaHud.getMax()); Placeholder placeholder1 = registerSharedPlaceholder("%shared_np_vanilla_" + id + "%", vanillaHud::create); Placeholder placeholder2 = registerPlayerPlaceholder("%np_vanilla_" + id + "%", vanillaHud::create); - Placeholder placeholder3 = registerRelationalPlaceholder("%np_vanilla_" + id + "%", vanillaHud::create); + Placeholder placeholder3 = registerRelationalPlaceholder("%rel_np_vanilla_" + id + "%", vanillaHud::create); childrenText.put(placeholder1, list); childrenText.put(placeholder2, list); childrenText.put(placeholder3, list); diff --git a/backend/src/main/java/net/momirealms/customnameplates/backend/storage/StorageManagerImpl.java b/backend/src/main/java/net/momirealms/customnameplates/backend/storage/StorageManagerImpl.java index 216bfb7..85d95f9 100644 --- a/backend/src/main/java/net/momirealms/customnameplates/backend/storage/StorageManagerImpl.java +++ b/backend/src/main/java/net/momirealms/customnameplates/backend/storage/StorageManagerImpl.java @@ -27,6 +27,7 @@ import org.jetbrains.annotations.NotNull; import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; +import java.util.Locale; import java.util.UUID; import java.util.concurrent.Executor; @@ -111,7 +112,7 @@ public class StorageManagerImpl implements StorageManager, JoinQuitListener { throw new RuntimeException(e); } // Check if storage type has changed and reinitialize if necessary - StorageType storageType = StorageType.valueOf(config.getString("data-storage-method", "H2")); + StorageType storageType = StorageType.valueOf(config.getString("data-storage-method", "H2").toUpperCase(Locale.ENGLISH)); if (storageType != previousType) { if (this.dataSource != null) this.dataSource.disable(); this.previousType = storageType; @@ -119,10 +120,10 @@ public class StorageManagerImpl implements StorageManager, JoinQuitListener { case H2 -> this.dataSource = new H2Provider(plugin); case JSON -> this.dataSource = new JsonProvider(plugin); case YAML -> this.dataSource = new YAMLProvider(plugin); - case SQLite -> this.dataSource = new SQLiteProvider(plugin); - case MySQL -> this.dataSource = new MySQLProvider(plugin); - case MariaDB -> this.dataSource = new MariaDBProvider(plugin); - case MongoDB -> this.dataSource = new MongoDBProvider(plugin); + case SQLITE -> this.dataSource = new SQLiteProvider(plugin); + case MYSQL -> this.dataSource = new MySQLProvider(plugin); + case MARIADB -> this.dataSource = new MariaDBProvider(plugin); + case MONGODB -> this.dataSource = new MongoDBProvider(plugin); case NONE -> this.dataSource = new DummyStorage(plugin); } if (this.dataSource != null) this.dataSource.initialize(config); diff --git a/backend/src/main/java/net/momirealms/customnameplates/backend/storage/method/database/nosql/MongoDBProvider.java b/backend/src/main/java/net/momirealms/customnameplates/backend/storage/method/database/nosql/MongoDBProvider.java index 996a57c..678f054 100644 --- a/backend/src/main/java/net/momirealms/customnameplates/backend/storage/method/database/nosql/MongoDBProvider.java +++ b/backend/src/main/java/net/momirealms/customnameplates/backend/storage/method/database/nosql/MongoDBProvider.java @@ -94,7 +94,7 @@ public class MongoDBProvider extends AbstractStorage { @Override public StorageType storageType() { - return StorageType.MongoDB; + return StorageType.MONGODB; } @Override diff --git a/backend/src/main/java/net/momirealms/customnameplates/backend/storage/method/database/sql/AbstractHikariDatabase.java b/backend/src/main/java/net/momirealms/customnameplates/backend/storage/method/database/sql/AbstractHikariDatabase.java index 7cff7b0..075421b 100644 --- a/backend/src/main/java/net/momirealms/customnameplates/backend/storage/method/database/sql/AbstractHikariDatabase.java +++ b/backend/src/main/java/net/momirealms/customnameplates/backend/storage/method/database/sql/AbstractHikariDatabase.java @@ -21,14 +21,14 @@ public abstract class AbstractHikariDatabase extends AbstractSQLDatabase { public AbstractHikariDatabase(CustomNameplates plugin) { super(plugin); - this.driverClass = storageType() == StorageType.MariaDB ? "org.mariadb.jdbc.Driver" : "com.mysql.cj.jdbc.Driver"; - this.sqlBrand = storageType() == StorageType.MariaDB ? "MariaDB" : "MySQL"; + this.driverClass = storageType() == StorageType.MARIADB ? "org.mariadb.jdbc.Driver" : "com.mysql.cj.jdbc.Driver"; + this.sqlBrand = storageType() == StorageType.MARIADB ? "MariaDB" : "MySQL"; try { Class.forName(this.driverClass); } catch (ClassNotFoundException e1) { - if (storageType() == StorageType.MariaDB) { + if (storageType() == StorageType.MARIADB) { plugin.getPluginLogger().warn("No MariaDB driver is found"); - } else if (storageType() == StorageType.MySQL) { + } else if (storageType() == StorageType.MYSQL) { try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e2) { diff --git a/backend/src/main/java/net/momirealms/customnameplates/backend/storage/method/database/sql/MariaDBProvider.java b/backend/src/main/java/net/momirealms/customnameplates/backend/storage/method/database/sql/MariaDBProvider.java index 6df2013..a880e3c 100644 --- a/backend/src/main/java/net/momirealms/customnameplates/backend/storage/method/database/sql/MariaDBProvider.java +++ b/backend/src/main/java/net/momirealms/customnameplates/backend/storage/method/database/sql/MariaDBProvider.java @@ -11,6 +11,6 @@ public class MariaDBProvider extends AbstractHikariDatabase { @Override public StorageType storageType() { - return StorageType.MariaDB; + return StorageType.MARIADB; } } diff --git a/backend/src/main/java/net/momirealms/customnameplates/backend/storage/method/database/sql/MySQLProvider.java b/backend/src/main/java/net/momirealms/customnameplates/backend/storage/method/database/sql/MySQLProvider.java index d408368..76dd699 100644 --- a/backend/src/main/java/net/momirealms/customnameplates/backend/storage/method/database/sql/MySQLProvider.java +++ b/backend/src/main/java/net/momirealms/customnameplates/backend/storage/method/database/sql/MySQLProvider.java @@ -11,6 +11,6 @@ public class MySQLProvider extends AbstractHikariDatabase { @Override public StorageType storageType() { - return StorageType.MySQL; + return StorageType.MYSQL; } } diff --git a/backend/src/main/java/net/momirealms/customnameplates/backend/storage/method/database/sql/SQLiteProvider.java b/backend/src/main/java/net/momirealms/customnameplates/backend/storage/method/database/sql/SQLiteProvider.java index 0d15da9..1bbcc72 100644 --- a/backend/src/main/java/net/momirealms/customnameplates/backend/storage/method/database/sql/SQLiteProvider.java +++ b/backend/src/main/java/net/momirealms/customnameplates/backend/storage/method/database/sql/SQLiteProvider.java @@ -63,7 +63,7 @@ public class SQLiteProvider extends AbstractSQLDatabase { @Override public StorageType storageType() { - return StorageType.SQLite; + return StorageType.SQLITE; } /** diff --git a/backend/src/main/resources/config.yml b/backend/src/main/resources/config.yml index 213945d..762bcee 100644 --- a/backend/src/main/resources/config.yml +++ b/backend/src/main/resources/config.yml @@ -88,7 +88,7 @@ other-settings: default-condition-refresh-interval: 1 # Set the default placeholder refresh interval default-placeholder-refresh-interval: 1 - # Set the refresh interval for better performance in ticks (Especially for those heavy placeholders) + # Set the refresh interval for better performance (Especially for those heavy placeholders) placeholder-refresh-interval: "%player_name%": 100 "%vault_prefix%": 1 diff --git a/backend/src/main/resources/configs/bossbar.yml b/backend/src/main/resources/configs/bossbar.yml index eb97057..42aeae3 100644 --- a/backend/src/main/resources/configs/bossbar.yml +++ b/backend/src/main/resources/configs/bossbar.yml @@ -21,8 +21,6 @@ bossbar_1: # Display for 10 seconds duration: 200 text: '%np_background_time% %np_background_location% %np_background_weather%' - # How often to refresh this text, in ticks (1 tick = 1/20 of a second) - refresh-frequency: 1 3: # Show for 5 seconds duration: 100 diff --git a/backend/src/main/resources/configs/custom-placeholders.yml b/backend/src/main/resources/configs/custom-placeholders.yml index 5309115..6ba3f53 100644 --- a/backend/src/main/resources/configs/custom-placeholders.yml +++ b/backend/src/main/resources/configs/custom-placeholders.yml @@ -34,6 +34,14 @@ conditional-text: weather: - thunder +# https://mo-mi.gitbook.io/xiaomomi-plugins/plugin-wiki/customnameplates/custom-placeholders/bubble-text +bubble-text: + chat: + bubble: chat_1 + text: 'Nice to meet you!' + left-margin: 1 + right-margin: 1 + # https://mo-mi.gitbook.io/xiaomomi-plugins/plugin-wiki/customnameplates/custom-placeholders/nameplate-text nameplate-text: halloween: diff --git a/backend/src/main/resources/contents/images/bell.yml b/backend/src/main/resources/contents/images/bell.yml index 3c56bfd..bdf645e 100644 --- a/backend/src/main/resources/contents/images/bell.yml +++ b/backend/src/main/resources/contents/images/bell.yml @@ -1,6 +1,3 @@ image: bell height: 10 -ascent: 4 -shadow: - remove: true - opacity: 254 \ No newline at end of file +ascent: 4 \ No newline at end of file diff --git a/backend/src/main/resources/contents/images/bubble.yml b/backend/src/main/resources/contents/images/bubble.yml index 5f6dc46..fd9f8f3 100644 --- a/backend/src/main/resources/contents/images/bubble.yml +++ b/backend/src/main/resources/contents/images/bubble.yml @@ -1,6 +1,3 @@ image: bubble height: 10 -ascent: 4 -shadow: - remove: true - opacity: 254 \ No newline at end of file +ascent: 4 \ No newline at end of file diff --git a/backend/src/main/resources/contents/images/clock.yml b/backend/src/main/resources/contents/images/clock.yml index 42a821c..89d0e28 100644 --- a/backend/src/main/resources/contents/images/clock.yml +++ b/backend/src/main/resources/contents/images/clock.yml @@ -1,6 +1,3 @@ image: clock height: 10 -ascent: 4 -shadow: - remove: true - opacity: 254 \ No newline at end of file +ascent: 4 \ No newline at end of file diff --git a/backend/src/main/resources/contents/images/coin.yml b/backend/src/main/resources/contents/images/coin.yml index 848fd60..7ab3460 100644 --- a/backend/src/main/resources/contents/images/coin.yml +++ b/backend/src/main/resources/contents/images/coin.yml @@ -1,6 +1,3 @@ image: coin height: 10 -ascent: -14 -shadow: - remove: true - opacity: 254 \ No newline at end of file +ascent: -14 \ No newline at end of file diff --git a/backend/src/main/resources/contents/images/compass.yml b/backend/src/main/resources/contents/images/compass.yml index c50db32..9acdf75 100644 --- a/backend/src/main/resources/contents/images/compass.yml +++ b/backend/src/main/resources/contents/images/compass.yml @@ -1,6 +1,3 @@ image: compass height: 10 -ascent: 4 -shadow: - remove: true - opacity: 254 \ No newline at end of file +ascent: 4 \ No newline at end of file diff --git a/backend/src/main/resources/contents/images/stamina_0.yml b/backend/src/main/resources/contents/images/stamina_0.yml index 3335c3d..b698ede 100644 --- a/backend/src/main/resources/contents/images/stamina_0.yml +++ b/backend/src/main/resources/contents/images/stamina_0.yml @@ -1,6 +1,3 @@ image: stamina_0 height: 9 -ascent: -16 -shadow: - remove: true - opacity: 254 \ No newline at end of file +ascent: -16 \ No newline at end of file diff --git a/backend/src/main/resources/contents/images/stamina_1.yml b/backend/src/main/resources/contents/images/stamina_1.yml index 0cfb24c..3248246 100644 --- a/backend/src/main/resources/contents/images/stamina_1.yml +++ b/backend/src/main/resources/contents/images/stamina_1.yml @@ -1,6 +1,3 @@ image: stamina_1 height: 9 -ascent: -16 -shadow: - remove: true - opacity: 254 \ No newline at end of file +ascent: -16 \ No newline at end of file diff --git a/backend/src/main/resources/contents/images/stamina_2.yml b/backend/src/main/resources/contents/images/stamina_2.yml index d2a9278..9a0545d 100644 --- a/backend/src/main/resources/contents/images/stamina_2.yml +++ b/backend/src/main/resources/contents/images/stamina_2.yml @@ -1,6 +1,3 @@ image: stamina_2 height: 9 -ascent: -16 -shadow: - remove: true - opacity: 254 \ No newline at end of file +ascent: -16 \ No newline at end of file diff --git a/backend/src/main/resources/contents/images/weather.yml b/backend/src/main/resources/contents/images/weather.yml index 8597510..b25b0d0 100644 --- a/backend/src/main/resources/contents/images/weather.yml +++ b/backend/src/main/resources/contents/images/weather.yml @@ -1,6 +1,3 @@ image: weather height: 10 -ascent: 4 -shadow: - remove: true - opacity: 254 \ No newline at end of file +ascent: 4 \ No newline at end of file