fancyholograms v3: Add use_lamp_commands experimental feature

This commit is contained in:
Oliver
2025-07-19 21:59:59 +02:00
parent 0aa66b1e9f
commit 5b1bb38643
3 changed files with 37 additions and 11 deletions

View File

@@ -51,6 +51,13 @@ public interface HologramConfiguration {
*/ */
String getLogLevel(); String getLogLevel();
/**
* Returns the language used by the plugin.
*
* @return The language used by the plugin.
*/
String getLanguage();
/** /**
* Returns whether holograms should be shown to bedrock players. * Returns whether holograms should be shown to bedrock players.
* *
@@ -66,9 +73,9 @@ public interface HologramConfiguration {
boolean isHologramsForOldClientsEnabled(); boolean isHologramsForOldClientsEnabled();
/** /**
* Returns the language used by the plugin. * Returns whether the plugin uses lamp commands.
* *
* @return The language used by the plugin. * @return {@code true} if the plugin uses lamp commands, {@code false} otherwise.
*/ */
String getLanguage(); boolean useLampCommands();
} }

View File

@@ -22,6 +22,7 @@ public final class FHConfiguration implements HologramConfiguration {
public static final String DISABLE_HOLOGRAMS_FOR_BEDROCK_PLAYERS_PATH = "experimental_features.disable_holograms_for_bedrock_players"; public static final String DISABLE_HOLOGRAMS_FOR_BEDROCK_PLAYERS_PATH = "experimental_features.disable_holograms_for_bedrock_players";
public static final String DISABLE_HOLOGRAMS_FOR_OLD_CLIENTS = "experimental_features.disable_holograms_for_old_clients"; public static final String DISABLE_HOLOGRAMS_FOR_OLD_CLIENTS = "experimental_features.disable_holograms_for_old_clients";
public static final String USE_LAMP_COMMANDS = "experimental_features.use_lamp_commands";
private static final String CONFIG_FILE_PATH = "plugins/FancyHolograms/config.yml"; private static final String CONFIG_FILE_PATH = "plugins/FancyHolograms/config.yml";
private Config config; private Config config;
@@ -92,6 +93,15 @@ public final class FHConfiguration implements HologramConfiguration {
Boolean.class Boolean.class
)); ));
config.addField(new ConfigField<>(
LANGUAGE_PATH,
"The language to use for the plugin.",
false,
"default",
false,
String.class
));
/* /*
FEATURE FLAGS FEATURE FLAGS
*/ */
@@ -115,12 +125,12 @@ public final class FHConfiguration implements HologramConfiguration {
)); ));
config.addField(new ConfigField<>( config.addField(new ConfigField<>(
LANGUAGE_PATH, USE_LAMP_COMMANDS,
"The language to use for the plugin.", "Use the new commands made with the Lamp framework.",
false, false,
"default",
false, false,
String.class false,
Boolean.class
)); ));
config.reload(); config.reload();
@@ -169,6 +179,11 @@ public final class FHConfiguration implements HologramConfiguration {
return config.get(LOG_LEVEL_PATH); return config.get(LOG_LEVEL_PATH);
} }
@Override
public String getLanguage() {
return config.get(LANGUAGE_PATH);
}
@Override @Override
public boolean isHologramsForBedrockPlayersEnabled() { public boolean isHologramsForBedrockPlayersEnabled() {
return !(boolean) config.get(DISABLE_HOLOGRAMS_FOR_BEDROCK_PLAYERS_PATH); return !(boolean) config.get(DISABLE_HOLOGRAMS_FOR_BEDROCK_PLAYERS_PATH);
@@ -180,7 +195,7 @@ public final class FHConfiguration implements HologramConfiguration {
} }
@Override @Override
public String getLanguage() { public boolean useLampCommands() {
return config.get(LANGUAGE_PATH); return config.get(USE_LAMP_COMMANDS);
} }
} }

View File

@@ -195,8 +195,12 @@ public final class FancyHologramsPlugin extends JavaPlugin implements FancyHolog
public void onEnable() { public void onEnable() {
new FancyLib(INSTANCE); new FancyLib(INSTANCE);
registerCommands(); if (configuration.useLampCommands()) {
registerLampCommands(); registerLampCommands();
} else {
registerCommands();
}
registerListeners(); registerListeners();
versionConfig.load(); versionConfig.load();