9
0
mirror of https://github.com/WiIIiam278/HuskSync.git synced 2025-12-27 02:29:10 +00:00

refactor: update a few config comments

This commit is contained in:
William
2024-01-26 13:48:46 +00:00
parent c75114b858
commit 08944ffd35
2 changed files with 45 additions and 28 deletions

View File

@@ -56,7 +56,7 @@ public class Settings {
┗╸ Documentation: https://william278.net/docs/husksync"""; ┗╸ Documentation: https://william278.net/docs/husksync""";
// Top-level settings // Top-level settings
@Comment("Locale of the default language file to use. Docs: https://william278.net/docs/husksync/translations") @Comment({"Locale of the default language file to use.", "Docs: https://william278.net/docs/husksync/translations"})
private String language = Locales.DEFAULT_LOCALE; private String language = Locales.DEFAULT_LOCALE;
@Comment("Whether to automatically check for plugin updates on startup") @Comment("Whether to automatically check for plugin updates on startup")
@@ -72,7 +72,7 @@ public class Settings {
@Comment("Whether to provide modern, rich TAB suggestions for commands (if available)") @Comment("Whether to provide modern, rich TAB suggestions for commands (if available)")
private boolean brigadierTabCompletion = false; private boolean brigadierTabCompletion = false;
@Comment("Whether to enable the Player Analytics hook. Docs: https://william278.net/docs/husksync/plan-hook") @Comment({"Whether to enable the Player Analytics hook.", "Docs: https://william278.net/docs/husksync/plan-hook"})
private boolean enablePlanHook = true; private boolean enablePlanHook = true;
@@ -105,8 +105,7 @@ public class Settings {
"useUnicode=true", "characterEncoding=UTF-8"); "useUnicode=true", "characterEncoding=UTF-8");
} }
@Comment({"MYSQL / MARIADB database Hikari connection pool properties.", @Comment("MYSQL / MARIADB database Hikari connection pool properties. Don't modify this unless you know what you're doing!")
"Don't modify this unless you know what you're doing!"})
private PoolSettings connectionPool = new PoolSettings(); private PoolSettings connectionPool = new PoolSettings();
@Getter @Getter
@@ -152,8 +151,7 @@ public class Settings {
private boolean useSsl = false; private boolean useSsl = false;
} }
@Comment({"Advanced configuration for users of Redis sentinel.", @Comment("Options for if you're using Redis sentinel. Don't modify this unless you know what you're doing!")
"If you don't know what this is, do not modify anything in this section."})
private RedisSentinel sentinel = new RedisSentinel(); private RedisSentinel sentinel = new RedisSentinel();
@Getter @Getter
@@ -178,8 +176,8 @@ public class Settings {
@NoArgsConstructor(access = AccessLevel.PRIVATE) @NoArgsConstructor(access = AccessLevel.PRIVATE)
public static class SynchronizationSettings { public static class SynchronizationSettings {
@Comment("The data synchronization mode to use (LOCKSTEP or DELAY). LOCKSTEP is recommended for most networks." @Comment({"The data synchronization mode to use (LOCKSTEP or DELAY). LOCKSTEP is recommended for most networks.",
+ " Docs: https://william278.net/docs/husksync/sync-modes") "Docs: https://william278.net/docs/husksync/sync-modes"})
private DataSyncer.Mode mode = DataSyncer.Mode.LOCKSTEP; private DataSyncer.Mode mode = DataSyncer.Mode.LOCKSTEP;
@Comment("The number of data snapshot backups that should be kept at once per user") @Comment("The number of data snapshot backups that should be kept at once per user")
@@ -188,8 +186,8 @@ public class Settings {
@Comment("Number of hours between new snapshots being saved as backups (Use \"0\" to backup all snapshots)") @Comment("Number of hours between new snapshots being saved as backups (Use \"0\" to backup all snapshots)")
private int snapshotBackupFrequency = 4; private int snapshotBackupFrequency = 4;
@Comment("List of save cause IDs for which a snapshot will be automatically pinned (so it won't be rotated)." @Comment({"List of save cause IDs for which a snapshot will be automatically pinned (so it won't be rotated).",
+ " Docs: https://william278.net/docs/husksync/data-rotation#save-causes") "Docs: https://william278.net/docs/husksync/data-rotation#save-causes"})
@Getter(AccessLevel.NONE) @Getter(AccessLevel.NONE)
private List<String> autoPinnedSaveCauses = List.of( private List<String> autoPinnedSaveCauses = List.of(
DataSnapshot.SaveCause.INVENTORY_COMMAND.name(), DataSnapshot.SaveCause.INVENTORY_COMMAND.name(),
@@ -213,7 +211,7 @@ public class Settings {
private boolean enabled = false; private boolean enabled = false;
@Comment("What items to save in death snapshots? (DROPS or ITEMS_TO_KEEP). " @Comment("What items to save in death snapshots? (DROPS or ITEMS_TO_KEEP). "
+ " Note that ITEMS_TO_KEEP (suggested for keepInventory servers) requires a Paper 1.19.4+ server.") + "Note that ITEMS_TO_KEEP (suggested for keepInventory servers) requires a Paper 1.19.4+ server.")
private DeathItemsMode itemsToSave = DeathItemsMode.DROPS; private DeathItemsMode itemsToSave = DeathItemsMode.DROPS;
@Comment("Should a death snapshot still be created even if the items to save on the player's death are empty?") @Comment("Should a death snapshot still be created even if the items to save on the player's death are empty?")
@@ -247,7 +245,7 @@ public class Settings {
+ "pulling data from the database instead (i.e., if the user did not change servers).") + "pulling data from the database instead (i.e., if the user did not change servers).")
private int networkLatencyMilliseconds = 500; private int networkLatencyMilliseconds = 500;
@Comment("Which data types to synchronize (Docs: https://william278.net/docs/husksync/sync-features)") @Comment({"Which data types to synchronize.", "Docs: https://william278.net/docs/husksync/sync-features"})
@Getter(AccessLevel.NONE) @Getter(AccessLevel.NONE)
private Map<String, Boolean> features = Identifier.getConfigMap(); private Map<String, Boolean> features = Identifier.getConfigMap();
@@ -261,6 +259,7 @@ public class Settings {
public boolean doAutoPin(@NotNull DataSnapshot.SaveCause cause) { public boolean doAutoPin(@NotNull DataSnapshot.SaveCause cause) {
return autoPinnedSaveCauses.contains(cause.name()); return autoPinnedSaveCauses.contains(cause.name());
} }
public boolean isFeatureEnabled(@NotNull Identifier id) { public boolean isFeatureEnabled(@NotNull Identifier id) {
return id.isCustom() || features.getOrDefault(id.getKeyValue(), id.isEnabledByDefault()); return id.isCustom() || features.getOrDefault(id.getKeyValue(), id.isEnabledByDefault());
} }

View File

@@ -18,7 +18,9 @@ This page contains the configuration structure for HuskSync.
# ┣╸ Information: https://william278.net/project/husksync # ┣╸ Information: https://william278.net/project/husksync
# ┣╸ Config Help: https://william278.net/docs/husksync/config-file/ # ┣╸ Config Help: https://william278.net/docs/husksync/config-file/
# ┗╸ Documentation: https://william278.net/docs/husksync # ┗╸ Documentation: https://william278.net/docs/husksync
# Locale of the default language file to use. Docs: https://william278.net/docs/husksync/translations
# Locale of the default language file to use.
# Docs: https://william278.net/docs/husksync/translations
language: en-gb language: en-gb
# Whether to automatically check for plugin updates on startup # Whether to automatically check for plugin updates on startup
check_for_updates: true check_for_updates: true
@@ -28,21 +30,23 @@ cluster_id: ''
debug_logging: false debug_logging: false
# Whether to provide modern, rich TAB suggestions for commands (if available) # Whether to provide modern, rich TAB suggestions for commands (if available)
brigadier_tab_completion: false brigadier_tab_completion: false
# Whether to enable the Player Analytics hook. Docs: https://william278.net/docs/husksync/plan-hook # Whether to enable the Player Analytics hook.
# Docs: https://william278.net/docs/husksync/plan-hook
enable_plan_hook: true enable_plan_hook: true
# Database settings
database: database:
# Type of database to use (MYSQL, MARIADB) # Type of database to use (MYSQL, MARIADB)
type: MYSQL type: MYSQL
# Specify credentials here for your MYSQL or MARIADB database
credentials: credentials:
# Specify credentials here for your MYSQL or MARIADB database
host: localhost host: localhost
port: 3306 port: 3306
database: HuskSync database: HuskSync
username: root username: root
password: pa55w0rd password: pa55w0rd
parameters: ?autoReconnect=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8 parameters: ?autoReconnect=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8
# MYSQL / MARIADB database Hikari connection pool properties. Don't modify this unless you know what you're doing!
connection_pool: connection_pool:
# MYSQL / MARIADB database Hikari connection pool properties. Don't modify this unless you know what you're doing!
maximum_pool_size: 10 maximum_pool_size: 10
minimum_idle: 10 minimum_idle: 10
maximum_lifetime: 1800000 maximum_lifetime: 1800000
@@ -52,21 +56,32 @@ database:
table_names: table_names:
users: husksync_users users: husksync_users
user_data: husksync_user_data user_data: husksync_user_data
# Redis settings
redis: redis:
# Specify the credentials of your Redis database here. Set "password" to '' if you don't have one
credentials: credentials:
# Specify the credentials of your Redis database here. Set "password" to '' if you don't have one
host: localhost host: localhost
port: 6379 port: 6379
password: '' password: ''
use_ssl: false use_ssl: false
# Options for if you're using Redis sentinel. Don't modify this unless you know what you're doing!
sentinel:
# The master set name for the Redis sentinel.
master: ''
# List of host:port pairs
nodes: []
password: ''
# Redis settings
synchronization: synchronization:
# The data synchronization mode to use (LOCKSTEP or DELAY). LOCKSTEP is recommended for most networks. Docs: https://william278.net/docs/husksync/sync-modes # The data synchronization mode to use (LOCKSTEP or DELAY). LOCKSTEP is recommended for most networks.
# Docs: https://william278.net/docs/husksync/sync-modes
mode: LOCKSTEP mode: LOCKSTEP
# The number of data snapshot backups that should be kept at once per user # The number of data snapshot backups that should be kept at once per user
max_user_data_snapshots: 16 max_user_data_snapshots: 16
# Number of hours between new snapshots being saved as backups (Use "0" to backup all snapshots) # Number of hours between new snapshots being saved as backups (Use "0" to backup all snapshots)
snapshot_backup_frequency: 4 snapshot_backup_frequency: 4
# List of save cause IDs for which a snapshot will be automatically pinned (so it won't be rotated). Docs: https://william278.net/docs/husksync/data-rotation#save-causes # List of save cause IDs for which a snapshot will be automatically pinned (so it won't be rotated).
# Docs: https://william278.net/docs/husksync/data-rotation#save-causes
auto_pinned_save_causes: auto_pinned_save_causes:
- INVENTORY_COMMAND - INVENTORY_COMMAND
- ENDERCHEST_COMMAND - ENDERCHEST_COMMAND
@@ -75,29 +90,30 @@ synchronization:
- MPDB_MIGRATION - MPDB_MIGRATION
# Whether to create a snapshot for users on a world when the server saves that world # Whether to create a snapshot for users on a world when the server saves that world
save_on_world_save: true save_on_world_save: true
# Configuration for how and when to sync player data when they die
save_on_death: save_on_death:
# Whether to create a snapshot for users when they die (containing their death drops) # Whether to create a snapshot for users when they die (containing their death drops)
enabled: true enabled: false
# What items to save in death snapshots? (DROPS or ITEMS_TO_KEEP). Note that ITEMS_TO_KEEP (suggested for keepInventory servers) requires a Paper 1.19.4+ server # What items to save in death snapshots? (DROPS or ITEMS_TO_KEEP). Note that ITEMS_TO_KEEP (suggested for keepInventory servers) requires a Paper 1.19.4+ server.
items_to_save: DROPS items_to_save: DROPS
# Should a death snapshot still be created even if the items to save on the player's death are empty? # Should a death snapshot still be created even if the items to save on the player's death are empty?
save_empty_items: false save_empty_items: true
# Whether dead players who log out and log in to a different server should have their items saved. # Whether dead players who log out and log in to a different server should have their items saved.
sync_dead_players_changing_server: true sync_dead_players_changing_server: true
# Whether to use the snappy data compression algorithm. Keep on unless you know what you're doing # Whether to use the snappy data compression algorithm. Keep on unless you know what you're doing
compress_data: true compress_data: true
# Where to display sync notifications (ACTION_BAR, CHAT, TOAST or NONE) # Where to display sync notifications (ACTION_BAR, CHAT, TOAST or NONE)
notification_display_slot: ACTION_BAR notification_display_slot: ACTION_BAR
# (Experimental) Persist Cartography Table locked maps to let them be viewed on any server # Persist maps locked in a Cartography Table to let them be viewed on any server
persist_locked_maps: true persist_locked_maps: true
# Whether to synchronize player max health (requires health syncing to be enabled) # Whether to synchronize player max health (requires health syncing to be enabled)
synchronize_max_health: true synchronize_max_health: true
# If using the DELAY sync method, how long should this server listen for Redis key data updates before pulling data from the database instead (i.e., if the user did not change servers). # If using the DELAY sync method, how long should this server listen for Redis key data updates before pulling data from the database instead (i.e., if the user did not change servers).
network_latency_milliseconds: 500 network_latency_milliseconds: 500
# Which data types to synchronize (Docs: https://william278.net/docs/husksync/sync-features) # Which data types to synchronize.
# Docs: https://william278.net/docs/husksync/sync-features
features: features:
hunger: true persistent_data: true
persistent_data: false
inventory: true inventory: true
game_mode: true game_mode: true
advancements: true advancements: true
@@ -107,6 +123,7 @@ synchronization:
location: false location: false
statistics: true statistics: true
health: true health: true
hunger: true
# Commands which should be blocked before a player has finished syncing (Use * to block all commands) # Commands which should be blocked before a player has finished syncing (Use * to block all commands)
blacklisted_commands_while_locked: blacklisted_commands_while_locked:
- '*' - '*'
@@ -124,11 +141,12 @@ synchronization:
```yaml ```yaml
# ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ # ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
# ┃ HuskSync Server ID config # ┃ HuskSync - Server ID
# ┃ Developed by William278 ┃ # ┃ Developed by William278 ┃
# ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ # ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
# ┣╸ This file should contain the ID of this server as defined in your proxy config. # ┣╸ This file should contain the ID of this server as defined in your proxy config.
# ┗╸ If you join it using /server alpha, then set it to 'alpha' (case-sensitive) # ┗╸ If you join it using /server alpha, then set it to 'alpha' (case-sensitive)
name: beta name: beta
``` ```