Added abstract class to handle the invite map.

This commit is contained in:
Tastybento 2017-12-13 23:31:14 -08:00
parent 4b9762fb81
commit c6e885a8de
4 changed files with 22 additions and 22 deletions

View File

@ -29,6 +29,8 @@ public abstract class CommandArgument {
this.subCommands = new LinkedHashMap<>(); this.subCommands = new LinkedHashMap<>();
} }
public CommandArgument() {}
public abstract boolean execute(CommandSender sender, String[] args); public abstract boolean execute(CommandSender sender, String[] args);
public abstract Set<String> tabComplete(CommandSender sender, String[] args); public abstract Set<String> tabComplete(CommandSender sender, String[] args);

View File

@ -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<UUID, UUID> inviteList = HashBiMap.create();
public AbstractIslandTeamCommandArgument(String label, String... aliases) {
super(label,aliases);
}
}

View File

@ -12,23 +12,13 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionAttachmentInfo; 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;
import us.tastybento.bskyblock.api.events.team.TeamEvent.TeamReason; import us.tastybento.bskyblock.api.events.team.TeamEvent.TeamReason;
import us.tastybento.bskyblock.config.Settings; import us.tastybento.bskyblock.config.Settings;
import us.tastybento.bskyblock.util.Util; import us.tastybento.bskyblock.util.Util;
import us.tastybento.bskyblock.util.VaultHelper; import us.tastybento.bskyblock.util.VaultHelper;
public class IslandTeamInviteCommand extends CommandArgument { public class IslandTeamInviteCommand extends AbstractIslandTeamCommandArgument {
/**
* Invite list - invited player name string (key), inviter name string
* (value)
*/
private final BiMap<UUID, UUID> inviteList = HashBiMap.create();
public IslandTeamInviteCommand() { public IslandTeamInviteCommand() {
super("invite"); super("invite");

View File

@ -7,22 +7,12 @@ import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; 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;
import us.tastybento.bskyblock.api.events.team.TeamEvent.TeamReason; import us.tastybento.bskyblock.api.events.team.TeamEvent.TeamReason;
import us.tastybento.bskyblock.config.Settings; import us.tastybento.bskyblock.config.Settings;
import us.tastybento.bskyblock.util.VaultHelper; 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<UUID, UUID> inviteList = HashBiMap.create();
public IslandTeamUninviteCommand() { public IslandTeamUninviteCommand() {
super("uninvite"); super("uninvite");