From c6e885a8de2ff7640cfd8432fe5d23ea59bec2d3 Mon Sep 17 00:00:00 2001 From: Tastybento Date: Wed, 13 Dec 2017 23:31:14 -0800 Subject: [PATCH] Added abstract class to handle the invite map. --- .../api/commands/CommandArgument.java | 2 ++ .../AbstractIslandTeamCommandArgument.java | 18 ++++++++++++++++++ .../island/IslandTeamInviteCommand.java | 12 +----------- .../island/IslandTeamUninviteCommand.java | 12 +----------- 4 files changed, 22 insertions(+), 22 deletions(-) create mode 100644 src/main/java/us/tastybento/bskyblock/commands/island/AbstractIslandTeamCommandArgument.java diff --git a/src/main/java/us/tastybento/bskyblock/api/commands/CommandArgument.java b/src/main/java/us/tastybento/bskyblock/api/commands/CommandArgument.java index c999f5e12..0fa2f74e3 100644 --- a/src/main/java/us/tastybento/bskyblock/api/commands/CommandArgument.java +++ b/src/main/java/us/tastybento/bskyblock/api/commands/CommandArgument.java @@ -29,6 +29,8 @@ public abstract class CommandArgument { this.subCommands = new LinkedHashMap<>(); } + public CommandArgument() {} + public abstract boolean execute(CommandSender sender, String[] args); public abstract Set tabComplete(CommandSender sender, String[] args); diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/AbstractIslandTeamCommandArgument.java b/src/main/java/us/tastybento/bskyblock/commands/island/AbstractIslandTeamCommandArgument.java new file mode 100644 index 000000000..c22aef5fb --- /dev/null +++ b/src/main/java/us/tastybento/bskyblock/commands/island/AbstractIslandTeamCommandArgument.java @@ -0,0 +1,18 @@ +package us.tastybento.bskyblock.commands.island; + +import java.util.UUID; + +import com.google.common.collect.BiMap; +import com.google.common.collect.HashBiMap; + +import us.tastybento.bskyblock.api.commands.CommandArgument; + +public abstract class AbstractIslandTeamCommandArgument extends CommandArgument { + + protected BiMap inviteList = HashBiMap.create(); + + public AbstractIslandTeamCommandArgument(String label, String... aliases) { + super(label,aliases); + } + +} diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/IslandTeamInviteCommand.java b/src/main/java/us/tastybento/bskyblock/commands/island/IslandTeamInviteCommand.java index 7bd2c8645..e0f563b59 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/IslandTeamInviteCommand.java +++ b/src/main/java/us/tastybento/bskyblock/commands/island/IslandTeamInviteCommand.java @@ -12,23 +12,13 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.permissions.PermissionAttachmentInfo; -import com.google.common.collect.BiMap; -import com.google.common.collect.HashBiMap; - -import us.tastybento.bskyblock.api.commands.CommandArgument; import us.tastybento.bskyblock.api.events.team.TeamEvent; import us.tastybento.bskyblock.api.events.team.TeamEvent.TeamReason; import us.tastybento.bskyblock.config.Settings; import us.tastybento.bskyblock.util.Util; import us.tastybento.bskyblock.util.VaultHelper; -public class IslandTeamInviteCommand extends CommandArgument { - /** - * Invite list - invited player name string (key), inviter name string - * (value) - */ - private final BiMap inviteList = HashBiMap.create(); - +public class IslandTeamInviteCommand extends AbstractIslandTeamCommandArgument { public IslandTeamInviteCommand() { super("invite"); diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/IslandTeamUninviteCommand.java b/src/main/java/us/tastybento/bskyblock/commands/island/IslandTeamUninviteCommand.java index 636be2f2b..445cf9912 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/IslandTeamUninviteCommand.java +++ b/src/main/java/us/tastybento/bskyblock/commands/island/IslandTeamUninviteCommand.java @@ -7,23 +7,13 @@ import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import com.google.common.collect.BiMap; -import com.google.common.collect.HashBiMap; - -import us.tastybento.bskyblock.api.commands.CommandArgument; import us.tastybento.bskyblock.api.events.team.TeamEvent; import us.tastybento.bskyblock.api.events.team.TeamEvent.TeamReason; import us.tastybento.bskyblock.config.Settings; import us.tastybento.bskyblock.util.VaultHelper; -public class IslandTeamUninviteCommand extends CommandArgument { +public class IslandTeamUninviteCommand extends AbstractIslandTeamCommandArgument { - /** - * TODO: this actually needs to be the same as what is in the IslandTeamInvite class! - */ - private final BiMap inviteList = HashBiMap.create(); - - public IslandTeamUninviteCommand() { super("uninvite"); }