9
0
mirror of https://github.com/Xiao-MoMi/Custom-Fishing.git synced 2025-12-22 08:29:32 +00:00

improve default configs

This commit is contained in:
XiaoMoMi
2024-09-08 02:09:49 +08:00
parent b6531636eb
commit b5015b71e2
5 changed files with 163 additions and 179 deletions

View File

@@ -383,34 +383,6 @@ public abstract class ConfigManager implements ConfigLoader, Reloadable {
} }
} }
@Override
public YamlDocument loadConfig(String filePath, char routeSeparator, UpdaterSettings settings) {
try (InputStream inputStream = new FileInputStream(resolveConfig(filePath).toFile())) {
return YamlDocument.create(
inputStream,
plugin.getResourceStream(filePath),
GeneralSettings.builder().setRouteSeparator(routeSeparator).build(),
LoaderSettings
.builder()
.setAutoUpdate(true)
.build(),
DumperSettings.builder()
.setScalarFormatter((tag, value, role, def) -> {
if (role == NodeRole.KEY) {
return ScalarStyle.PLAIN;
} else {
return tag == Tag.STR ? ScalarStyle.DOUBLE_QUOTED : ScalarStyle.PLAIN;
}
})
.build(),
settings
);
} catch (IOException e) {
plugin.getPluginLogger().severe("Failed to load config " + filePath, e);
throw new RuntimeException(e);
}
}
@Override @Override
public YamlDocument loadData(File file) { public YamlDocument loadData(File file) {
try (InputStream inputStream = new FileInputStream(file)) { try (InputStream inputStream = new FileInputStream(file)) {

View File

@@ -27,12 +27,23 @@ import java.io.File;
*/ */
public interface ConfigLoader { public interface ConfigLoader {
/**
* Loads a YAML configuration file from the specified file path.
*
* @param filePath the path to the configuration file
* @return the loaded {@link YamlDocument}
*/
YamlDocument loadConfig(String filePath); YamlDocument loadConfig(String filePath);
/**
* Loads a YAML configuration file from the specified file path with a custom route separator.
*
* @param filePath the path to the configuration file
* @param routeSeparator the custom route separator character
* @return the loaded {@link YamlDocument}
*/
YamlDocument loadConfig(String filePath, char routeSeparator); YamlDocument loadConfig(String filePath, char routeSeparator);
YamlDocument loadConfig(String filePath, char routeSeparator, UpdaterSettings settings);
/** /**
* Loads a YAML data file. * Loads a YAML data file.
* *

View File

@@ -79,7 +79,7 @@ public class BukkitStorageManager implements StorageManager, Listener {
@Override @Override
public void reload() { public void reload() {
YamlDocument config = plugin.getConfigManager().loadConfig("database.yml", '.', UpdaterSettings.DEFAULT); YamlDocument config = plugin.getConfigManager().loadConfig("database.yml");
this.serverID = config.getString("unique-server-id", "default"); this.serverID = config.getString("unique-server-id", "default");
// Check if storage type has changed and reinitialize if necessary // Check if storage type has changed and reinitialize if necessary

View File

@@ -1,33 +1,32 @@
# Don"t change this # Do not change this
config-version: '${config_version}' config-version: '${config_version}'
# Debug # Debug mode toggle
debug: false debug: false
# BStats # Enable BStats metrics
metrics: true metrics: true
# Check updates # Enable automatic update checks
update-checker: true update-checker: true
# Force locale, for instance zh_cn # Force locale setting, e.g., zh_cn
force-locale: '' force-locale: ''
# Mechanic settings # Mechanic settings
mechanics: mechanics:
# Specifies the conditions required for the plugin mechanics to work. # Specifies the conditions required for the plugin mechanics to function
# Here, the type is !world, which implies the plugin won't work in # The type is !world, meaning the plugin will not operate in the world named 'blacklist_world'
# the world named 'blacklist_world'.
mechanic-requirements: mechanic-requirements:
world_requirement: world_requirement:
type: '!world' type: '!world'
value: value:
- blacklist_world - blacklist_world
# If you want to let some players skip games, you can set requirements that used to skip games # If you want to allow some players to skip the game, set skip requirements here
# We used `impossible` requirement here, so players should play the game if there exists # We've used the 'impossible' requirement here, meaning players cannot skip the game if it exists
skip-game-requirements: skip-game-requirements:
impossible_requirement: impossible_requirement:
type: 'impossible' type: 'impossible'
# Requirements for enabling auto-fishing # Conditions for enabling auto-fishing
auto-fishing-requirements: auto-fishing-requirements:
impossible_requirement: impossible_requirement:
type: 'impossible' type: 'impossible'
# Configures global effects. This is useful if you want to give all the players certain effects based on certain conditions # Configures global effects, useful for applying certain effects to all players under specific conditions
global-effects: global-effects:
effect_1: effect_1:
type: conditional type: conditional
@@ -40,8 +39,7 @@ mechanics:
effect_1: effect_1:
type: wait-time-multiplier type: wait-time-multiplier
value: 0.85 value: 0.85
# Configures global events for hook/bait/rod/loot # Configures global events for hooks, bait, rods, and loot, reducing redundant lines
# which would help you reduce duplicated lines
global-events: global-events:
hook: {} hook: {}
bait: {} bait: {}
@@ -55,7 +53,7 @@ mechanics:
actions: actions:
actionbar_action: actionbar_action:
type: actionbar type: actionbar
value: '<#FFD700>[New Record]</#FFD700> <#FFFFF0>You caught a(n) {nick} which is <#FFA500>{size_formatted}cm</#FFA500> long!</#FFFFF0>' value: '<#FFD700>[New Record]</#FFD700> <#FFFFF0>You caught a(n) {nick} measuring <#FFA500>{size_formatted}cm</#FFA500> long!</#FFFFF0>'
sound_action: sound_action:
type: sound type: sound
value: value:
@@ -85,7 +83,7 @@ mechanics:
actions: actions:
actionbar_action: actionbar_action:
type: actionbar type: actionbar
value: '<gray>You caught a(n) {nick} which is <#F5F5F5>{size_formatted}cm</#F5F5F5> long!</gray> <#C0C0C0>(Best record: {record_formatted}cm)</#C0C0C0>' value: '<gray>You caught a(n) {nick} measuring <#F5F5F5>{size_formatted}cm</#F5F5F5> long!</gray> <#C0C0C0>(Best record: {record_formatted}cm)</#C0C0C0>'
title_action: title_action:
type: random-title type: random-title
value: value:
@@ -95,7 +93,7 @@ mechanics:
subtitles: subtitles:
- 'You caught a(n) {nick}' - 'You caught a(n) {nick}'
- 'Whoa! Nice catch!' - 'Whoa! Nice catch!'
- 'Oh {nick} here we go!' - 'Oh {nick}, here we go!'
- 'Let''s see what it is!' - 'Let''s see what it is!'
fade-in: 20 fade-in: 20
stay: 30 stay: 30
@@ -106,12 +104,12 @@ mechanics:
type: random-title type: random-title
value: value:
titles: titles:
- '<red>Be concentrated!</red>' - '<red>Stay focused!</red>'
- '<red>What a pity!</red>' - '<red>What a pity!</red>'
- '<red>Try next time!</red>' - '<red>Try again next time!</red>'
- '<red>Bad luck</red>' - '<red>Bad luck!</red>'
subtitles: subtitles:
- 'The fish escaped...' - 'The fish got away...'
fade-in: 20 fade-in: 20
stay: 30 stay: 30
fade-out: 10 fade-out: 10
@@ -143,30 +141,30 @@ mechanics:
position: other position: other
item: water_effect item: water_effect
use-item-display: true use-item-display: true
# Global properties which would help you reduce duplicated lines # Global properties to help reduce redundant lines
global-loot-property: global-loot-property:
show-in-fishfinder: true show-in-fishfinder: true
disable-stat: false disable-stat: false
disable-game: false disable-game: false
instant-game: false instant-game: false
# Fishing bag is where players can store their baits, utils, hooks and rods (Loot optional) # The fishing bag is where players store bait, utilities, hooks, and rods (loot is optional)
fishing-bag: fishing-bag:
enable: true enable: true
# Fishing bag container title # Title of the fishing bag container
bag-title: '<blue>{player}''s Fishing Bag</blue>' bag-title: '<blue>{player}''s Fishing Bag</blue>'
# Other whitelist-items # Other whitelist items
whitelist-items: whitelist-items:
- fishing_rod - fishing_rod
# Decide the items that can be stored in bag # Specify the items that can be stored in the bag
can-store-loot: false can-store-loot: false
can-store-rod: true can-store-rod: true
can-store-bait: true can-store-bait: true
can-store-hook: true can-store-hook: true
can-store-util: true can-store-util: true
# Requirements for automatically collecting # Requirements for automatic loot collection into the bag
collect-requirements: collect-requirements:
permission: fishingbag.collectloot permission: fishingbag.collectloot
# Actions to do if fishing loots are automatically collected into bag # Actions triggered when fishing loot is automatically collected into the bag
collect-actions: collect-actions:
sound_action: sound_action:
type: sound type: sound
@@ -179,10 +177,10 @@ mechanics:
type: hologram type: hologram
value: value:
duration: 40 duration: 40
text: '{nick} <#B0E0E6><b>has been stored into bag</#B0E0E6>' text: '{nick} <#B0E0E6><b>has been stored in the bag</#B0E0E6>'
position: other position: other
y: 1 y: 1
# Actions to do if the fishing bag is full # Actions triggered when the fishing bag is full
full-actions: full-actions:
conditional_action: conditional_action:
type: conditional type: conditional
@@ -196,52 +194,52 @@ mechanics:
actions: actions:
message_action: message_action:
type: message type: message
value: "<#EEE8AA>[Fishing Bag]</#EEE8AA> Your fishing bag has been full." value: "<#EEE8AA>[Fishing Bag]</#EEE8AA> Your fishing bag is full."
market: market:
# Market GUI title # Title for the market GUI
title: '<gradient:#A52A2A:#800000:#A52A2A>Fish Market</gradient>' title: '<gradient:#A52A2A:#800000:#A52A2A>Fish Market</gradient>'
# Whether to enable limitations # Enable limitations
limitation: limitation:
enable: true enable: true
earnings: '10000' # You can use expressions here earnings: '10000' # Expressions can be used here
# Market menu layout # Layout for the market menu
layout: layout:
- 'AAAAAAAAA' - 'AAAAAAAAA'
- 'AIIIIIIIA' - 'AIIIIIIIA'
- 'AIIIIIIIA' - 'AIIIIIIIA'
- 'AIIIIIIIA' - 'AIIIIIIIA'
- 'AAAABAAAA' - 'AAAABAAAA'
# Price formula (For CustomFishing loots) # Price formula for custom fishing loot
price-formula: '{base} + {bonus} * {size}' price-formula: '{base} + {bonus} * {size}'
# Allow player to sell fish in bundles # Allow players to sell fish in bundles
allow-bundle: true allow-bundle: true
# Allow player to sell fish in shulker boxes # Allow players to sell fish in shulker boxes
allow-shulker-box: true allow-shulker-box: true
# Item price (For vanilla items & other plugin items that have CustomModelData) # Prices for vanilla and other plugin items with CustomModelData
item-price: item-price:
# Vanilla Items # Vanilla items
COD: 10 COD: 10
PUFFERFISH: 10 PUFFERFISH: 10
SALMON: 10 SALMON: 10
TROPICAL_FISH: 10 TROPICAL_FISH: 10
# PAPER (CustomModelData: 999) # PAPER (CustomModelData: 999)
PAPER:999: 5 PAPER:999: 5
# Slots to put items in # Slots to place items in
item-slot: item-slot:
symbol: 'I' symbol: 'I'
allow-items-with-no-price: true allow-items-with-no-price: true
# This is an icon that allows players to sell all the fish from their inventory and fishingbag # Icon allowing players to sell all fish from their inventory and fishing bag
# You can enable it by putting the symbol into layout # Enable it by placing the symbol in the layout
sell-all-icons: sell-all-icons:
symbol: 'S' symbol: 'S'
# Should the fish in fishing bag be sold # Determines whether fish in the fishing bag should also be sold
fishingbag: true fishingbag: true
allow-icon: allow-icon:
material: IRON_BLOCK material: IRON_BLOCK
display: display:
name: '<#00CED1><b>● <!b>Ship the fish' name: '<#00CED1><b>● <!b>Sell the fish'
lore: lore:
- '<font:uniform><gradient:#E6E6FA:#48D1CC:#E6E6FA>You will get <green>{money_formatted} coins</green> from the fish in inventory and bag</gradient></font>' - '<font:uniform><gradient:#E6E6FA:#48D1CC:#E6E6FA>You will earn <green>{money_formatted} coins</green> from the fish in your inventory and bag</gradient></font>'
action: action:
sound_action: sound_action:
type: sound type: sound
@@ -252,20 +250,21 @@ mechanics:
pitch: 1 pitch: 1
message_action: message_action:
type: message type: message
value: 'You earned {money_formatted} coins from the fish! You can get {rest_formatted} more coins from market today' value: 'You earned {money_formatted} coins from the fish! You can still earn {rest_formatted} more coins from the market today.'
# Requires Vault and any economy plugin # Requires Vault and an economy plugin
money_action: money_action:
type: give-money type: give-money
value: '{money}' value: '{money}'
# Uncomment the command_action if needed
# command_action: # command_action:
# type: command # type: command
# value: 'money give {player} {money}' # value: 'money give {player} {money}'
deny-icon: deny-icon:
material: REDSTONE_BLOCK material: REDSTONE_BLOCK
display: display:
name: '<red><b>● <!b>Denied trade' name: '<red><b>● <!b>Trade Denied'
lore: lore:
- '<font:uniform><gradient:#E6E6FA:red:#E6E6FA>Nothing to sell!</gradient></font>' - '<font:uniform><gradient:#E6E6FA:red:#E6E6FA>No items available to sell!</gradient></font>'
action: action:
sound_action: sound_action:
type: sound type: sound
@@ -277,9 +276,9 @@ mechanics:
limit-icon: limit-icon:
material: REDSTONE_BLOCK material: REDSTONE_BLOCK
display: display:
name: '<red><b>● <!b>Denied trade' name: '<red><b>● <!b>Trade Denied'
lore: lore:
- '<font:uniform><gradient:#E6E6FA:red:#E6E6FA>The worth of items exceeds the money that can be earned for the rest of today!</gradient></font>' - '<font:uniform><gradient:#E6E6FA:red:#E6E6FA>The total value exceeds the daily limit for earnings!</gradient></font>'
action: action:
sound_action: sound_action:
type: sound type: sound
@@ -288,15 +287,15 @@ mechanics:
source: 'player' source: 'player'
volume: 1 volume: 1
pitch: 1 pitch: 1
# Sell icon # Sell icon for individual transactions
sell-icons: sell-icons:
symbol: 'B' symbol: 'B'
allow-icon: allow-icon:
material: IRON_BLOCK material: IRON_BLOCK
display: display:
name: '<#00CED1><b>● <!b>Ship the fish' name: '<#00CED1><b>● <!b>Sell the fish'
lore: lore:
- '<font:uniform><gradient:#E6E6FA:#48D1CC:#E6E6FA>You will get <green>{money_formatted} coins</green> from the fish</gradient></font>' - '<font:uniform><gradient:#E6E6FA:#48D1CC:#E6E6FA>You will earn <green>{money_formatted} coins</green> from the fish</gradient></font>'
action: action:
sound_action: sound_action:
type: sound type: sound
@@ -307,19 +306,20 @@ mechanics:
pitch: 1 pitch: 1
message_action: message_action:
type: message type: message
value: 'You earned {money_formatted} coins from the fish! You can get {rest_formatted} more coins from market today' value: 'You earned {money_formatted} coins from the fish! You can still earn {rest_formatted} more coins from the market today.'
money_action: money_action:
type: give-money type: give-money
value: '{money}' value: '{money}'
# Uncomment the command_action if needed
# command_action: # command_action:
# type: command # type: command
# value: 'money give {player} {money}' # value: 'money give {player} {money}'
deny-icon: deny-icon:
material: REDSTONE_BLOCK material: REDSTONE_BLOCK
display: display:
name: '<red><b>● <!b>Denied trade' name: '<red><b>● <!b>Trade Denied'
lore: lore:
- '<font:uniform><gradient:#E6E6FA:red:#E6E6FA>Nothing to sell!</gradient></font>' - '<font:uniform><gradient:#E6E6FA:red:#E6E6FA>No items available to sell!</gradient></font>'
action: action:
sound_action: sound_action:
type: sound type: sound
@@ -331,9 +331,9 @@ mechanics:
limit-icon: limit-icon:
material: REDSTONE_BLOCK material: REDSTONE_BLOCK
display: display:
name: '<red><b>● <!b>Denied trade' name: '<red><b>● <!b>Trade Denied'
lore: lore:
- '<font:uniform><gradient:#E6E6FA:red:#E6E6FA>The worth of items exceeds the money that can be earned for the rest of today!</gradient></font>' - '<font:uniform><gradient:#E6E6FA:red:#E6E6FA>The total value exceeds the daily limit for earnings!</gradient></font>'
action: action:
sound_action: sound_action:
type: sound type: sound
@@ -342,7 +342,7 @@ mechanics:
source: 'player' source: 'player'
volume: 1 volume: 1
pitch: 1 pitch: 1
# Decorative icons # Decorative icons for visual enhancement
decorative-icons: decorative-icons:
glass-pane: glass-pane:
symbol: 'A' symbol: 'A'
@@ -351,86 +351,85 @@ mechanics:
name: ' ' name: ' '
components: components:
minecraft:hide_tooltip: {} minecraft:hide_tooltip: {}
# This section would take effect if you set "override-vanilla" to true # This section is only effective if "override-vanilla" is set to true
# That also means vanilla mechanics for example lure enchantment # Meaning vanilla mechanics, such as lure enchantment, will no longer apply
# would no longer take effect, so you have to configure its effect in CustomFishing # You must configure their effects in CustomFishing instead
fishing-wait-time: fishing-wait-time:
# override vanilla mechanic # Toggle to override vanilla fishing wait times
override-vanilla: false override-vanilla: false
# ticks # Wait time in ticks
min-wait-time: 100 min-wait-time: 100
max-wait-time: 600 max-wait-time: 600
# Lava fishing settings # Lava fishing settings
# To modify vanilla fishing time, you should edit paper-world-defaults.yml where there's a section called fishing-time-range
lava-fishing: lava-fishing:
enable: true enable: true
# ticks # Wait time in ticks
min-wait-time: 100 min-wait-time: 100
max-wait-time: 600 max-wait-time: 600
# Void fishing settings
void-fishing: void-fishing:
enable: true enable: true
# ticks # Wait time in ticks
min-wait-time: 100 min-wait-time: 100
max-wait-time: 600 max-wait-time: 600
# Size settings # Size configuration
size: size:
# Some effects would increase/decrease size so the option decides whether they could ignore the limit # Prevent certain effects from breaking the size limits
restricted-size-range: true restricted-size-range: true
# Competition settings # Competition settings
competition: competition:
# Use redis for cross server data synchronization # Use Redis for cross-server data synchronization
redis-ranking: false redis-ranking: false
# Server group # Server group for competition
server-group: default server-group: default
# Increase this value would allow you to use more placeholders like {4_player} {5_score} in sacrifice of some performance # Increase this value to allow more placeholders like {4_player} and {5_score}
placeholder-limit: 3 placeholder-limit: 3
# If a player could get multiple loots from fishing, should the loots spawn at the same time or have delay for each (measured in ticks) # If multiple loots are obtained during fishing, should they spawn simultaneously or with a delay (in ticks) between each?
multiple-loot-spawn-delay: 4 multiple-loot-spawn-delay: 4
# Totem settings # Totem settings
totem: totem:
# Is it allowed for different types of totems to take effect at the same time # Allow multiple totem types to be active simultaneously
allow-multiple-type: true allow-multiple-type: true
# Is it allowed for totems of the same type to take effect cumulatively # Allow totems of the same type to stack their effects
allow-same-type: false allow-same-type: false
# Enable fake bait casting animation # Enable fake bait casting animations
bait-animation: true bait-animation: true
# Other settings # Other settings
other-settings: other-settings:
# Anti auto fishing mod # Anti-auto-fishing mod toggle
anti-auto-fishing-mod: false anti-auto-fishing-mod: false
# It's recommended to use MiniMessage format. If you insist on using legacy color code "&", enable the support below. # Recommended to use MiniMessage format. If you prefer using legacy color codes "&", enable the support below.
# Disable this would improve performance # Disabling this improves performance
legacy-color-code-support: true legacy-color-code-support: true
# Fishing event priority: MONITOR HIGHEST HIGH NORMAL LOW LOWEST # Priority of fishing-related events: MONITOR HIGHEST HIGH NORMAL LOW LOWEST
event-priority: NORMAL event-priority: NORMAL
# Save the data from cache to file periodically to minimize the data loss if server crashes # Saves cached data to file periodically to minimize data loss in case of server crashes
# -1 to disable # Set to -1 to disable
data-saving-interval: 600 data-saving-interval: 600
# Log the consumption of time on data saving # Log the time spent saving data
log-data-saving: true log-data-saving: true
# Lock player's data if a player is playing on a server that connected to database # Lock player data if they are connected to a database-backed server
# If you can ensure low database link latency and fast processing, you can consider disabling this option to improve performance # You may disable this to improve performance if you can ensure low database latency
lock-data: true lock-data: true
# Requires PlaceholderAPI to work # Requires PlaceholderAPI for these placeholders
placeholder-register: placeholder-register:
# Requires server expansion # Requires server expansion
'{date}': '%server_time_yyyy-MM-dd-HH:mm:ss%' '{date}': '%server_time_yyyy-MM-dd-HH:mm:ss%'
# Requires player expansion # Requires player expansion
'{yaw}': '%player_yaw%' '{yaw}': '%player_yaw%'
# CustomFishing supports using items/blocks from other plugins # CustomFishing supports items/blocks from other plugins
# If items share the same id, they would inherit the effects # Items with matching IDs will inherit effects. Check the wiki for examples
# Check the wiki for examples
item-detection-order: item-detection-order:
- CustomFishing - CustomFishing
- vanilla - vanilla
block-detection-order: block-detection-order:
- vanilla - vanilla
# Custom durability format # Custom durability display format
custom-durability-format: custom-durability-format:
- '' - ''
- '<gray>Durability</gray><white>: {dur} <gray>/</gray> {max}</white>' - '<gray>Durability</gray><white>: {dur} <gray>/</gray> {max}</white>'
# Offset characters # Offset characters
# Never edit this unless you know what you are doing # Do not edit unless you know what you are doing
offset-characters: offset-characters:
font: customfishing:offset_chars font: customfishing:offset_chars
'1': '1':

View File

@@ -1,3 +1,5 @@
config-version: '${config_version}'
# file: # file:
# JSON # JSON
# YAML # YAML
@@ -67,7 +69,7 @@ MongoDB:
Redis: Redis:
enable: false enable: false
host: localhost host: localhost
#password: "123456" password: ""
port: 6379 port: 6379
use-ssl: false use-ssl: false
MaxTotal: 10 MaxTotal: 10