mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-02 06:28:54 +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
|
||||
|
||||
Reference in new issue
Block a user