mirror of
https://github.com/Xiao-MoMi/Custom-Nameplates.git
synced 2025-12-19 15:09:23 +00:00
fix
This commit is contained in:
@@ -21,10 +21,10 @@ public enum StorageType {
|
||||
JSON,
|
||||
YAML,
|
||||
H2,
|
||||
SQLite,
|
||||
MySQL,
|
||||
MariaDB,
|
||||
MongoDB,
|
||||
SQLITE,
|
||||
MYSQL,
|
||||
MARIADB,
|
||||
MONGODB,
|
||||
Redis,
|
||||
NONE
|
||||
}
|
||||
|
||||
@@ -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<PreParsedDynamicText> 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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -94,7 +94,7 @@ public class MongoDBProvider extends AbstractStorage {
|
||||
|
||||
@Override
|
||||
public StorageType storageType() {
|
||||
return StorageType.MongoDB;
|
||||
return StorageType.MONGODB;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -11,6 +11,6 @@ public class MariaDBProvider extends AbstractHikariDatabase {
|
||||
|
||||
@Override
|
||||
public StorageType storageType() {
|
||||
return StorageType.MariaDB;
|
||||
return StorageType.MARIADB;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,6 @@ public class MySQLProvider extends AbstractHikariDatabase {
|
||||
|
||||
@Override
|
||||
public StorageType storageType() {
|
||||
return StorageType.MySQL;
|
||||
return StorageType.MYSQL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public class SQLiteProvider extends AbstractSQLDatabase {
|
||||
|
||||
@Override
|
||||
public StorageType storageType() {
|
||||
return StorageType.SQLite;
|
||||
return StorageType.SQLITE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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: '<black>Nice to meet you!</black>'
|
||||
left-margin: 1
|
||||
right-margin: 1
|
||||
|
||||
# https://mo-mi.gitbook.io/xiaomomi-plugins/plugin-wiki/customnameplates/custom-placeholders/nameplate-text
|
||||
nameplate-text:
|
||||
halloween:
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
image: bell
|
||||
height: 10
|
||||
ascent: 4
|
||||
shadow:
|
||||
remove: true
|
||||
opacity: 254
|
||||
ascent: 4
|
||||
@@ -1,6 +1,3 @@
|
||||
image: bubble
|
||||
height: 10
|
||||
ascent: 4
|
||||
shadow:
|
||||
remove: true
|
||||
opacity: 254
|
||||
ascent: 4
|
||||
@@ -1,6 +1,3 @@
|
||||
image: clock
|
||||
height: 10
|
||||
ascent: 4
|
||||
shadow:
|
||||
remove: true
|
||||
opacity: 254
|
||||
ascent: 4
|
||||
@@ -1,6 +1,3 @@
|
||||
image: coin
|
||||
height: 10
|
||||
ascent: -14
|
||||
shadow:
|
||||
remove: true
|
||||
opacity: 254
|
||||
ascent: -14
|
||||
@@ -1,6 +1,3 @@
|
||||
image: compass
|
||||
height: 10
|
||||
ascent: 4
|
||||
shadow:
|
||||
remove: true
|
||||
opacity: 254
|
||||
ascent: 4
|
||||
@@ -1,6 +1,3 @@
|
||||
image: stamina_0
|
||||
height: 9
|
||||
ascent: -16
|
||||
shadow:
|
||||
remove: true
|
||||
opacity: 254
|
||||
ascent: -16
|
||||
@@ -1,6 +1,3 @@
|
||||
image: stamina_1
|
||||
height: 9
|
||||
ascent: -16
|
||||
shadow:
|
||||
remove: true
|
||||
opacity: 254
|
||||
ascent: -16
|
||||
@@ -1,6 +1,3 @@
|
||||
image: stamina_2
|
||||
height: 9
|
||||
ascent: -16
|
||||
shadow:
|
||||
remove: true
|
||||
opacity: 254
|
||||
ascent: -16
|
||||
@@ -1,6 +1,3 @@
|
||||
image: weather
|
||||
height: 10
|
||||
ascent: 4
|
||||
shadow:
|
||||
remove: true
|
||||
opacity: 254
|
||||
ascent: 4
|
||||
Reference in New Issue
Block a user