From 9284707db62820d47da34c933a55ea71dfcc656a Mon Sep 17 00:00:00 2001 From: Driftay Date: Sat, 30 Nov 2019 00:41:44 -0500 Subject: [PATCH] Fixed ArrayIndexOutOfBounds Exception With Deinvite Command --- src/main/java/com/massivecraft/factions/cmd/CmdDeinvite.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdDeinvite.java b/src/main/java/com/massivecraft/factions/cmd/CmdDeinvite.java index cc269337..3aaed668 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdDeinvite.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdDeinvite.java @@ -31,9 +31,11 @@ public class CmdDeinvite extends FCommand { // Check if arg 0 == null do you don't have // `No player "null" could be found.` message. + if (context.args.get(0) == null) { FancyMessage msg = new FancyMessage(TL.COMMAND_DEINVITE_CANDEINVITE.toString()).color(ChatColor.GOLD); for (String id : context.faction.getInvites()) { + if(context.faction.getInvites().isEmpty()) return; FPlayer fp = FPlayers.getInstance().getById(id); String name = fp != null ? fp.getName() : id; msg.then(name + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_DEINVITE_CLICKTODEINVITE.format(name)).command("/" + Conf.baseCommandAliases.get(0) + " deinvite " + name); @@ -54,6 +56,7 @@ public class CmdDeinvite extends FCommand { if (you == null) { FancyMessage msg = new FancyMessage(TL.COMMAND_DEINVITE_CANDEINVITE.toString()).color(ChatColor.GOLD); for (String id : context.faction.getInvites()) { + if(context.faction.getInvites().isEmpty()) return; FPlayer fp = FPlayers.getInstance().getById(id); String name = fp != null ? fp.getName() : id; msg.then(name + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_DEINVITE_CLICKTODEINVITE.format(name)).command("/" + Conf.baseCommandAliases.get(0) + " deinvite " + name);