Fixed npe in chat command

This commit is contained in:
Fabrizio La Rosa 2020-07-12 13:16:18 +02:00
parent 4afb226e37
commit 4400ac4297

View File

@ -68,12 +68,17 @@ public class ChatCommand extends SubCommand {
island = plugin.getIslandManager().getIsland(player);
}
if (island != null) {
Island finalIsland = island;
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
PlayerIslandChatEvent islandChatEvent = new PlayerIslandChatEvent(player, finalIsland.getAPIWrapper(),
String.join(" ", args), configLoad.getString("Island.Chat.Format.Message"));
Bukkit.getServer().getPluginManager().callEvent(islandChatEvent);
});
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Chat.Owner.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
}
}
}