Skip to content

Commit 9db7649

Browse files
Removed overloaded method & replaced with casting
1 parent 3c07442 commit 9db7649

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

src/main/java/net/javadiscord/javabot/systems/help/forum/ForumHelpListener.java

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@
55
import net.dv8tion.jda.api.EmbedBuilder;
66
import net.dv8tion.jda.api.entities.Message;
77
import net.dv8tion.jda.api.entities.UserSnowflake;
8+
import net.dv8tion.jda.api.entities.channel.Channel;
89
import net.dv8tion.jda.api.entities.channel.ChannelType;
910
import net.dv8tion.jda.api.entities.channel.concrete.ForumChannel;
1011
import net.dv8tion.jda.api.entities.channel.concrete.ThreadChannel;
11-
import net.dv8tion.jda.api.entities.channel.unions.ChannelUnion;
12-
import net.dv8tion.jda.api.entities.channel.unions.MessageChannelUnion;
13-
import net.dv8tion.jda.api.entities.emoji.Emoji;
1412
import net.dv8tion.jda.api.events.channel.ChannelCreateEvent;
1513
import net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent;
1614
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
@@ -109,14 +107,9 @@ public void handleButton(@NotNull ButtonInteractionEvent event, @NotNull Button
109107
}
110108
}
111109

112-
private boolean isInvalidForumPost(@NotNull MessageChannelUnion union) {
113-
return union.getType() != ChannelType.GUILD_PUBLIC_THREAD ||
114-
union.asThreadChannel().getParentChannel().getType() != ChannelType.FORUM;
115-
}
116-
117-
private boolean isInvalidForumPost(@NotNull ChannelUnion union) {
118-
return union.getType() != ChannelType.GUILD_PUBLIC_THREAD ||
119-
union.asThreadChannel().getParentChannel().getType() != ChannelType.FORUM;
110+
private boolean isInvalidForumPost(@NotNull Channel channel) {
111+
return channel.getType() != ChannelType.GUILD_PUBLIC_THREAD ||
112+
((ThreadChannel) channel).getParentChannel().getType() != ChannelType.FORUM;
120113
}
121114

122115
private boolean isInvalidHelpForumChannel(@NotNull ForumChannel forum) {

0 commit comments

Comments
 (0)