mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-28 13:45:14 +01:00
Removed AbstractIslandTeamCommand
This was using static data structure that would not work well when other addons use the command.
This commit is contained in:
parent
35b715ff80
commit
6d17d48bde
@ -68,6 +68,11 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
|
||||
* The command chain from the very top, e.g., island team promote
|
||||
*/
|
||||
private String usage;
|
||||
|
||||
/**
|
||||
* The prefix to be used in this command
|
||||
*/
|
||||
private String permissionPrefix = "";
|
||||
|
||||
/**
|
||||
* Used only for testing....
|
||||
@ -137,6 +142,8 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
|
||||
if (!getSubCommand("help").isPresent() && !label.equals("help")) {
|
||||
new DefaultHelpCommand(this);
|
||||
}
|
||||
// Set permission prefix
|
||||
this.permissionPrefix = parent.getPermissionPrefix();
|
||||
}
|
||||
|
||||
/*
|
||||
@ -377,9 +384,12 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
|
||||
this.parameters = parameters;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.bukkit.command.Command#setPermission(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void setPermission(String permission) {
|
||||
this.permission = permission;
|
||||
this.permission = permissionPrefix + permission;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -454,4 +464,23 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
|
||||
public Map<String, CompositeCommand> getSubCommandAliases() {
|
||||
return subCommandAliases;
|
||||
}
|
||||
|
||||
/**
|
||||
* If the permission prefix has been set, will return the prefix plus a trailing dot.
|
||||
* @return the permissionPrefix
|
||||
*/
|
||||
public String getPermissionPrefix() {
|
||||
return permissionPrefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the permission prefix. This will be added automatically to the permission
|
||||
* and will apply to any sub commands too.
|
||||
* Do not put a dot on the end of it.
|
||||
* @param permissionPrefix the permissionPrefix to set
|
||||
*/
|
||||
public void setPermissionPrefix(String permissionPrefix) {
|
||||
this.permissionPrefix = permissionPrefix + ".";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -110,5 +110,10 @@ public interface WorldSettings {
|
||||
* @return the dragonSpawn
|
||||
*/
|
||||
public boolean isDragonSpawn();
|
||||
|
||||
/**
|
||||
* @return the max team size for this world
|
||||
*/
|
||||
public int getMaxTeamSize();
|
||||
|
||||
}
|
||||
|
@ -25,7 +25,8 @@ public class AdminCommand extends CompositeCommand {
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
setPermission(Constants.PERMPREFIX + "admin.*");
|
||||
setPermissionPrefix("bskyblock");
|
||||
setPermission("admin.*");
|
||||
setOnlyPlayer(false);
|
||||
setParameters("commands.admin.help.parameters");
|
||||
setDescription("commands.admin.help.description");
|
||||
|
@ -40,7 +40,8 @@ public class IslandCommand extends CompositeCommand {
|
||||
setDescription("commands.island.help.description");
|
||||
setOnlyPlayer(true);
|
||||
// Permission
|
||||
setPermission(Constants.PERMPREFIX + "island");
|
||||
setPermissionPrefix("bskyblock");
|
||||
setPermission("island");
|
||||
// Set up subcommands
|
||||
new IslandAboutCommand(this);
|
||||
new IslandCreateCommand(this);
|
||||
@ -56,7 +57,6 @@ public class IslandCommand extends CompositeCommand {
|
||||
new IslandBanlistCommand(this);
|
||||
// Team commands
|
||||
new IslandTeamCommand(this);
|
||||
new IslandTeamInviteCommand(this);
|
||||
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,6 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
@ -33,7 +32,7 @@ public class AdminGetRankCommand extends CompositeCommand {
|
||||
*/
|
||||
@Override
|
||||
public void setup() {
|
||||
setPermission(Constants.PERMPREFIX + "admin.setrank");
|
||||
setPermission("admin.setrank");
|
||||
setOnlyPlayer(false);
|
||||
setParameters("commands.admin.getrank.parameters");
|
||||
setDescription("commands.admin.getrank.description");
|
||||
|
@ -5,7 +5,6 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.World;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
|
||||
@ -17,7 +16,7 @@ public class AdminInfoCommand extends CompositeCommand {
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
setPermission(Constants.PERMPREFIX + "admin.info");
|
||||
setPermission("admin.info");
|
||||
setOnlyPlayer(false);
|
||||
setParameters("commands.admin.info.parameters");
|
||||
setDescription("commands.admin.info.description");
|
||||
|
@ -6,7 +6,6 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.World;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
@ -15,15 +14,15 @@ import us.tastybento.bskyblock.util.Util;
|
||||
public class AdminRegisterCommand extends CompositeCommand {
|
||||
|
||||
public AdminRegisterCommand(CompositeCommand parent) {
|
||||
super(parent, "unregister");
|
||||
super(parent, "register");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
setPermission(Constants.PERMPREFIX + "admin.unregister");
|
||||
setPermission("admin.register");
|
||||
setOnlyPlayer(true);
|
||||
setParameters("commands.admin.unregister.parameters");
|
||||
setDescription("commands.admin.unregister.description");
|
||||
setParameters("commands.admin.register.parameters");
|
||||
setDescription("commands.admin.register.description");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -6,7 +6,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.island.builders.Clipboard;
|
||||
@ -20,7 +19,7 @@ public class AdminSchemCommand extends CompositeCommand {
|
||||
}
|
||||
|
||||
public void setup() {
|
||||
setPermission(Constants.PERMPREFIX + "admin.schem");
|
||||
setPermission("admin.schem");
|
||||
setParameters("commands.admin.schem.parameters");
|
||||
setDescription("commands.admin.schem.description");
|
||||
setOnlyPlayer(true);
|
||||
|
@ -10,7 +10,6 @@ import java.util.stream.Collectors;
|
||||
|
||||
import org.bukkit.World;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
@ -31,7 +30,7 @@ public class AdminSetRankCommand extends CompositeCommand {
|
||||
*/
|
||||
@Override
|
||||
public void setup() {
|
||||
setPermission(Constants.PERMPREFIX + "admin.setrank");
|
||||
setPermission("admin.setrank");
|
||||
setOnlyPlayer(false);
|
||||
setParameters("commands.admin.setrank.parameters");
|
||||
setDescription("commands.admin.setrank.description");
|
||||
|
@ -8,7 +8,6 @@ import java.util.UUID;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.util.Util;
|
||||
@ -22,7 +21,8 @@ public class AdminTeleportCommand extends CompositeCommand {
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
setPermission(Constants.PERMPREFIX + "admin.tp");
|
||||
// Permission
|
||||
setPermission(getPermissionPrefix() + "admin.tp");
|
||||
setOnlyPlayer(true);
|
||||
setParameters("commands.admin.tp.parameters");
|
||||
setDescription("commands.admin.tp.description");
|
||||
|
@ -5,7 +5,6 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.World;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.util.Util;
|
||||
@ -18,7 +17,7 @@ public class AdminUnregisterCommand extends CompositeCommand {
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
setPermission(Constants.PERMPREFIX + "admin.unregister");
|
||||
setPermission("admin.unregister");
|
||||
setParameters("commands.admin.unregister.parameters");
|
||||
setDescription("commands.admin.unregister.description");
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package us.tastybento.bskyblock.commands.admin;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
|
||||
@ -15,7 +14,7 @@ public class AdminVersionCommand extends CompositeCommand {
|
||||
@Override
|
||||
public void setup() {
|
||||
// Permission
|
||||
setPermission(Constants.PERMPREFIX + "admin.version");
|
||||
setPermission(getPermissionPrefix() + "admin.version");
|
||||
setDescription("commands.admin.version.description");
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ public class AdminTeamAddCommand extends CompositeCommand {
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
setPermission(Constants.PERMPREFIX + "admin.team");
|
||||
setPermission("admin.team");
|
||||
setParameters("commands.admin.team.add.parameters");
|
||||
setDescription("commands.admin.team.add.description");
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.World;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
|
||||
@ -17,7 +16,7 @@ public class AdminTeamDisbandCommand extends CompositeCommand {
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
setPermission(Constants.PERMPREFIX + "admin.team");
|
||||
setPermission("admin.team");
|
||||
setParameters("commands.admin.team.disband.parameters");
|
||||
setDescription("commands.admin.team.disband.description");
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.World;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
|
||||
@ -18,7 +17,7 @@ public class AdminTeamKickCommand extends CompositeCommand {
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
setPermission(Constants.PERMPREFIX + "admin.team");
|
||||
setPermission("admin.team");
|
||||
setParameters("commands.admin.team.kick.parameters");
|
||||
setDescription("commands.admin.team.kick.description");
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.World;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
|
||||
@ -17,7 +16,7 @@ public class AdminTeamMakeLeaderCommand extends CompositeCommand {
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
setPermission(Constants.PERMPREFIX + "admin.team");
|
||||
setPermission("admin.team");
|
||||
setParameters("commands.admin.team.makeleader.parameters");
|
||||
setDescription("commands.admin.team.makeleader.description");
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package us.tastybento.bskyblock.commands.island;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.util.Util;
|
||||
@ -48,7 +47,7 @@ public class CustomIslandMultiHomeHelp extends CompositeCommand {
|
||||
private void showPrettyHelp(User user, String usage, String params, String desc) {
|
||||
// Player. Check perms
|
||||
if (user.hasPermission(getPermission())) {
|
||||
int maxHomes = Util.getPermValue(user.getPlayer(), Constants.PERMPREFIX + "island.maxhomes", getSettings().getMaxHomes());
|
||||
int maxHomes = Util.getPermValue(user.getPlayer(), "island.maxhomes", getSettings().getMaxHomes());
|
||||
if (maxHomes > 1) {
|
||||
params = getParameters().isEmpty() ? "" : user.getTranslation(getParameters());
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
@ -23,7 +22,7 @@ public class IslandBanCommand extends CompositeCommand {
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
setPermission(Constants.PERMPREFIX + "island.ban");
|
||||
setPermission("island.ban");
|
||||
setOnlyPlayer(true);
|
||||
setParameters("commands.island.ban.parameters");
|
||||
setDescription("commands.island.ban.description");
|
||||
|
@ -4,7 +4,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
@ -17,7 +16,7 @@ public class IslandBanlistCommand extends CompositeCommand {
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
setPermission(Constants.PERMPREFIX + "island.ban");
|
||||
setPermission("island.ban");
|
||||
setOnlyPlayer(true);
|
||||
setDescription("commands.island.banlist.description");
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import java.util.Set;
|
||||
|
||||
import org.bukkit.World;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.events.island.IslandEvent.Reason;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
@ -29,7 +28,7 @@ public class IslandCreateCommand extends CompositeCommand {
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
setPermission(Constants.PERMPREFIX + "island.create");
|
||||
setPermission("island.create");
|
||||
setOnlyPlayer(true);
|
||||
setDescription("commands.island.create.description");
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import org.apache.commons.lang.math.NumberUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.World;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.commands.IslandCommand;
|
||||
@ -29,7 +28,7 @@ public class IslandGoCommand extends CompositeCommand {
|
||||
*/
|
||||
@Override
|
||||
public void setup() {
|
||||
setPermission(Constants.PERMPREFIX + "island.home");
|
||||
setPermission("island.home");
|
||||
setOnlyPlayer(true);
|
||||
setDescription("commands.island.go.description");
|
||||
new CustomIslandMultiHomeHelp(this);
|
||||
@ -63,7 +62,7 @@ public class IslandGoCommand extends CompositeCommand {
|
||||
}
|
||||
if (!args.isEmpty() && NumberUtils.isDigits(args.get(0))) {
|
||||
int homeValue = Integer.valueOf(args.get(0));
|
||||
int maxHomes = Util.getPermValue(user.getPlayer(), Constants.PERMPREFIX + "island.maxhomes", getSettings().getMaxHomes());
|
||||
int maxHomes = Util.getPermValue(user.getPlayer(), "island.maxhomes", getSettings().getMaxHomes());
|
||||
if (homeValue > 1 && homeValue <= maxHomes) {
|
||||
getIslands().homeTeleport(world, user.getPlayer(), homeValue);
|
||||
return true;
|
||||
|
@ -2,7 +2,6 @@ package us.tastybento.bskyblock.commands.island;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.commands.IslandCommand;
|
||||
@ -22,7 +21,7 @@ public class IslandLanguageCommand extends CompositeCommand {
|
||||
*/
|
||||
@Override
|
||||
public void setup() {
|
||||
setPermission(Constants.PERMPREFIX + "island.language");
|
||||
setPermission("island.language");
|
||||
setOnlyPlayer(true);
|
||||
setDescription("commands.island.language.description");
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ public class IslandResetCommand extends CompositeCommand {
|
||||
public void setup() {
|
||||
cooldown = new HashMap<>();
|
||||
confirm = new HashMap<>();
|
||||
setPermission(Constants.PERMPREFIX + "island.create");
|
||||
setPermission("island.create");
|
||||
setOnlyPlayer(true);
|
||||
setDescription("commands.island.reset.description");
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ package us.tastybento.bskyblock.commands.island;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
|
||||
@ -22,7 +21,7 @@ public class IslandResetnameCommand extends CompositeCommand {
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
setPermission(Constants.PERMPREFIX + "island.name");
|
||||
setPermission("island.name");
|
||||
setOnlyPlayer(true);
|
||||
setDescription("commands.island.resetname.description");
|
||||
|
||||
|
@ -3,7 +3,6 @@ package us.tastybento.bskyblock.commands.island;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.util.Util;
|
||||
@ -16,7 +15,7 @@ public class IslandSethomeCommand extends CompositeCommand {
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
setPermission(Constants.PERMPREFIX + "island.sethome");
|
||||
setPermission("island.sethome");
|
||||
setOnlyPlayer(true);
|
||||
setDescription("commands.island.sethome.description");
|
||||
new CustomIslandMultiHomeHelp(this);
|
||||
@ -40,7 +39,7 @@ public class IslandSethomeCommand extends CompositeCommand {
|
||||
user.sendMessage("commands.island.sethome.home-set");
|
||||
} else {
|
||||
// Dynamic home sizes with permissions
|
||||
int maxHomes = Util.getPermValue(user.getPlayer(), Constants.PERMPREFIX + "island.maxhomes", getSettings().getMaxHomes());
|
||||
int maxHomes = Util.getPermValue(user.getPlayer(), "island.maxhomes", getSettings().getMaxHomes());
|
||||
if (maxHomes > 1) {
|
||||
// Check the number given is a number
|
||||
int number = 0;
|
||||
|
@ -10,7 +10,6 @@ import java.util.stream.Collectors;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
|
||||
@ -26,7 +25,7 @@ public class IslandSetnameCommand extends CompositeCommand {
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
setPermission(Constants.PERMPREFIX + "island.name");
|
||||
setPermission("island.name");
|
||||
setOnlyPlayer(true);
|
||||
setParameters("commands.island.setname.parameters");
|
||||
setDescription("commands.island.setname.description");
|
||||
@ -69,7 +68,7 @@ public class IslandSetnameCommand extends CompositeCommand {
|
||||
}
|
||||
|
||||
// Set the name
|
||||
if (!player.hasPermission(Constants.PERMPREFIX + "island.name.format")) {
|
||||
if (!player.hasPermission("island.name.format")) {
|
||||
getIslands().getIsland(user.getWorld(), player.getUniqueId()).setName(ChatColor.translateAlternateColorCodes('&', name));
|
||||
} else {
|
||||
getIslands().getIsland(user.getWorld(), playerUUID).setName(name);
|
||||
|
@ -2,7 +2,6 @@ package us.tastybento.bskyblock.commands.island;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.commands.IslandCommand;
|
||||
@ -22,7 +21,7 @@ public class IslandSettingsCommand extends CompositeCommand {
|
||||
*/
|
||||
@Override
|
||||
public void setup() {
|
||||
setPermission(Constants.PERMPREFIX + "island.settings");
|
||||
setPermission("island.settings");
|
||||
setOnlyPlayer(true);
|
||||
setDescription("commands.island.settings.description");
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
@ -19,7 +18,7 @@ public class IslandUnbanCommand extends CompositeCommand {
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
setPermission(Constants.PERMPREFIX + "island.ban");
|
||||
setPermission("island.ban");
|
||||
setOnlyPlayer(true);
|
||||
setParameters("commands.island.unban.parameters");
|
||||
setDescription("commands.island.unban.description");
|
||||
|
@ -1,48 +0,0 @@
|
||||
package us.tastybento.bskyblock.commands.island.teams;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.util.Util;
|
||||
|
||||
/**
|
||||
* A safe common space for team commands to share data
|
||||
* @author tastybento
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractIslandTeamCommand extends CompositeCommand {
|
||||
|
||||
protected static final boolean DEBUG = false;
|
||||
protected static BiMap<UUID, UUID> inviteList = HashBiMap.create();
|
||||
// The time a player has to wait until they can reset their island again
|
||||
protected static HashMap<UUID, Long> resetWaitTime = new HashMap<>();
|
||||
protected static Set<UUID> leavingPlayers = new HashSet<>();
|
||||
protected static Set<UUID> kickingPlayers = new HashSet<>();
|
||||
|
||||
public AbstractIslandTeamCommand(CompositeCommand command, String label, String... aliases) {
|
||||
super(command, label,aliases);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a timeout for player into the Hashmap resetWaitTime
|
||||
*
|
||||
* @param player - the player
|
||||
*/
|
||||
protected void setResetWaitTime(final Player player) {
|
||||
resetWaitTime.put(player.getUniqueId(), Calendar.getInstance().getTimeInMillis() + getSettings().getResetWait() * 1000);
|
||||
}
|
||||
|
||||
protected int getMaxTeamSize(User user) {
|
||||
return Util.getPermValue(user.getPlayer(), "team.maxsize.", getSettings().getMaxTeamSize());
|
||||
}
|
||||
}
|
@ -4,29 +4,27 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.events.IslandBaseEvent;
|
||||
import us.tastybento.bskyblock.api.events.team.TeamEvent;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
|
||||
public class IslandTeamCommand extends AbstractIslandTeamCommand {
|
||||
public class IslandTeamCommand extends CompositeCommand {
|
||||
|
||||
public IslandTeamCommand(CompositeCommand islandCommand) {
|
||||
super(islandCommand, "team");
|
||||
private IslandTeamInviteCommand inviteCommand;
|
||||
|
||||
public IslandTeamCommand(CompositeCommand parent) {
|
||||
super(parent, "team");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
setPermission(Constants.PERMPREFIX + "island.team");
|
||||
setPermission("island.team");
|
||||
setOnlyPlayer(true);
|
||||
setDescription("commands.island.team.description");
|
||||
|
||||
new IslandTeamInviteCommand(this);
|
||||
inviteCommand = new IslandTeamInviteCommand(this);
|
||||
new IslandTeamLeaveCommand(this);
|
||||
// TODO: These are still in development
|
||||
//new IslandTeamPromoteCommand(this, "promote");
|
||||
//new IslandTeamPromoteCommand(this, "demote");
|
||||
new IslandTeamSetownerCommand(this);
|
||||
new IslandTeamKickCommand(this);
|
||||
new IslandTeamInviteAcceptCommand(this);
|
||||
@ -50,7 +48,7 @@ public class IslandTeamCommand extends AbstractIslandTeamCommand {
|
||||
}
|
||||
Set<UUID> teamMembers = getMembers(user.getWorld(), user);
|
||||
if (teamLeaderUUID.equals(playerUUID)) {
|
||||
int maxSize = getMaxTeamSize(user);
|
||||
int maxSize = inviteCommand.getMaxTeamSize(user);
|
||||
if (teamMembers.size() < maxSize) {
|
||||
user.sendMessage("commands.island.team.invite.you-can-invite", "[number]", String.valueOf(maxSize - teamMembers.size()));
|
||||
} else {
|
||||
@ -74,4 +72,11 @@ public class IslandTeamCommand extends AbstractIslandTeamCommand {
|
||||
return event.isCancelled();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the inviteCommand
|
||||
*/
|
||||
public IslandTeamInviteCommand getInviteCommand() {
|
||||
return inviteCommand;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -13,15 +13,18 @@ import us.tastybento.bskyblock.api.events.team.TeamEvent;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
|
||||
public class IslandTeamInviteAcceptCommand extends AbstractIslandTeamCommand {
|
||||
public class IslandTeamInviteAcceptCommand extends CompositeCommand {
|
||||
|
||||
private IslandTeamCommand itc;
|
||||
|
||||
public IslandTeamInviteAcceptCommand(CompositeCommand islandTeamCommand) {
|
||||
public IslandTeamInviteAcceptCommand(IslandTeamCommand islandTeamCommand) {
|
||||
super(islandTeamCommand, "accept");
|
||||
this.itc = islandTeamCommand;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
setPermission(Constants.PERMPREFIX + "island.team");
|
||||
setPermission("island.team");
|
||||
setOnlyPlayer(true);
|
||||
setDescription("commands.island.team.invite.accept.description");
|
||||
}
|
||||
@ -30,11 +33,8 @@ public class IslandTeamInviteAcceptCommand extends AbstractIslandTeamCommand {
|
||||
public boolean execute(User user, List<String> args) {
|
||||
|
||||
UUID playerUUID = user.getUniqueId();
|
||||
if(!inviteList.containsKey(playerUUID)) {
|
||||
return false;
|
||||
}
|
||||
// Check if player has been invited
|
||||
if (!inviteList.containsKey(playerUUID)) {
|
||||
if (!itc.getInviteCommand().getInviteList().containsKey(playerUUID)) {
|
||||
user.sendMessage("commands.island.team.invite.errors.none-invited-you");
|
||||
return false;
|
||||
}
|
||||
@ -44,10 +44,10 @@ public class IslandTeamInviteAcceptCommand extends AbstractIslandTeamCommand {
|
||||
return false;
|
||||
}
|
||||
// Get the team leader
|
||||
UUID prospectiveTeamLeaderUUID = inviteList.get(playerUUID);
|
||||
UUID prospectiveTeamLeaderUUID = itc.getInviteCommand().getInviteList().get(playerUUID);
|
||||
if (!getIslands().hasIsland(user.getWorld(), prospectiveTeamLeaderUUID)) {
|
||||
user.sendMessage("commands.island.team.invite.errors.invalid-invite");
|
||||
inviteList.remove(playerUUID);
|
||||
itc.getInviteCommand().getInviteList().remove(playerUUID);
|
||||
return false;
|
||||
}
|
||||
// Fire event so add-ons can run commands, etc.
|
||||
@ -62,7 +62,7 @@ public class IslandTeamInviteAcceptCommand extends AbstractIslandTeamCommand {
|
||||
return true;
|
||||
}
|
||||
// Remove the invite
|
||||
inviteList.remove(playerUUID);
|
||||
itc.getInviteCommand().getInviteList().remove(playerUUID);
|
||||
// Put player into Spectator mode
|
||||
user.setGameMode(GameMode.SPECTATOR);
|
||||
// Get the player's island - may be null if the player has no island
|
||||
@ -83,8 +83,7 @@ public class IslandTeamInviteAcceptCommand extends AbstractIslandTeamCommand {
|
||||
getPlayers().setHomeLocation(playerUUID, user.getLocation());
|
||||
// Delete the old island
|
||||
getIslands().deleteIsland(island, true);
|
||||
// Set the cooldown
|
||||
setResetWaitTime(user.getPlayer());
|
||||
// TODO Set the cooldown
|
||||
// Reset deaths
|
||||
if (getSettings().isTeamJoinDeathReset()) {
|
||||
getPlayers().setDeaths(playerUUID, 0);
|
||||
@ -93,7 +92,7 @@ public class IslandTeamInviteAcceptCommand extends AbstractIslandTeamCommand {
|
||||
user.setGameMode(GameMode.SURVIVAL);
|
||||
|
||||
user.sendMessage("commands.island.team.invite.accept.you-joined-island", "[label]", Constants.ISLANDCOMMAND);
|
||||
User inviter = User.getInstance(inviteList.get(playerUUID));
|
||||
User inviter = User.getInstance(itc.getInviteCommand().getInviteList().get(playerUUID));
|
||||
if (inviter != null) {
|
||||
inviter.sendMessage("commands.island.team.invite.accept.name-joined-your-island", "[name]", user.getName());
|
||||
}
|
||||
|
@ -8,16 +8,19 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.events.IslandBaseEvent;
|
||||
import us.tastybento.bskyblock.api.events.team.TeamEvent;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.util.Util;
|
||||
|
||||
public class IslandTeamInviteCommand extends AbstractIslandTeamCommand {
|
||||
public class IslandTeamInviteCommand extends CompositeCommand {
|
||||
|
||||
private static final String NAME_PLACEHOLDER = "[name]";
|
||||
private BiMap<UUID, UUID> inviteList;
|
||||
|
||||
public IslandTeamInviteCommand(CompositeCommand islandCommand) {
|
||||
super(islandCommand, "invite");
|
||||
@ -25,9 +28,10 @@ public class IslandTeamInviteCommand extends AbstractIslandTeamCommand {
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
setPermission(Constants.PERMPREFIX + "island.team");
|
||||
setPermission("island.team");
|
||||
setOnlyPlayer(true);
|
||||
setDescription("commands.island.team.invite.description");
|
||||
inviteList = HashBiMap.create();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -136,4 +140,21 @@ public class IslandTeamInviteCommand extends AbstractIslandTeamCommand {
|
||||
return Optional.of(Util.tabLimit(options, lastArg));
|
||||
}
|
||||
|
||||
/**
|
||||
* Order is Invited, Inviter
|
||||
* @return the inviteList
|
||||
*/
|
||||
public BiMap<UUID, UUID> getInviteList() {
|
||||
return inviteList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the maximum team size for this player in this game based on the permission or the world's setting
|
||||
* @param user
|
||||
* @return max team size
|
||||
*/
|
||||
public int getMaxTeamSize(User user) {
|
||||
return Util.getPermValue(user.getPlayer(), getPermissionPrefix() + "team.maxsize.", getIWM().getMaxTeamSize(user.getWorld()));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,21 +3,23 @@ package us.tastybento.bskyblock.commands.island.teams;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.events.IslandBaseEvent;
|
||||
import us.tastybento.bskyblock.api.events.team.TeamEvent;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
|
||||
public class IslandTeamInviteRejectCommand extends AbstractIslandTeamCommand {
|
||||
public class IslandTeamInviteRejectCommand extends CompositeCommand {
|
||||
|
||||
private IslandTeamCommand itc;
|
||||
|
||||
public IslandTeamInviteRejectCommand(CompositeCommand islandTeamCommand) {
|
||||
public IslandTeamInviteRejectCommand(IslandTeamCommand islandTeamCommand) {
|
||||
super(islandTeamCommand, "reject");
|
||||
this.itc = islandTeamCommand;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
setPermission(Constants.PERMPREFIX + "island.team");
|
||||
setPermission("island.team");
|
||||
setOnlyPlayer(true);
|
||||
setDescription("commands.island.team.invite.reject.description");
|
||||
}
|
||||
@ -26,11 +28,11 @@ public class IslandTeamInviteRejectCommand extends AbstractIslandTeamCommand {
|
||||
public boolean execute(User user, List<String> args) {
|
||||
UUID playerUUID = user.getUniqueId();
|
||||
// Reject /island reject
|
||||
if (inviteList.containsKey(playerUUID)) {
|
||||
if (itc.getInviteCommand().getInviteList().containsKey(playerUUID)) {
|
||||
// Fire event so add-ons can run commands, etc.
|
||||
IslandBaseEvent event = TeamEvent.builder()
|
||||
.island(getIslands()
|
||||
.getIsland(user.getWorld(), inviteList.get(playerUUID)))
|
||||
.getIsland(user.getWorld(), itc.getInviteCommand().getInviteList().get(playerUUID)))
|
||||
.reason(TeamEvent.Reason.REJECT)
|
||||
.involvedPlayer(playerUUID)
|
||||
.build();
|
||||
@ -40,13 +42,14 @@ public class IslandTeamInviteRejectCommand extends AbstractIslandTeamCommand {
|
||||
}
|
||||
|
||||
// Remove this player from the global invite list
|
||||
inviteList.remove(user.getUniqueId());
|
||||
itc.getInviteCommand().getInviteList().remove(user.getUniqueId());
|
||||
user.sendMessage("commands.island.team.invite.reject.you-rejected-invite");
|
||||
|
||||
User inviter = User.getInstance(inviteList.get(playerUUID));
|
||||
User inviter = User.getInstance(itc.getInviteCommand().getInviteList().get(playerUUID));
|
||||
inviter.sendMessage("commands.island.team.invite.reject.name-rejected-your-invite", "[name]", user.getName());
|
||||
} else {
|
||||
// Someone typed /island reject and had not been invited
|
||||
// TODO: make the error nicer if there are invites in other worlds
|
||||
user.sendMessage("commands.island.team.invite.errors.none-invited-you");
|
||||
return false;
|
||||
}
|
||||
|
@ -7,11 +7,10 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
|
||||
public class IslandTeamKickCommand extends AbstractIslandTeamCommand {
|
||||
public class IslandTeamKickCommand extends CompositeCommand {
|
||||
|
||||
Set<UUID> kickSet;
|
||||
|
||||
@ -21,7 +20,7 @@ public class IslandTeamKickCommand extends AbstractIslandTeamCommand {
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
setPermission(Constants.PERMPREFIX + "island.team");
|
||||
setPermission("island.team");
|
||||
setOnlyPlayer(true);
|
||||
setParameters("commands.island.team.kick.parameters");
|
||||
setDescription("commands.island.team.kick.description");
|
||||
|
@ -7,11 +7,10 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
|
||||
public class IslandTeamLeaveCommand extends AbstractIslandTeamCommand {
|
||||
public class IslandTeamLeaveCommand extends CompositeCommand {
|
||||
|
||||
Set<UUID> leaveSet;
|
||||
|
||||
@ -21,7 +20,7 @@ public class IslandTeamLeaveCommand extends AbstractIslandTeamCommand {
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
setPermission(Constants.PERMPREFIX + "island.team");
|
||||
setPermission("island.team");
|
||||
setOnlyPlayer(true);
|
||||
setDescription("commands.island.team.leave.description");
|
||||
leaveSet = new HashSet<>();
|
||||
|
@ -2,11 +2,10 @@ package us.tastybento.bskyblock.commands.island.teams;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
|
||||
public class IslandTeamPromoteCommand extends AbstractIslandTeamCommand {
|
||||
public class IslandTeamPromoteCommand extends CompositeCommand {
|
||||
|
||||
public IslandTeamPromoteCommand(CompositeCommand islandTeamCommand, String string) {
|
||||
super(islandTeamCommand, string);
|
||||
@ -14,7 +13,7 @@ public class IslandTeamPromoteCommand extends AbstractIslandTeamCommand {
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
setPermission(Constants.PERMPREFIX + "island.team");
|
||||
setPermission("island.team");
|
||||
setOnlyPlayer(true);
|
||||
if (this.getLabel().equals("promote")) {
|
||||
setParameters("commands.island.team.promote.parameters");
|
||||
|
@ -5,14 +5,13 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.events.IslandBaseEvent;
|
||||
import us.tastybento.bskyblock.api.events.team.TeamEvent;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.util.Util;
|
||||
|
||||
public class IslandTeamSetownerCommand extends AbstractIslandTeamCommand {
|
||||
public class IslandTeamSetownerCommand extends CompositeCommand {
|
||||
|
||||
public IslandTeamSetownerCommand(CompositeCommand islandTeamCommand) {
|
||||
super(islandTeamCommand, "setleader");
|
||||
@ -20,7 +19,7 @@ public class IslandTeamSetownerCommand extends AbstractIslandTeamCommand {
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
setPermission(Constants.PERMPREFIX + "island.team");
|
||||
setPermission("island.team");
|
||||
setOnlyPlayer(true);
|
||||
setParameters("commands.island.team.setowner.parameters");
|
||||
setDescription("commands.island.team.setowner.description");
|
||||
|
@ -418,5 +418,14 @@ public class IslandWorldManager {
|
||||
public World getIslandWorld(String friendlyWorldName) {
|
||||
return worlds.entrySet().stream().filter(e -> e.getValue().equalsIgnoreCase(friendlyWorldName)).findFirst().map(en -> en.getKey()).orElse(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get max team size for this world
|
||||
* @param world
|
||||
* @return max team size
|
||||
*/
|
||||
public int getMaxTeamSize(World world) {
|
||||
return worldSettings.get(Util.getWorld(world)).getMaxTeamSize();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -48,7 +48,6 @@ import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import org.powermock.reflect.Whitebox;
|
||||
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.events.IslandBaseEvent;
|
||||
@ -115,7 +114,7 @@ public class TestBSkyBlock {
|
||||
player = mock(Player.class);
|
||||
ownerOfIsland = mock(Player.class);
|
||||
visitorToIsland = mock(Player.class);
|
||||
Mockito.when(player.hasPermission(Constants.PERMPREFIX + "default.permission")).thenReturn(true);
|
||||
Mockito.when(player.hasPermission("default.permission")).thenReturn(true);
|
||||
|
||||
|
||||
location = mock(Location.class);
|
||||
@ -191,7 +190,7 @@ public class TestBSkyBlock {
|
||||
User user = User.getInstance(playerUUID);
|
||||
CompositeCommand testCommand = new TestCommand();
|
||||
testCommand.setOnlyPlayer(true);
|
||||
testCommand.setPermission(Constants.PERMPREFIX + "default.permission");
|
||||
testCommand.setPermission("default.permission");
|
||||
// Test basic execution
|
||||
assertTrue(testCommand.execute(user, new ArrayList<>()));
|
||||
assertEquals("test",testCommand.getLabel());
|
||||
@ -199,7 +198,7 @@ public class TestBSkyBlock {
|
||||
assertEquals("t", testCommand.getAliases().get(0));
|
||||
assertTrue(testCommand.isOnlyPlayer());
|
||||
assertNull(testCommand.getParent());
|
||||
assertEquals(Constants.PERMPREFIX + "default.permission", testCommand.getPermission());
|
||||
assertEquals("default.permission", testCommand.getPermission());
|
||||
// Check commands and aliases match to correct class
|
||||
for (Entry<String, CompositeCommand> command : testCommand.getSubCommands().entrySet()) {
|
||||
assertEquals(testCommand.getSubCommand(command.getKey()), Optional.of(command.getValue()));
|
||||
@ -233,7 +232,7 @@ public class TestBSkyBlock {
|
||||
// Test command arguments
|
||||
CompositeCommand argCmd = new Test3ArgsCommand();
|
||||
argCmd.setOnlyPlayer(true);
|
||||
argCmd.setPermission(Constants.PERMPREFIX + "default.permission");
|
||||
argCmd.setPermission("default.permission");
|
||||
assertTrue(argCmd.execute(player, "args", new String[]{"give", "100", "ben"}));
|
||||
assertFalse(testCommand.execute(player, "test", new String[] {"sub2", "subsub", "subsubsub"}));
|
||||
assertFalse(testCommand.execute(player, "test", new String[] {"sub2", "subsub", "subsubsub", "ben"}));
|
||||
|
@ -28,7 +28,6 @@ import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import org.powermock.reflect.Whitebox;
|
||||
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.managers.CommandsManager;
|
||||
|
||||
@ -85,7 +84,7 @@ public class AdminCommandTest {
|
||||
when(plugin.getCommandsManager()).thenReturn(cm);
|
||||
AdminCommand ac = new AdminCommand();
|
||||
ac.setup();
|
||||
assertEquals(Constants.PERMPREFIX + "admin.*", ac.getPermission());
|
||||
assertEquals("bskyblock.admin.*", ac.getPermission());
|
||||
assertFalse(ac.isOnlyPlayer());
|
||||
assertEquals("commands.admin.help.parameters", ac.getParameters());
|
||||
assertEquals("commands.admin.help.description", ac.getDescription());
|
||||
|
@ -31,7 +31,6 @@ import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import org.powermock.reflect.Whitebox;
|
||||
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
import us.tastybento.bskyblock.api.events.IslandBaseEvent;
|
||||
import us.tastybento.bskyblock.api.events.island.IslandEvent;
|
||||
@ -99,7 +98,7 @@ public class IslandCommandTest {
|
||||
assertEquals("commands.island.help.description", ic.getDescription());
|
||||
assertTrue(ic.isOnlyPlayer());
|
||||
// Permission
|
||||
assertEquals(Constants.PERMPREFIX + "island", ic.getPermission());
|
||||
assertEquals("bskyblock.island", ic.getPermission());
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user