Fix issue with VanillaCommandListener on <1.15

This commit is contained in:
Norbi Peti 2020-04-08 00:13:19 +02:00
parent b484fe6f64
commit cce7f59f4a
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56
4 changed files with 4 additions and 4 deletions

View file

@ -180,7 +180,7 @@
<dependency>
<groupId>com.discord4j</groupId>
<artifactId>discord4j-core</artifactId>
<version>3.0.12</version>
<version>3.0.13</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-jdk14 -->
<dependency>

View file

@ -14,7 +14,7 @@ import org.bukkit.entity.Player;
@CommandClass(helpText = {
"Connect command", //
"This command lets you connect your account with a Minecraft account. This allows using the Minecraft chat and other things.", //
"This command lets you connect your account with a Minecraft account. This allows using the private Minecraft chat and other things.", //
})
public class ConnectCommand extends ICommand2DC {

View file

@ -37,7 +37,7 @@ public class VanillaCommandListener<T extends DiscordSenderBase & IMCPlayer<T>>
public VanillaCommandListener(T player, Player bukkitplayer) {
this.player = player;
this.bukkitplayer = bukkitplayer;
if (!(bukkitplayer instanceof CraftPlayer))
if (bukkitplayer != null && !(bukkitplayer instanceof CraftPlayer))
throw new ClassCastException("bukkitplayer must be a Bukkit player!");
}

View file

@ -39,7 +39,7 @@ public class VanillaCommandListener14<T extends DiscordSenderBase & IMCPlayer<T>
public VanillaCommandListener14(T player, Player bukkitplayer) {
this.player = player;
this.bukkitplayer = bukkitplayer;
if (!(bukkitplayer instanceof CraftPlayer))
if (bukkitplayer != null && !(bukkitplayer instanceof CraftPlayer))
throw new ClassCastException("bukkitplayer must be a Bukkit player!");
}