mirror of
https://github.com/darksaid98/TownyChat.git
synced 2026-12-02 14:38:57 +00:00
Implemented PlayerJoinChatChannelEvent
This commit is contained in:
2 files changed
+41
No files matched your search
@@ -3,6 +3,7 @@ package com.palmergames.bukkit.TownyChat.Command;
|
||||
import com.palmergames.bukkit.TownyChat.Chat;
|
||||
import com.palmergames.bukkit.TownyChat.channels.Channel;
|
||||
import com.palmergames.bukkit.TownyChat.channels.channelTypes;
|
||||
import com.palmergames.bukkit.TownyChat.events.PlayerJoinChatChannelEvent;
|
||||
import com.palmergames.bukkit.TownyChat.util.TownyUtil;
|
||||
import com.palmergames.bukkit.towny.TownyMessaging;
|
||||
import com.palmergames.bukkit.towny.command.BaseCommand;
|
||||
@@ -389,6 +390,8 @@ public class ChannelCommand extends BaseCommand implements CommandExecutor {
|
||||
return;
|
||||
}
|
||||
|
||||
Bukkit.getPluginManager().callEvent(new PlayerJoinChatChannelEvent(player, chan));
|
||||
|
||||
TownyMessaging.sendMessage(player, Translation.of("tc_you_joined_channel", chan.getName()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.palmergames.bukkit.TownyChat.events;
|
||||
|
||||
import com.palmergames.bukkit.TownyChat.channels.Channel;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Created by Glare
|
||||
* Date: 12/14/2020
|
||||
* Time: 4:56 PM
|
||||
*/
|
||||
public class PlayerJoinChatChannelEvent extends Event {
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
private final Player player;
|
||||
private final Channel channel;
|
||||
|
||||
public PlayerJoinChatChannelEvent(Player player, Channel channel) {
|
||||
this.player = player;
|
||||
this.channel = channel;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLERS;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return HANDLERS;
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
public Channel getChannel() {
|
||||
return channel;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user