mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-02 14:38:49 +00:00
Add ChannelSwitchEvent
This commit is contained in:
1 parent
33bf1414ee
commit
272734b8e4
2 files changed
+42
No files matched your search
@@ -0,0 +1,39 @@
|
||||
package net.draycia.simplechat.events;
|
||||
|
||||
import net.draycia.simplechat.channels.ChatChannel;
|
||||
import net.draycia.simplechat.storage.ChatUser;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class ChannelSwitchEvent extends Event {
|
||||
|
||||
/** Bukkit event stuff **/
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/** Relevant stuff **/
|
||||
private ChatChannel channel;
|
||||
private ChatUser user;
|
||||
|
||||
public ChannelSwitchEvent(ChatChannel channel, ChatUser user) {
|
||||
this.channel = channel;
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public ChatUser getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public ChatChannel getChannel() {
|
||||
return channel;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package net.draycia.simplechat.storage.impl;
|
||||
|
||||
import net.draycia.simplechat.SimpleChat;
|
||||
import net.draycia.simplechat.channels.ChatChannel;
|
||||
import net.draycia.simplechat.events.ChannelSwitchEvent;
|
||||
import net.draycia.simplechat.storage.ChatUser;
|
||||
import net.draycia.simplechat.storage.UserChannelSettings;
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
@@ -76,6 +77,8 @@ public class SimpleChatUser implements ChatUser, ForwardingAudience {
|
||||
public void setSelectedChannel(ChatChannel chatChannel) {
|
||||
this.selectedChannel = chatChannel.getName();
|
||||
syncToRedis();
|
||||
|
||||
Bukkit.getPluginManager().callEvent(new ChannelSwitchEvent(chatChannel, this));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user