mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-02 14:38:49 +00:00
Fix loading channels (for real this time)
This commit is contained in:
1 parent
9c4187124a
commit
f8c465925a
3 files changed
+12
-10
No files matched your search
@@ -8,7 +8,6 @@ import org.spongepowered.configurate.objectmapping.ObjectMappingException;
|
||||
import org.spongepowered.configurate.objectmapping.Setting;
|
||||
import org.spongepowered.configurate.serialize.ConfigSerializable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -45,9 +44,6 @@ public class CarbonSettings {
|
||||
@Setting(comment = "Set this to false to disable warnings and tips when the plugin thinks there may be configuration issues.")
|
||||
private boolean showTips = true;
|
||||
|
||||
@Setting(comment = "")
|
||||
private @NonNull List<@NonNull ChannelOptions> channelSettings = new ArrayList<>(); // TODO: unfuck this, it's loaded from file?
|
||||
|
||||
@Setting(comment = "Options: JSON, MYSQL")
|
||||
private @Nullable StorageType storageType = StorageType.JSON;
|
||||
|
||||
@@ -108,10 +104,6 @@ public class CarbonSettings {
|
||||
return this.showTips;
|
||||
}
|
||||
|
||||
public @NonNull List<@NonNull ChannelOptions> channelOptions() {
|
||||
return this.channelSettings;
|
||||
}
|
||||
|
||||
public @Nullable StorageType storageType() {
|
||||
return this.storageType;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import net.draycia.carbon.api.config.StorageType;
|
||||
import net.draycia.carbon.api.messaging.MessageService;
|
||||
import net.draycia.carbon.api.users.ChatUser;
|
||||
import net.draycia.carbon.common.adventure.FormatType;
|
||||
import net.draycia.carbon.common.channels.ChannelManager;
|
||||
import net.draycia.carbon.common.config.KeySerializer;
|
||||
import net.draycia.carbon.common.config.SoundSerializer;
|
||||
import net.draycia.carbon.common.messaging.EmptyMessageService;
|
||||
@@ -123,6 +124,8 @@ public final class CarbonChatBukkit extends JavaPlugin implements CarbonChat {
|
||||
// Initialize managers
|
||||
this.channelRegistry = new ChannelRegistry();
|
||||
|
||||
new ChannelManager(this);
|
||||
|
||||
// Handle messaging service
|
||||
final MessagingType messagingType = this.carbonSettings().messagingType();
|
||||
final MessageService messageService;
|
||||
|
||||
+9
-2
@@ -12,6 +12,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
public class ChannelManager {
|
||||
|
||||
@@ -29,6 +30,7 @@ public class ChannelManager {
|
||||
this.carbonChat = carbonChat;
|
||||
this.registry = new ChannelRegistry();
|
||||
|
||||
this.carbonChat.logger().info("Loading channels!");
|
||||
this.reload();
|
||||
}
|
||||
|
||||
@@ -84,8 +86,13 @@ public class ChannelManager {
|
||||
}
|
||||
|
||||
private void reload() {
|
||||
for (final ChannelOptions options : this.carbonChat.carbonSettings().channelOptions()) {
|
||||
final ChatChannel channel = this.loadChannel(options);
|
||||
this.carbonChat.logger().info("Channels found: " +
|
||||
this.carbonChat.channelSettings().channelOptions().size());
|
||||
|
||||
for (final Map.Entry<String, ChannelOptions> options :
|
||||
this.carbonChat.channelSettings().channelOptions().entrySet()) {
|
||||
|
||||
final ChatChannel channel = this.loadChannel(options.getValue());
|
||||
|
||||
if (channel != null) {
|
||||
this.registerChannel(channel);
|
||||
|
||||
Reference in new issue
Block a user