mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-04 06:28:53 +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.SimpleChat;
|
||||||
import net.draycia.simplechat.channels.ChatChannel;
|
import net.draycia.simplechat.channels.ChatChannel;
|
||||||
|
import net.draycia.simplechat.events.ChannelSwitchEvent;
|
||||||
import net.draycia.simplechat.storage.ChatUser;
|
import net.draycia.simplechat.storage.ChatUser;
|
||||||
import net.draycia.simplechat.storage.UserChannelSettings;
|
import net.draycia.simplechat.storage.UserChannelSettings;
|
||||||
import net.kyori.adventure.audience.Audience;
|
import net.kyori.adventure.audience.Audience;
|
||||||
@@ -76,6 +77,8 @@ public class SimpleChatUser implements ChatUser, ForwardingAudience {
|
|||||||
public void setSelectedChannel(ChatChannel chatChannel) {
|
public void setSelectedChannel(ChatChannel chatChannel) {
|
||||||
this.selectedChannel = chatChannel.getName();
|
this.selectedChannel = chatChannel.getName();
|
||||||
syncToRedis();
|
syncToRedis();
|
||||||
|
|
||||||
|
Bukkit.getPluginManager().callEvent(new ChannelSwitchEvent(chatChannel, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in new issue
Block a user