diff --git a/pom.xml b/pom.xml index 596c764..0b26828 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.github.ucchyocean LunaChat - 2.6.10 + 2.6.11 チャンネルチャットプラグイン diff --git a/src/main/java/com/github/ucchyocean/lc/event/LunaChatBaseEvent.java b/src/main/java/com/github/ucchyocean/lc/event/LunaChatBaseEvent.java index 2a1577d..d129660 100644 --- a/src/main/java/com/github/ucchyocean/lc/event/LunaChatBaseEvent.java +++ b/src/main/java/com/github/ucchyocean/lc/event/LunaChatBaseEvent.java @@ -8,6 +8,9 @@ package com.github.ucchyocean.lc.event; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; +import com.github.ucchyocean.lc.LunaChat; +import com.github.ucchyocean.lc.channel.Channel; + /** * 基底イベントクラス * @author ucchy @@ -35,9 +38,18 @@ public abstract class LunaChatBaseEvent extends Event { } /** + * チャンネル名を取得する * @return チャンネル名 */ public String getChannelName() { return channelName; } + + /** + * チャンネルを取得する + * @return チャンネル + */ + public Channel getChannel() { + return LunaChat.getInstance().getLunaChatAPI().getChannel(channelName); + } } diff --git a/src/main/java/com/github/ucchyocean/lc/event/LunaChatChannelCreateEvent.java b/src/main/java/com/github/ucchyocean/lc/event/LunaChatChannelCreateEvent.java index e57d590..9c3bf17 100644 --- a/src/main/java/com/github/ucchyocean/lc/event/LunaChatChannelCreateEvent.java +++ b/src/main/java/com/github/ucchyocean/lc/event/LunaChatChannelCreateEvent.java @@ -7,6 +7,8 @@ package com.github.ucchyocean.lc.event; import org.bukkit.command.CommandSender; +import com.github.ucchyocean.lc.channel.Channel; + /** * チャンネル作成イベント * @author ucchy @@ -35,4 +37,14 @@ public class LunaChatChannelCreateEvent extends LunaChatBaseCancellableEvent { public CommandSender getSender() { return sender; } + + /** + * @deprecated チャンネル作成イベントは、チャンネルを作成する前に呼び出されるので、 + * このメソッドの戻り値は必ずnullになります。 + * @see com.github.ucchyocean.lc.event.LunaChatBaseEvent#getChannel() + */ + @Override + public Channel getChannel() { + return super.getChannel(); + } }