mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-02 14:38:49 +00:00
Allow setting channel on join
This commit is contained in:
1 parent
75ff948a26
commit
9beb9f8397
2 files changed
+25
No files matched your search
@@ -1,6 +1,7 @@
|
||||
package net.draycia.carbon.listeners;
|
||||
|
||||
import net.draycia.carbon.CarbonChat;
|
||||
import net.draycia.carbon.channels.ChatChannel;
|
||||
import net.draycia.carbon.storage.ChatUser;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
@@ -24,6 +25,23 @@ public class PlayerJoinListener implements Listener {
|
||||
if (user.getNickname() != null) {
|
||||
user.setNickname(user.getNickname());
|
||||
}
|
||||
|
||||
String channel = carbonChat.getConfig().getString("channel-on-join");
|
||||
|
||||
if (channel == null || channel.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (channel.equals("DEFAULT")) {
|
||||
user.setSelectedChannel(carbonChat.getChannelManager().getDefaultChannel());
|
||||
return;
|
||||
}
|
||||
|
||||
ChatChannel chatChannel = carbonChat.getChannelManager().getRegistry().get(channel);
|
||||
|
||||
if (chatChannel != null) {
|
||||
user.setSelectedChannel(chatChannel);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
||||
@@ -99,6 +99,13 @@ placeholders:
|
||||
prefix: "<gray>[<group><gray>]"
|
||||
group: "<green>%vault_group%"
|
||||
|
||||
# Sets the player's channel to the specified channel when they join
|
||||
# Set to "" or remove to disable
|
||||
# Set to DEFAULT to set the player's channel to the default channel on join
|
||||
# Otherwise, set to a channel to set the player's channel to it on join
|
||||
# For example, channel-on-join: "global" sets their channel to global on join
|
||||
channel-on-join: ""
|
||||
|
||||
# Global context options
|
||||
contexts:
|
||||
Towny:
|
||||
|
||||
Reference in new issue
Block a user