mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 14:38:48 +00:00
Register 'global' channel by default
This commit is contained in:
3 files changed
+9
-9
No files matched your search
@@ -152,10 +152,12 @@ public class CarbonChannelRegistry implements ChannelRegistry, DefaultedRegistry
|
||||
public void loadConfigChannels() {
|
||||
this.defaultKey = this.configFactory.primaryConfig().defaultChannel();
|
||||
|
||||
if (!Files.exists(this.configChannelDir) || this.isPathEmpty(this.configChannelDir)) {
|
||||
if (!Files.exists(this.configChannelDir)) {
|
||||
// no channels to register, register default channel
|
||||
this.registerDefaultChannel();
|
||||
return;
|
||||
} else if (this.isPathEmpty(this.configChannelDir)) {
|
||||
this.register(this.basicChannel.key(), this.basicChannel);
|
||||
}
|
||||
|
||||
// otherwise, register all channels found
|
||||
@@ -218,19 +220,17 @@ public class CarbonChannelRegistry implements ChannelRegistry, DefaultedRegistry
|
||||
try {
|
||||
Files.createDirectories(this.configChannelDir);
|
||||
|
||||
this.register(this.basicChannel.key(), this.basicChannel);
|
||||
|
||||
final Path configFile = this.configChannelDir.resolve("basic-channel.conf.example");
|
||||
final Path configFile = this.configChannelDir.resolve("global.conf");
|
||||
|
||||
final var loader = this.configLoader.configurationLoader(configFile);
|
||||
final var node = loader.load();
|
||||
|
||||
final var configChannel = this.injector.getInstance(ConfigChatChannel.class);
|
||||
node.set(ConfigChatChannel.class, configChannel);
|
||||
|
||||
node.set(ConfigChatChannel.class, configChannel);
|
||||
loader.save(node);
|
||||
|
||||
this.logger.info("No custom channels defined! Using basic handler.");
|
||||
this.register(configChannel.key(), configChannel);
|
||||
} catch (final IOException exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -68,14 +68,14 @@ public final class ConfigChatChannel implements ChatChannel {
|
||||
You only need to change the second part of the key. "global" by default.
|
||||
The value is what's used in commands, this is probably what you want to change.
|
||||
""")
|
||||
private @Nullable Key key = Key.key("carbon", "basic");
|
||||
private @Nullable Key key = Key.key("carbon", "global");
|
||||
|
||||
@Comment("""
|
||||
The permission required to use the channel.
|
||||
To read messages you must have the permission carbon.channel.basic.see
|
||||
To send messages you must have the permission carbon.channel.basic.speak
|
||||
""")
|
||||
private @Nullable String permission = "carbon.channel.basic";
|
||||
private @Nullable String permission = "carbon.channel.global";
|
||||
|
||||
@Setting("format")
|
||||
@Comment("The chat formats for this channel.")
|
||||
|
||||
@@ -38,7 +38,7 @@ public class PrimaryConfig {
|
||||
The default channel that new players will be in when they join.
|
||||
If the channel is not found or the player cannot use the channel, they will speak in basic non-channel chat.
|
||||
""")
|
||||
private Key defaultChannel = Key.key("carbon", "basic");
|
||||
private Key defaultChannel = Key.key("carbon", "global");
|
||||
|
||||
@Comment("The service that will be used to store and load player information.")
|
||||
private StorageType storageType = StorageType.JSON;
|
||||
|
||||
Reference in new issue
Block a user