diff --git a/multichat/src/main/java/xyz/olivermartin/multichat/local/common/config/LocalConfig.java b/multichat/src/main/java/xyz/olivermartin/multichat/local/common/config/LocalConfig.java index a969dd37..b903aea0 100644 --- a/multichat/src/main/java/xyz/olivermartin/multichat/local/common/config/LocalConfig.java +++ b/multichat/src/main/java/xyz/olivermartin/multichat/local/common/config/LocalConfig.java @@ -16,6 +16,8 @@ public abstract class LocalConfig { // SERVER SETTINGS private String serverName; + private String defaultChannel; + // GLOBAL CHAT SETTINGS private boolean overrideGlobalFormat; private String overrideGlobalFormatFormat; @@ -118,6 +120,8 @@ private void setMemberAttributes() { // Server serverName = getString("server_name","SPIGOT_SERVER"); + defaultChannel = getString("default_channel","global"); + // Global Chat overrideGlobalFormat = getBoolean("override_global_format", false); overrideGlobalFormatFormat = getString("override_global_format_format", "&5[&dG&5] &f%DISPLAYNAME%&f: "); @@ -182,6 +186,13 @@ public String getServerName() { return serverName; } + /** + * @return the defaultChannel + */ + public String getDefaultChannel() { + return defaultChannel; + } + /** * @return the overrideGlobalFormat */ diff --git a/multichat/src/main/java/xyz/olivermartin/multichat/local/common/listeners/LocalLoginLogoutListener.java b/multichat/src/main/java/xyz/olivermartin/multichat/local/common/listeners/LocalLoginLogoutListener.java index 9e387802..658ad092 100644 --- a/multichat/src/main/java/xyz/olivermartin/multichat/local/common/listeners/LocalLoginLogoutListener.java +++ b/multichat/src/main/java/xyz/olivermartin/multichat/local/common/listeners/LocalLoginLogoutListener.java @@ -5,6 +5,7 @@ import xyz.olivermartin.multichat.local.common.MultiChatLocal; import xyz.olivermartin.multichat.local.common.MultiChatLocalPlayer; +import xyz.olivermartin.multichat.local.common.config.LocalConfig; public abstract class LocalLoginLogoutListener { @@ -17,7 +18,7 @@ protected void handleLoginEvent(MultiChatLocalPlayer player) { Map playerChannels = MultiChatLocal.getInstance().getDataStore().getPlayerChannels(); synchronized (playerChannels) { if (!playerChannels.containsKey(player.getUniqueId())) { - playerChannels.put(player.getUniqueId(), "global"); + playerChannels.put(player.getUniqueId(), MultiChatLocal.getInstance().getConfigManager().getLocalConfig().getDefaultChannel()); } } diff --git a/multichat/src/main/resources/localconfig.yml b/multichat/src/main/resources/localconfig.yml index 078964c2..1a5ec38e 100644 --- a/multichat/src/main/resources/localconfig.yml +++ b/multichat/src/main/resources/localconfig.yml @@ -20,6 +20,9 @@ version: "1.9.6" # # Specify the name of this server here for the %SERVER% placeholder server_name: "UNNAMED_SERVER" +# Specify the channel the user should connect to when first joining (local / global) +default_channel: "global" + ############################################################ # +------------------------------------------------------+ # # | Global | #