diff --git a/Home.md b/Home.md index c03bac1..17daac4 100644 --- a/Home.md +++ b/Home.md @@ -71,6 +71,7 @@ Configs are stored under each module in the `config.` package ## Channels config & Channel name priority To avoid conflicting channel names, the `GameChannelLookupEvent` will be used to determine which plugin 'owns' a given channel name, when a plugin isn't provided at the time of looking up a config value. +Unless the plugin is specified in the config with a semicolon between the plugin name and channel name (eg. `discordsrv:global`) in which case there can be no conflict. The `channels` option in the main config works like this: - The value is equivalent to Map @@ -79,18 +80,9 @@ The `channels` option in the main config works like this: To access the `channels` config option: 1. `DiscordSRV#channelConfig` instead of `DiscordSRV#config` -2. `ChannelConfigHelper#orDefault(String)` which returns a `OrDefault` -3. `OrDefault#map` / `OrDefault#get` +2. `ChannelConfigHelper#get(GameChannel)` or `ChannelConfigHelper#resolve(DiscordMessageChannel)` or `ChannelConfigHelper#resolve(String)` -Full example: -```java -discordSRV.channelConfig().orDefault("global").map(cfg -> cfg.discordToMinecraft).get(cfg -> cfg.enabled, false); -``` -The value will be looked up from: -- `channels.plugin:global.discord-to-minecraft.enabled` (where `plugin` is the first to respond to GameChannelLookupEvent) -- `channels.global.discord-to-minecraft.enabled` -- `channels.default.discord-to-minecraft.enabled` -- the second parameter of the `OrDefault#get` call (`false`) +If access to channel ids / threads is needed, check if BaseChannelConfig is a instance of `IChannelConfig`, cast to that if it is, and use the methods from that interface. ## Placeholder service