Skip to content
This repository has been archived by the owner on Oct 12, 2024. It is now read-only.

Commit

Permalink
docs: Update docs, config headers for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
WiIIiam278 committed Mar 29, 2024
1 parent 81c8d2f commit dcdb4e4
Show file tree
Hide file tree
Showing 9 changed files with 249 additions and 233 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ default void loadUserCache() {
: new UserCache.Editor());
}

// Old config migration (v2.x)
private void updateOldCache(@NotNull Path newFile) {
final Path oldCache = getConfigDirectory().resolve("spies.yml");
if (oldCache.toFile().exists()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ public class Filters {

static final String CONFIG_HEADER = """
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ HuskChat - Channels
┃ HuskChat - Filters
┃ Developed by William278 ┃
┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
┣╸ Information: https://william278.net/project/huskchat/
┗╸ Channels Help: https://william278.net/docs/huskchat/channels/""";
┗╸ Channels Help: https://william278.net/docs/huskchat/filters-and-replacers/""";

private Map<ChatFilter.Type, ChatFilter.FilterSettings> filters = new HashMap<>(Map.of(
ChatFilter.Type.ADVERTISING, ChatFilter.Type.ADVERTISING.getDefaultSettings(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,9 @@ public Map<String, URL> getChannelWebhooks() throws IllegalStateException {
}

@Comment("Custom names to display wherever you use the \"%server%\" placeholder instead of their default name")
private Map<String, String> serverNameReplacement = new HashMap<>();
private Map<String, String> serverNameReplacement = new HashMap<>(
Map.of("very-long-server-name", "VLSN")
);

@NotNull
public static List<String> formatCommands(@NotNull List<String> rawCommands) {
Expand Down
2 changes: 1 addition & 1 deletion docs/Backend-Chat-Entry.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This page provides information on using HuskChat on the proxy with backend (Spig
## Background
Plugins that rely on users entering things in chat to set names are not using the chat API in the way it was intended. Data entry should be done through commands, not through chat. Especially with the arrival of Minecraft 1.19.1, plugins should move away from relying on this (even if it is convenient).

Anvil menus, command entry, sign menus and other methods of data entry should be used. Some plugins, like *QuickShopReremake* provide command alternatives (`/i <amount>`) for data entry for this reason exactly.
Anvil menus, command entry, sign menus, and other methods of data entry should be used. Some plugins, like *QuickShopReremake* provide command alternatives (`/i <amount>`) for data entry for this reason exactly.

## Things to know
* HuskChat is a proxy plugin. It sits on your proxy (Bungeecord, Waterfall, Velocity, etc) - *not* your "backend" Spigot server. This means that when someone types something into chat, HuskChat processes it on behalf of the Spigot server the player is connected to; HuskChat on your proxy won't let that message be passed on to the backend server. This means that plugins that rely on chat input won't work.
Expand Down
52 changes: 21 additions & 31 deletions docs/Channels.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,33 @@
Channels are what players talk in and can be switched between using the /channel command or specialized channel shortcut
command. By default, HuskChat has the following channels setup, perfect for a typical setup:
Channels are what players talk in and can be switched between using the /channel command or specialized channel shortcut command. By default, HuskChat has the following channels setup, perfect for a typical setup:

* `local` - Local-scoped channel with `/local`, `/l` shortcut commands, for sending messages to players on the same server.
* `global` (default channel) - Global-scoped channel with `/global`, `/g` shortcut commands, for sending messages across the network.
* `staff` - Global-scoped channel with `/staff`, `/sc` shortcut commands. Great for letting staff communicate easily. Players need the `huskchat.channel.staff.send` and `huskchat.channel.staff.receive` permissions to send and receive messages in this channel respectively.
* `helpop` - Global-scoped channel with `/helpop` shortcut command. Great for letting players easily contact staff. Players need the `huskchat.channel.helpop.receive` permission to receive messages in this channel.

### Channel definition

To define custom channels, put them under the `channels:` section of `config.yml`. Below is the specification for how
this should be laid out, using a typical `staff` channel as an example. Keys marked as (Required) should be present.
Fields not marked as required will be set to a default value.
### Channel config structure
To define custom channels, put them in [`channels.yml`](config-files). Below is the specification for how this should be laid out, using a typical `staff` channel as an example.

```yaml
# Channel definitions
channels:
#...
staff: # (Required) The ID of the channel. To switch to this channel, users would execute /channel staff
format: '&e[Staff] %name%: &7' # (Required) Display format of the channel - See below
broadcast_scope: GLOBAL # Broadcast scope of the channel - See below
log_to_console: true # Whether messages sent to this channel should be logged to the proxy console
filtered: false # Whether messages sent to this channel should be filtered and replaced (see below)
# ...
- id: staff
format: '&e[Staff] %name%: &7'
broadcast_scope: GLOBAL
log_to_console: true
restricted_servers: []
filtered: false
permissions:
send: 'huskchat.channel.staff.send' # Permission required to see channel messages
receive: 'huskchat.channel.staff.receive' # Permission required to switch to & send messages
shortcut_commands: # List of shortcut commands that users can use to quickly use the channel
send: huskchat.channel.staff.send
receive: huskchat.channel.staff.receive
shortcut_commands:
- /staff
- /sc
restricted_servers: # List of servers where messages in this channel can't be sent or received
- hub
#...
# ...
```

### Channel scope

Channel scope defines the scope by which messages are broadcast and handled by HuskChat. The following options are
available:

Expand All @@ -56,11 +51,11 @@ These scopes are available when running HuskChat on a single-server Spigot serve
On a single server setup, the `LOCAL` and `LOCAL_PASSTHROUGH` scopes duplicate the `GLOBAL` and `GLOBAL_PASSTHROUGH` scopes.

### Default channels
> **Note:** This feature is only used on Bungee/Velocity servers.
You must define a `default_channel` in config.yml that players will be put in when they join.

Additionally, you can define server specific defaults in the `server_default_channels` section. When a player changes to
a server with a server_default_channel assigned, the player will automatically switch to the specified channel
Additionally, you can define server-specific defaults in the `server_default_channels` section. When a player changes to a server with a server_default_channel assigned, the player will automatically switch to the specified channel

```yaml
server_default_channels:
Expand All @@ -71,15 +66,10 @@ server_default_channels:
On a single-server setup, this is ignored.
### Restricted channels
> **Note:** This feature is only used on Bungee/Velocity servers.
If you'd like to prevent players from using certain channels in certain servers, you can define `restricted_servers` in
each channel (see the channel definition above for an example). Players are unable to send or receive any messages in a
channel if they are connected to a server where it is restricted.
If you'd like to prevent players from using certain channels in certain servers, you can define `restricted_servers` in each channel (see the channel definition above for an example). Players are unable to send or receive any messages in a channel if they are connected to a server where it is restricted.

Additionally, if a player changes server to one where their current channel is restricted, it will change to
the `default_channel` unless it has an overriding server default channel as outlined above.
Additionally, if a player changes server to one where their current channel is restricted, it will change to the `default_channel` unless it has an overriding server default channel as outlined above.

You can also restrict use of the `/msg` and `/r` commands in certain servers through the `restricted_servers` section
under `message_command`.

On a single-server setup, this is ignored.
You can also restrict use of the `/msg` and `/r` commands in certain servers through the `restricted_servers` section under `message_command` (in [`config.yml`](config-files)).
Loading

0 comments on commit dcdb4e4

Please sign in to comment.