Fixed ArrayIndexOutOfBounds Exception With Deinvite Command
This commit is contained in:
parent
7b07e3ed23
commit
9284707db6
@ -31,9 +31,11 @@ public class CmdDeinvite extends FCommand {
|
|||||||
|
|
||||||
// Check if arg 0 == null do you don't have
|
// Check if arg 0 == null do you don't have
|
||||||
// `No player "null" could be found.` message.
|
// `No player "null" could be found.` message.
|
||||||
|
|
||||||
if (context.args.get(0) == null) {
|
if (context.args.get(0) == null) {
|
||||||
FancyMessage msg = new FancyMessage(TL.COMMAND_DEINVITE_CANDEINVITE.toString()).color(ChatColor.GOLD);
|
FancyMessage msg = new FancyMessage(TL.COMMAND_DEINVITE_CANDEINVITE.toString()).color(ChatColor.GOLD);
|
||||||
for (String id : context.faction.getInvites()) {
|
for (String id : context.faction.getInvites()) {
|
||||||
|
if(context.faction.getInvites().isEmpty()) return;
|
||||||
FPlayer fp = FPlayers.getInstance().getById(id);
|
FPlayer fp = FPlayers.getInstance().getById(id);
|
||||||
String name = fp != null ? fp.getName() : 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);
|
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) {
|
if (you == null) {
|
||||||
FancyMessage msg = new FancyMessage(TL.COMMAND_DEINVITE_CANDEINVITE.toString()).color(ChatColor.GOLD);
|
FancyMessage msg = new FancyMessage(TL.COMMAND_DEINVITE_CANDEINVITE.toString()).color(ChatColor.GOLD);
|
||||||
for (String id : context.faction.getInvites()) {
|
for (String id : context.faction.getInvites()) {
|
||||||
|
if(context.faction.getInvites().isEmpty()) return;
|
||||||
FPlayer fp = FPlayers.getInstance().getById(id);
|
FPlayer fp = FPlayers.getInstance().getById(id);
|
||||||
String name = fp != null ? fp.getName() : 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);
|
msg.then(name + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_DEINVITE_CLICKTODEINVITE.format(name)).command("/" + Conf.baseCommandAliases.get(0) + " deinvite " + name);
|
||||||
|
Loading…
Reference in New Issue
Block a user