mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2025-12-05 11:44:15 +01:00
Stop use of commands with console causing crash reports
This commit is contained in:
parent
b29d7f35c5
commit
3551066e21
@ -42,6 +42,10 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
|
|||||||
public boolean onCommand(CommandSender sender, Command cmd, String command, String[] args) {
|
public boolean onCommand(CommandSender sender, Command cmd, String command, String[] args) {
|
||||||
ConfigAccessor config = new ConfigAccessor(plugin, "config.yml");
|
ConfigAccessor config = new ConfigAccessor(plugin, "config.yml");
|
||||||
ConfigAccessor portalConfig = new ConfigAccessor(plugin, "portals.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;
|
Player player = (Player) sender;
|
||||||
PlayerInventory inventory = player.getInventory();
|
PlayerInventory inventory = player.getInventory();
|
||||||
|
|
||||||
|
|||||||
@ -27,6 +27,10 @@ public class DestinationCommand implements CommandExecutor, TabCompleter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command cmd, String command, String[] args) {
|
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");
|
ConfigAccessor config = new ConfigAccessor(plugin, "destinations.yml");
|
||||||
if (args.length > 0) { switch (args[0].toLowerCase()) {
|
if (args.length > 0) { switch (args[0].toLowerCase()) {
|
||||||
case "create":
|
case "create":
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user