Stop use of commands with console causing crash reports

This commit is contained in:
Alastair 2017-07-14 00:56:39 +01:00
parent b29d7f35c5
commit 3551066e21
2 changed files with 8 additions and 0 deletions

View File

@ -42,6 +42,10 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
public boolean onCommand(CommandSender sender, Command cmd, String command, String[] args) {
ConfigAccessor config = new ConfigAccessor(plugin, "config.yml");
ConfigAccessor portalConfig = new ConfigAccessor(plugin, "portals.yml");
if(!(sender instanceof Player)) {
sender.sendMessage(PluginMessages.customPrefixFail + " You cannot use commands with the console.");
return true;
}
Player player = (Player) sender;
PlayerInventory inventory = player.getInventory();

View File

@ -27,6 +27,10 @@ public class DestinationCommand implements CommandExecutor, TabCompleter {
@Override
public boolean onCommand(CommandSender sender, Command cmd, String command, String[] args) {
if(!(sender instanceof Player)) {
sender.sendMessage(PluginMessages.customPrefixFail + " You cannot use commands with the console.");
return true;
}
ConfigAccessor config = new ConfigAccessor(plugin, "destinations.yml");
if (args.length > 0) { switch (args[0].toLowerCase()) {
case "create":