Merge branch 'develop' of https://github.com/BentoBoxWorld/bentobox.git into develop

This commit is contained in:
tastybento 2018-12-09 22:54:44 -08:00
commit 1a1fe14775
49 changed files with 171 additions and 542 deletions

View File

@ -68,7 +68,7 @@ general.errors.no-island
general.errors.no-permission
general.errors.no-team
general.errors.not-in-team
general.errors.not-leader
general.errors.not-owner
general.errors.offline-player
general.errors.player-has-island
general.errors.player-has-no-island

View File

@ -6,7 +6,7 @@
<groupId>world.bentobox</groupId>
<artifactId>bentobox</artifactId>
<version>0.16.0-SNAPSHOT</version>
<version>0.17.0-SNAPSHOT</version>
<name>BentoBox</name>
<description>BentoBox is an expandable Minecraft Spigot plugin for island-type games like ASkyBlock or AcidIsland.</description>

View File

@ -1,18 +0,0 @@
package world.bentobox.bentobox.api.addons.exception;
/**
* @deprecated Moved to {@link world.bentobox.bentobox.api.addons.exceptions.AddonException}.
*/
@Deprecated
public abstract class AddonException extends Exception {
/**
*
*/
private static final long serialVersionUID = 4203162022348693854L;
public AddonException(String errorMessage){
super("AddonException : " + errorMessage);
}
}

View File

@ -1,32 +0,0 @@
package world.bentobox.bentobox.api.addons.exception;
import java.util.logging.Level;
import org.bukkit.Bukkit;
/**
* @deprecated Moved to {@link world.bentobox.bentobox.api.addons.exceptions.InvalidAddonFormatException}.
*/
@Deprecated
public class InvalidAddonFormatException extends AddonException {
/**
*
*/
private static final long serialVersionUID = 7741502900847049986L;
public InvalidAddonFormatException(String errorMessage) {
super(errorMessage);
}
@Override
public void printStackTrace(){
super.printStackTrace();
Bukkit.getLogger().log(Level.WARNING, " Basic format : (addon.yml)");
Bukkit.getLogger().log(Level.WARNING, " main: path.to.your.MainClass");
Bukkit.getLogger().log(Level.WARNING, " name: <NameOfYourModule>");
Bukkit.getLogger().log(Level.WARNING, " authors: <AuthorA> | <AuthorA, AuthorB>");
Bukkit.getLogger().log(Level.WARNING, " version: YourVersion");
}
}

View File

@ -1,18 +0,0 @@
package world.bentobox.bentobox.api.addons.exception;
/**
* @deprecated Moved to {@link world.bentobox.bentobox.api.addons.exceptions.InvalidAddonInheritException}.
*/
@Deprecated
public class InvalidAddonInheritException extends AddonException {
/**
*
*/
private static final long serialVersionUID = -5847358994397613244L;
public InvalidAddonInheritException(String errorMessage) {
super(errorMessage);
}
}

View File

@ -381,22 +381,10 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
return getSubCommands();
}
/**
* Convenience method to obtain the user's team leader
* @param world - world to check
* @param user - the User
* @return UUID of player's team leader or null if user has no island
* @deprecated Renamed to {@link #getOwner(World, User)} for consistency.
*/
@Deprecated
protected UUID getTeamLeader(World world, User user) {
return getOwner(world, user);
}
/**
* Convenience method to obtain the user's island owner
* @param world world to check
* @param user -the User
* @param user the User
* @return UUID of player's island owner or null if user has no island
*/
protected UUID getOwner(World world, User user) {

View File

@ -42,9 +42,9 @@ public class AdminDeleteCommand extends ConfirmableCommand {
user.sendMessage("general.errors.player-has-no-island");
return false;
}
// Team leaders should be kicked before deleting otherwise the whole team will become weird
// Owners should be kicked before deleting otherwise the whole team will become weird
if (getIslands().inTeam(getWorld(), targetUUID) && getIslands().getOwner(getWorld(), targetUUID).equals(targetUUID)) {
user.sendMessage("commands.admin.delete.cannot-delete-team-leader");
user.sendMessage("commands.admin.delete.cannot-delete-owner");
return false;
}
// Confirm

View File

@ -27,9 +27,9 @@ public class AdminTeamAddCommand extends CompositeCommand {
showHelp(this, user);
return false;
}
// Get leader and target
UUID leaderUUID = getPlayers().getUUID(args.get(0));
if (leaderUUID == null) {
// Get owner and target
UUID ownerUUID = getPlayers().getUUID(args.get(0));
if (ownerUUID == null) {
user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(0));
return false;
}
@ -38,13 +38,13 @@ public class AdminTeamAddCommand extends CompositeCommand {
user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(1));
return false;
}
if (!getIslands().hasIsland(getWorld(), leaderUUID)) {
if (!getIslands().hasIsland(getWorld(), ownerUUID)) {
user.sendMessage("general.errors.player-has-no-island");
return false;
}
if (getIslands().inTeam(getWorld(), leaderUUID) && !getIslands().getOwner(getWorld(), leaderUUID).equals(leaderUUID)) {
user.sendMessage("commands.admin.team.add.name-not-leader", TextVariables.NAME, args.get(0));
getIslands().getIsland(getWorld(), leaderUUID).showMembers(getPlugin(), user, getWorld());
if (getIslands().inTeam(getWorld(), ownerUUID) && !getIslands().getOwner(getWorld(), ownerUUID).equals(ownerUUID)) {
user.sendMessage("commands.admin.team.add.name-not-owner", TextVariables.NAME, args.get(0));
getIslands().getIsland(getWorld(), ownerUUID).showMembers(getPlugin(), user, getWorld());
return false;
}
if (getIslands().inTeam(getWorld(), targetUUID)) {
@ -57,10 +57,10 @@ public class AdminTeamAddCommand extends CompositeCommand {
}
// Success
User target = User.getInstance(targetUUID);
User leader = User.getInstance(leaderUUID);
leader.sendMessage("commands.island.team.invite.accept.name-joined-your-island", TextVariables.NAME, getPlugin().getPlayers().getName(targetUUID));
User owner = User.getInstance(ownerUUID);
owner.sendMessage("commands.island.team.invite.accept.name-joined-your-island", TextVariables.NAME, getPlugin().getPlayers().getName(targetUUID));
target.sendMessage("commands.island.team.invite.accept.you-joined-island", TextVariables.LABEL, getTopLabel());
getIslands().getIsland(getWorld(), leaderUUID).addMember(targetUUID);
getIslands().getIsland(getWorld(), ownerUUID).addMember(targetUUID);
user.sendMessage("general.success");
return true;

View File

@ -42,13 +42,13 @@ public class AdminTeamDisbandCommand extends CompositeCommand {
return false;
}
if (!getIslands().getOwner(getWorld(), targetUUID).equals(targetUUID)) {
user.sendMessage("commands.admin.team.disband.use-disband-leader", "[leader]", getPlayers().getName(getIslands().getOwner(getWorld(), targetUUID)));
user.sendMessage("commands.admin.team.disband.use-disband-owner", "[owner]", getPlayers().getName(getIslands().getOwner(getWorld(), targetUUID)));
return false;
}
// Disband team
getIslands().getMembers(getWorld(), targetUUID).forEach(m -> {
User.getInstance(m).sendMessage("commands.admin.team.disband.disbanded");
// The leader gets to keep the island
// The owner gets to keep the island
if (!m.equals(targetUUID)) {
getIslands().setLeaveTeam(getWorld(), m);
}

View File

@ -43,7 +43,7 @@ public class AdminTeamKickCommand extends CompositeCommand {
return false;
}
if (getIslands().getOwner(getWorld(), targetUUID).equals(targetUUID)) {
user.sendMessage("commands.admin.team.kick.cannot-kick-leader");
user.sendMessage("commands.admin.team.kick.cannot-kick-owner");
getIslands().getIsland(getWorld(), targetUUID).showMembers(getPlugin(), user, getWorld());
return false;
}

View File

@ -37,6 +37,13 @@ public class IslandCreateCommand extends CompositeCommand {
user.sendMessage("general.errors.already-have-island");
return false;
}
if (getIWM().getMaxIslands(getWorld()) > 0
&& getIslands().getIslandCount(getWorld()) >= getIWM().getMaxIslands(getWorld())) {
// There is too many islands in the world :(
user.sendMessage("commands.island.create.too-many-islands");
return false;
}
user.sendMessage("commands.island.create.creating-island");
try {
NewIsland.builder()

View File

@ -39,7 +39,7 @@ public class IslandResetCommand extends ConfirmableCommand {
return false;
}
if (!getIslands().isOwner(getWorld(), user.getUniqueId())) {
user.sendMessage("general.errors.not-leader");
user.sendMessage("general.errors.not-owner");
return false;
}
if (getIslands().inTeam(getWorld(), user.getUniqueId())) {

View File

@ -33,7 +33,7 @@ public class IslandResetnameCommand extends CompositeCommand {
}
if (!getIslands().isOwner(getWorld(), playerUUID)) {
user.sendMessage("general.errors.not-leader");
user.sendMessage("general.errors.not-owner");
return false;
}
// Resets the island name

View File

@ -37,7 +37,7 @@ public class IslandSetnameCommand extends CompositeCommand {
}
if (!getIslands().isOwner(getWorld(), playerUUID)) {
user.sendMessage("general.errors.not-leader");
user.sendMessage("general.errors.not-owner");
return false;
}
// Explain command

View File

@ -36,14 +36,13 @@ public class IslandTeamCommand extends CompositeCommand {
new IslandTeamUntrustCommand(this);
new IslandTeamPromoteCommand(this, "promote");
new IslandTeamPromoteCommand(this, "demote");
}
@Override
public boolean execute(User user, String label, List<String> args) {
// Player issuing the command must have an island
UUID teamLeaderUUID = getOwner(getWorld(), user);
if (teamLeaderUUID == null) {
UUID ownerUUID = getOwner(getWorld(), user);
if (ownerUUID == null) {
user.sendMessage("general.errors.no-island");
return false;
}
@ -55,7 +54,7 @@ public class IslandTeamCommand extends CompositeCommand {
return false;
}
Set<UUID> teamMembers = getMembers(getWorld(), user);
if (teamLeaderUUID.equals(playerUUID)) {
if (ownerUUID.equals(playerUUID)) {
int maxSize = inviteCommand.getMaxTeamSize(user);
if (teamMembers.size() < maxSize) {
user.sendMessage("commands.island.team.invite.you-can-invite", TextVariables.NUMBER, String.valueOf(maxSize - teamMembers.size()));
@ -68,7 +67,6 @@ public class IslandTeamCommand extends CompositeCommand {
return true;
}
private boolean fireEvent(User user) {
IslandBaseEvent event = TeamEvent.builder()
.island(getIslands()

View File

@ -43,9 +43,9 @@ public class IslandTeamInviteAcceptCommand extends CompositeCommand {
user.sendMessage("commands.island.team.invite.errors.you-already-are-in-team");
return false;
}
// Get the team leader
UUID prospectiveTeamLeaderUUID = itc.getInviteCommand().getInviteList().get(playerUUID);
if (!getIslands().hasIsland(getWorld(), prospectiveTeamLeaderUUID)) {
// Get the island owner
UUID prospectiveOwnerUUID = itc.getInviteCommand().getInviteList().get(playerUUID);
if (!getIslands().hasIsland(getWorld(), prospectiveOwnerUUID)) {
user.sendMessage("commands.island.team.invite.errors.invalid-invite");
itc.getInviteCommand().getInviteList().remove(playerUUID);
return false;
@ -53,7 +53,7 @@ public class IslandTeamInviteAcceptCommand extends CompositeCommand {
// Fire event so add-ons can run commands, etc.
IslandBaseEvent event = TeamEvent.builder()
.island(getIslands()
.getIsland(getWorld(), prospectiveTeamLeaderUUID))
.getIsland(getWorld(), prospectiveOwnerUUID))
.reason(TeamEvent.Reason.JOIN)
.involvedPlayer(playerUUID)
.build();
@ -68,12 +68,12 @@ public class IslandTeamInviteAcceptCommand extends CompositeCommand {
// Get the player's island - may be null if the player has no island
Island island = getIslands().getIsland(getWorld(), playerUUID);
// Get the team's island
Island teamIsland = getIslands().getIsland(getWorld(), prospectiveTeamLeaderUUID);
Island teamIsland = getIslands().getIsland(getWorld(), prospectiveOwnerUUID);
// Clear the player's inventory
user.getInventory().clear();
// Move player to team's island
User prospectiveTeamLeader = User.getInstance(prospectiveTeamLeaderUUID);
Location newHome = getIslands().getSafeHomeLocation(getWorld(), prospectiveTeamLeader, 1);
User prospectiveOwner = User.getInstance(prospectiveOwnerUUID);
Location newHome = getIslands().getSafeHomeLocation(getWorld(), prospectiveOwner, 1);
user.teleport(newHome);
// Remove player as owner of the old island
getIslands().removePlayer(getWorld(), playerUUID);

View File

@ -147,11 +147,10 @@ public class IslandTeamInviteCommand extends CompositeCommand {
/**
* Gets the maximum team size for this player in this game based on the permission or the world's setting
* @param user - user
* @param user user
* @return max team size of user
*/
public int getMaxTeamSize(User user) {
return user.getPermissionValue(getPermissionPrefix() + "team.maxsize.", getIWM().getMaxTeamSize(getWorld()));
return user.getPermissionValue(getPermissionPrefix() + "team.maxsize", getIWM().getMaxTeamSize(getWorld()));
}
}

View File

@ -30,7 +30,7 @@ public class IslandTeamKickCommand extends ConfirmableCommand {
return false;
}
if (!getOwner(getWorld(), user).equals(user.getUniqueId())) {
user.sendMessage("general.errors.not-leader");
user.sendMessage("general.errors.not-owner");
return false;
}
// If args are not right, show help
@ -63,7 +63,7 @@ public class IslandTeamKickCommand extends ConfirmableCommand {
private void kick(User user, UUID targetUUID) {
User target = User.getInstance(targetUUID);
target.sendMessage("commands.island.team.kick.leader-kicked");
target.sendMessage("commands.island.team.kick.owner-kicked");
getIslands().removePlayer(getWorld(), targetUUID);
// Remove money inventory etc.
if (getIWM().isOnLeaveResetEnderChest(getWorld())) {

View File

@ -41,9 +41,9 @@ public class IslandTeamLeaveCommand extends ConfirmableCommand {
}
private void leave(User user) {
UUID leaderUUID = getIslands().getOwner(getWorld(), user.getUniqueId());
if (leaderUUID != null) {
User.getInstance(leaderUUID).sendMessage("commands.island.team.leave.left-your-island", TextVariables.NAME, user.getName());
UUID ownerUUID = getIslands().getOwner(getWorld(), user.getUniqueId());
if (ownerUUID != null) {
User.getInstance(ownerUUID).sendMessage("commands.island.team.leave.left-your-island", TextVariables.NAME, user.getName());
}
getIslands().setLeaveTeam(getWorld(), user.getUniqueId());
// Remove money inventory etc.

View File

@ -31,9 +31,9 @@ public class IslandTeamSetownerCommand extends CompositeCommand {
UUID playerUUID = user.getUniqueId();
// Can use if in a team
boolean inTeam = getPlugin().getIslands().inTeam(getWorld(), playerUUID);
UUID teamLeaderUUID = getOwner(getWorld(), user);
if (!(inTeam && teamLeaderUUID.equals(playerUUID))) {
user.sendMessage("general.errors.not-leader");
UUID ownerUUID = getOwner(getWorld(), user);
if (!(inTeam && ownerUUID.equals(playerUUID))) {
user.sendMessage("general.errors.not-owner");
return false;
}
// If args are not right, show help

View File

@ -100,6 +100,7 @@ public interface WorldSettings {
int getMaxHomes();
/**
* 0 or -1 is unlimited. It will block island creation if the island count for the world is higher than this.
* @return the maxIslands
*/
int getMaxIslands();

View File

@ -14,7 +14,7 @@ import world.bentobox.bentobox.util.ItemParser;
*/
public class BentoBoxLocale {
private final String UNKNOWN = "unknown";
private static final String UNKNOWN = "unknown";
private Locale locale;
private YamlConfiguration config;

View File

@ -185,11 +185,16 @@ public class User {
/**
* Get the maximum value of a numerical permission setting
* @param permissionPrefix the start of the perm, e.g., bskyblock.maxhomes
* @param permissionPrefix the start of the perm, e.g., {@code plugin.mypermission}
* @param defaultValue the default value; the result may be higher or lower than this
* @return max value
*/
public int getPermissionValue(String permissionPrefix, int defaultValue) {
// If there is a dot at the end of the permissionPrefix, remove it
if (permissionPrefix.endsWith(".")) {
permissionPrefix = permissionPrefix.substring(0, permissionPrefix.length()-1);
}
int value = defaultValue;
for (PermissionAttachmentInfo perms : player.getEffectivePermissions()) {
if (perms.getPermission().startsWith(permissionPrefix + ".")) {

View File

@ -484,7 +484,7 @@ public class Island implements DataObject {
/**
* Sets the owner of the island.
* @param owner - the island owner - the owner/team leader to set
* @param owner the island owner - the owner to set
*/
public void setOwner(UUID owner){
this.owner = owner;

View File

@ -54,13 +54,13 @@ public class JoinLeaveListener implements Listener {
.forEach(world -> {
Island island = plugin.getIslands().getIsland(world, user);
// Check if new leader has a different range permission than the island size
// Check if new owner has a different range permission than the island size
int range = user.getPermissionValue(plugin.getIWM().getAddon(island.getWorld()).get().getPermissionPrefix() + "island.range", plugin.getIWM().getIslandProtectionRange(Util.getWorld(island.getWorld())));
// Range can go up or down
if (range != island.getProtectionRange()) {
user.sendMessage("commands.admin.setrange.range-updated", TextVariables.NUMBER, String.valueOf(range));
plugin.log("Makeleader: Island protection range changed from " + island.getProtectionRange() + " to "
plugin.log("Setowner: Island protection range changed from " + island.getProtectionRange() + " to "
+ range + " for " + user.getName() + " due to permission.");
}

View File

@ -1,6 +1,5 @@
package world.bentobox.bentobox.listeners.flags;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.TropicalFish;
@ -40,7 +39,6 @@ public class BucketListener extends FlagListener {
*/
@EventHandler(priority = EventPriority.LOW)
public void onBucketFill(final PlayerBucketFillEvent e) {
Bukkit.getLogger().info("DEBUG: " + e.getEventName());
// Check filling of various liquids
if (e.getItemStack().getType().equals(Material.LAVA_BUCKET) && (!checkIsland(e, e.getBlockClicked().getLocation(), Flags.COLLECT_LAVA))) {
return;
@ -61,6 +59,4 @@ public class BucketListener extends FlagListener {
checkIsland(e, e.getRightClicked().getLocation(), Flags.FISH_SCOOPING);
}
}
}

View File

@ -90,7 +90,7 @@ public class PlaceBlocksListener extends FlagListener {
public void onBlockForm(EntityBlockFormEvent e) {
if (e.getNewState().getType().equals(Material.FROSTED_ICE) && e.getEntity() instanceof Player) {
setUser(User.getInstance((Player)e.getEntity()));
checkIsland(e, e.getBlock().getLocation(), Flags.PLACE_BLOCKS);
checkIsland(e, e.getBlock().getLocation(), Flags.FROST_WALKER);
}
}

View File

@ -59,6 +59,9 @@ public class Flags {
public static final Flag BREAK_BLOCKS = new FlagBuilder().id("BREAK_BLOCKS").icon(Material.STONE).listener(new BreakBlocksListener()).build();
public static final Flag PLACE_BLOCKS = new FlagBuilder().id("PLACE_BLOCKS").icon(Material.GRASS).listener(new PlaceBlocksListener()).build();
// Frost walker - uses the place block listener
public static final Flag FROST_WALKER = new FlagBuilder().id("FROST_WALKER").icon(Material.ICE).build();
// Block interactions - all use BlockInteractionListener()
public static final Flag ANVIL = new FlagBuilder().id("ANVIL").icon(Material.ANVIL).listener(new BlockInteractionListener()).build();
public static final Flag BEACON = new FlagBuilder().id("BEACON").icon(Material.BEACON).build();

View File

@ -257,6 +257,10 @@ public class IslandsManager {
return islandCache.size();
}
public int getIslandCount(World world) {
return islandCache.size(world);
}
/**
* Gets the island for this player. If they are in a team, the team island is returned.
* @param world - world to check
@ -393,7 +397,7 @@ public class IslandsManager {
plugin.getPlayers().setHomeLocation(user, l, number);
return l;
} else {
// try team leader's home
// try owner's home
Location tlh = plugin.getPlayers().getHomeLocation(world, plugin.getIslands().getOwner(world, user.getUniqueId()));
if (tlh != null && isSafeLocation(tlh)) {
plugin.getPlayers().setHomeLocation(user, tlh, number);
@ -454,19 +458,6 @@ public class IslandsManager {
return spawn.containsKey(world) ? spawn.get(world).getSpawnPoint(world.getEnvironment()) : null;
}
/**
* Provides UUID of this player's island owner or null if it does not exist
* @param world - world to check
* @param playerUUID - the player's UUID
* @return island owner's UUID or null if player has no island
*
* @deprecated Renamed to {@link #getOwner(World, UUID)} for consistency.
*/
@Deprecated
public UUID getTeamLeader(World world, UUID playerUUID) {
return getOwner(world, playerUUID);
}
/**
* Provides UUID of this player's island owner or null if it does not exist
* @param world world to check
@ -789,20 +780,20 @@ public class IslandsManager {
}
/**
* Makes a new leader for an island
* @param world - world
* @param user - the user who is issuing the command
* @param targetUUID - the current island member who is going to become the new owner
* Sets this target as the owner for this island
* @param world world
* @param user the user who is issuing the command
* @param targetUUID the current island member who is going to become the new owner
*/
public void setOwner(World world, User user, UUID targetUUID) {
setOwner(user, targetUUID, getIsland(world, targetUUID));
}
/**
* Makes a new leader for an island
* @param user - requester
* @param targetUUID - new owner
* @param island - island to register
* Sets this target as the owner for this island
* @param user requester
* @param targetUUID new owner
* @param island island to register
*/
public void setOwner(User user, UUID targetUUID, Island island) {
islandCache.setOwner(island, targetUUID);
@ -813,7 +804,7 @@ public class IslandsManager {
User target = User.getInstance(targetUUID);
target.sendMessage("commands.island.team.setowner.you-are-the-owner");
if (target.isOnline() && plugin.getIWM().getAddon(island.getWorld()).isPresent()) {
// Check if new leader has a different range permission than the island size
// Check if new owner has a different range permission than the island size
int range = target.getPermissionValue(
plugin.getIWM().getAddon(island.getWorld()).get().getPermissionPrefix() + "island.range",
plugin.getIWM().getIslandProtectionRange(Util.getWorld(island.getWorld())));
@ -821,7 +812,7 @@ public class IslandsManager {
if (range != island.getProtectionRange()) {
user.sendMessage("commands.admin.setrange.range-updated", TextVariables.NUMBER, String.valueOf(range));
target.sendMessage("commands.admin.setrange.range-updated", TextVariables.NUMBER, String.valueOf(range));
plugin.log("Makeleader: Island protection range changed from " + island.getProtectionRange() + " to "
plugin.log("Setowner: Island protection range changed from " + island.getProtectionRange() + " to "
+ range + " for " + user.getName() + " due to permission.");
}
island.setProtectionRange(range);

View File

@ -99,7 +99,8 @@ public class SchemsManager {
if (islandSchems.containsKey(world)) {
islandSchems.get(world).pasteIsland(world, island, task);
} else {
plugin.logError("Tried to paste schem for " + world.getName() + " but it is not loaded!");
plugin.logError("Tried to paste schem for " + world.getName() + " but the schem is not loaded!");
plugin.log("This might be due to an invalid schem format. Keep in mind that schems are not schematics.");
}
}

View File

@ -139,18 +139,6 @@ public class IslandCache {
return new HashSet<>(0);
}
/**
* @param world - the world to check
* @param uuid - player's uuid
* @return team leader's UUID, the player UUID if they are not in a team, or null if there is no island
*
* @deprecated Renamed to {@link #getOwner(World, UUID)} for consistency.
*/
@Deprecated
public UUID getTeamLeader(World world, UUID uuid) {
return getOwner(world, uuid);
}
/**
* @param world the world to check
* @param uuid the player's UUID
@ -207,6 +195,15 @@ public class IslandCache {
return islandsByLocation.size();
}
/**
* Gets the number of islands in the cache for this world
* @param world
* @return the number of islands
*/
public int size(World world) {
return islandsByUUID.getOrDefault(world, new HashMap<>(0)).size();
}
/**
* Sets an island owner. Clears out any other owner
* @param island - island

View File

@ -1,18 +0,0 @@
###########################################################################################
# This is a YML file. Be careful when editing. Check your edits in a YAML checker like #
# the one at http://yaml-online-parser.appspot.com #
###########################################################################################
# Updated for <pre-FC version>
meta:
authors:
- tastybento
banner: "BLUE_BANNER:1:STRIPE_DOWNLEFT:WHITE:STRIPE_DOWNRIGHT:WHITE:STRIPE_CENTER:WHITE:STRIPE_MIDDLE:WHITE:STRAIGHT_CROSS:RED:CROSS:RED"
protection:
flags:
ARMOR_STAND:
description: "Toggle interaction"
name: "Armour stands"
hint: "Armour stand use disabled"

View File

@ -23,7 +23,7 @@ general:
player-has-no-island: "&cThat player has no island!"
already-have-island: "&cYou already have an island!"
no-safe-location: "&cNo safe location found on island!"
not-leader: "&cYou are not the leader of your island!"
not-owner: "&cYou are not the owner of your island!"
not-in-team: "&cThat player is not in your team!"
offline-player: "&cThat player is offline or doesn't exist."
unknown-player: "&c[name] is an unknown player!"
@ -31,7 +31,7 @@ general:
unknown-command: "&cUnknown command. Do &b/[label] help &cfor help."
warp-not-safe: "&cThat warp is not safe right now!"
wrong-world: "&cYou are not in the right world to do that!"
you-must-wait: "&cYou must wait [number]s before you can do that command again"
you-must-wait: "&cYou must wait [number]s before you can do that command again."
tips:
changing-obsidian-to-lava: "Changing obsidian back into lava. Be careful!"
@ -56,19 +56,19 @@ commands:
description: "clears all player reset counts for this world"
team:
add:
parameters: "<leader> <player>"
description: "add player to leader's team"
name-not-leader: "&c[name] is not the leader"
parameters: "<owner> <player>"
description: "add player to owner's team"
name-not-owner: "&c[name] is not the owner."
name-has-island: "&c[name] has an island. Unregister or delete them first!"
disband:
parameters: "<team leader>"
description: "disband team leader's team"
user-disband-leader: "&cNot leader! Use disband [leader]"
parameters: "<owner>"
description: "disband owner's team"
use-disband-owner: "&cNot owner! Use disband [owner]"
disbanded: "&cAdmin disbanded your team!"
kick:
parameters: "<team player>"
description: "kick a player from a team"
cannot-kick-leader: "&cYou cannot kick the team leader. Kick members first"
cannot-kick-owner: "&cYou cannot kick the owner. Kick members first"
admin-kicked: "&cThe admin kicked you from the team."
setowner:
parameters: "<player>"
@ -190,7 +190,7 @@ commands:
delete:
parameters: ""
description: "deletes a player's island"
cannot-delete-team-leader: "&cAll island members have to be kicked from the island before deleting it."
cannot-delete-owner: "&cAll island members have to be kicked from the island before deleting it."
deleted-island: "&aIsland at &e[xyz] &ahas been successfully deleted."
why:
parameters: "<player>"
@ -231,9 +231,10 @@ commands:
description: "teleport you to the spawn"
create:
description: "create an island"
too-many-islands: "&cThere are too many islands in this world: there isn't enough room for yours to be created."
unable-create-island: "&cYour island could not be generated, please contact an administrator."
creating-island: "&aCreating your island..."
pick-world: "&cPick a world from [worlds]"
pick-world: "&cPick a world from [worlds]."
info:
description: "display info about your island"
reset:
@ -320,13 +321,13 @@ commands:
cancel:
description: "cancel the pending invite to join your island"
leave:
cannot-leave: "&cTeam leaders cannot leave! Become a member first, or kick all members."
cannot-leave: "&cOwners cannot leave! Become a member first, or kick all members."
description: "leave your island"
left-your-island: "&c[name] &cleft your island"
kick:
description: "remove a member from your island"
parameters: "<player>"
leader-kicked: "&cThe leader kicked you from the island!"
owner-kicked: "&cThe owner kicked you from the island!"
cannot-kick: "&cYou cannot kick yourself!"
demote:
description: "demote a player on your island down a rank"
@ -341,7 +342,7 @@ commands:
setowner:
description: "transfer your island ownership to a member"
errors:
cant-transfer-to-yourself: "&cYou can't transfer ownership to yourself! Well, infact, you could... But we don't want you to. 'Cause it's bad."
cant-transfer-to-yourself: "&cYou can't transfer ownership to yourself! &7(&oWell, in fact, you could... But we don't want you to. Because it's useless.&r&7)"
target-is-not-member: "&cThat player is not part of your island team!"
name-is-the-owner: "&a[name] is now the island owner!"
parameters: "<player>"
@ -697,6 +698,10 @@ protection:
description: "Toggle crushing"
name: "Turtle Eggs"
hint: "Turtle eggs cannot be crushed!"
FROST_WALKER:
description: "Toggle Frost Walker enchantment"
name: "Frost Walker"
hint: "Frost Walker cannot be used here"
locked: "&cThis island is locked!"
protected: "&cIsland protected: [description]"
spawn-protected: "&cSpawn protected: [description]"

View File

@ -1,264 +0,0 @@
###########################################################################################
# Ceci est fichier YAML. Soyez prudents lorsque vous l'éditez et vérifiez la syntaxe en #
# utilisant un parser YAML, tel que http://yaml-online-parser.appspot.com #
###########################################################################################
# Updated for <pre-FC version>
meta:
authors:
- MrSheepSheep
- Poslovitch
banner: "WHITE_BANNER:1:STRIPE_BOTTOM:RED:STRIPE_TOP:BLUE"
general:
deaths: "morts"
unlimited: "Illimité"
success: "&aAction effectuée!"
errors:
command-cancelled: "&cCommande annulée."
no-permission: "&cVous n'avez pas la permission d'utiliser cette commande."
use-in-game: "&cCette commande doit être exécutée en jeu."
no-team: "&cVous n'avez pas d'équipe!"
no-island: "&cVous n'avez pas d'île!"
player-has-no-island: "&cCe joueur n'a pas d'île!"
already-have-island: "&cVous possédez déjà une île!"
no-safe-location: "&cAucune position sécurisée n'a été trouvée sur cette île!"
not-leader: "&cVous n'êtes oas le leader de votre île!"
not-in-team: "&cCe joueur n'est pas dans votre équipe!"
offline-player: "&cCe joueur est déconnecté ou n'existe pas."
unknown-player: "&cCe joueur est inconnu."
general: "&cImpossible d'exécuter la commande. Contactez un administrateur."
warp-not-safe: "&cCe Warp n'est pas sécurisé."
wrong-world: "&cVous n'êtes pas de le bon monde pour effectuer cette action."
tips:
changing-ob-to-lava: "Transformation de l'obsidienne en lave. Faites attention!"
commands:
help:
header: "&7=========== &cBentoBox &7==========="
syntax: "&b[usage] &a[parameters]&7: &e[description]"
end: "&7================================="
parameters: "[command]"
description: "help command"
admin:
help:
description: "admin command"
version:
description: "display BentoBox and addons versions"
setrange:
parameters: "[player] [range]"
description: "set the range of player's island"
range-updated: "Island range updated to [number]"
reload:
description: "reload the plugin"
tp:
parameters: "[player]"
description: "teleport to a player's island"
manual: "&cNo safe warp found! Manually tp near to &b[location] &cand check it out"
island:
about:
description: "display info about BentoBox"
go:
parameters: "<home number>"
description: "teleport you to your island"
teleport: "&aTeleporting you to your island. &b/[label] help &afor help."
teleported: "&aTeleported you to home &e#[number]."
help:
description: "The main island command"
spawn:
description: "teleport you to the spawn"
create:
description: "create an island"
unable-create-island: "Your island could not be generated, please contact an administrator."
creating-island: "Creating your island..."
info:
description: "display info about your island"
reset:
description: "restart your island and remove the old one"
must-remove-members: "You must remove all members from your island before you can restart it (/island kick <player>)."
sethome:
description: "set your teleport point for /island"
must-be-on-your-island: "You must be on your island to set home!"
num-homes: "Homes can be 1 to [max]."
home-set: "Your island home has been set to your current location."
parameters: "<home number>"
setname:
description: "set a name for your island"
name-too-short: "&cToo short. Minimum size is [length] characters."
name-too-long: "&cToo long. Maximum size is [length] characters."
parameters: "<name>"
resetname:
description: "reset your island name"
team:
description: "manage your team"
info:
description: "display detailed info about your team"
invite:
description: "invite a player to join your island"
invitation-sent: "Invitation sent to [name]"
removing-invite: "Removing invite"
name-has-invited-you: "[name] has invited you to join their island."
to-accept-or-reject: "Do /island team accept to accept, or /island team reject to reject"
you-will-lose-your-island: "&cWARNING! You will lose your island if you accept!"
errors:
cannot-invite-self: "&cYou cannot invite yourself!"
cooldown: "&cYou cannot invite that person for another [time] seconds"
island-is-full: "&cYour island is full, you can't invite anyone else."
none-invited-you: "&cNo one invited you :c."
you-already-are-in-team: "&cYou are already on a team!"
already-on-team: "&cThat player is already on a team!"
invalid-invite: "&cThat invite is no longer valid, sorry."
parameters: "<player>"
you-can-invite: "You can invite [number] more players."
accept:
description: "accept an invitation"
you-joined-island: "&aYou joined an island! Use /[label] team info to see the other members."
name-joined-your-island: "&a[name] joined your island!"
reject:
description: "reject an invitation"
you-rejected-invite: "&aYou rejected the invitation to join an island."
name-rejected-your-invite: "&c[name] rejected your island invite!"
cancel:
description: "cancel the pending invite to join your island"
leave:
description: "leave your island"
type-again: "&cEnter the leave command again to confirm"
left-your-island: "&c[player] left your island"
kick:
description: "remove a member from your island"
parameters: "<player>"
type-again: "&cEnter the kick command again to confirm"
leader-kicked: "&cThe leader kicked you from the island!"
demote:
description: "demote a player on your island down a rank"
parameters: "<player>"
failure: "&cPlayer cannot be demoted any further!"
success: "Demoted [name] to [rank]"
promote:
description: "promote a player on your island up a rank"
parameters: "<player>"
failure: "&cPlayer cannot be promoted any further!"
success: "Promoted [name] to [rank]"
setowner:
description: "transfer your island ownership to a member"
errors:
cant-transfer-to-yourself: "&cYou can't transfer ownership to yourself! Well, infact, you could... But we don't want you to. 'Cause it's bad."
target-is-not-member: "&cThat player is not part of your island team!"
name-is-the-owner: "&a[name] is now the island owner!"
parameters: "<player>"
you-are-the-owner: "&aYou are now the island owner!"
ban:
description: "ban a player from your island"
parameters: "<player>"
unban:
description: "unban a player from your island"
parameters: "<player>"
banlist:
description: "list banned players"
lock:
description: "lock/unlock your island so visitors cannot enter it"
settings:
description: "display island settings"
language:
description: "select language"
ranks:
owner: "Owner"
member: "Member"
coop: "Coop"
visitor: "Visitor"
banned: "Banned"
protection:
protected: "&cIsland protected!"
flags:
ANVIL:
name: "Anvils"
description: "Toggle interaction with anvils"
ARMOR_STAND:
name: "Armor stands"
description: "Toggle interaction with armor stands"
BEACON:
name: "Beacons"
description: "Toggle interaction with beacons"
BED:
name: "Beds"
description: "Toggle interaction with beds"
BREAK_BLOCKS:
name: "Break blocks"
description: "Toggle block breaking"
BREEDING:
name: "Breed animals"
description: "Toggle animal breeding"
BREWING:
name: "Brewing stands"
description: "Toggle interaction with brewing stands"
BUCKET:
name: "Buckets"
description: "Toggle interaction with buckets"
COLLECT_WATER:
name: "Collect water"
description: |
Toggle collecting water using buckets
(override Buckets)
COLLECT_LAVA:
name: "Collect lava"
description: |
Toggle collecting lava using buckets
(override Buckets)
CHORUS_FRUIT:
name: "Chorus fruits"
description: "Toggle teleportation using Chorus fruits"
CRAFTING: "Use crafting table"
CROP_TRAMPLE: "Trample crops"
DOOR: "Use doors"
ELYTRA: "Use elytras"
ENCHANTING: "Use enchanting table"
ENTER_EXIT_MESSAGES: "Display entry and exit messages"
FIRE: "FIRE"
FIRE_EXTINGUISH: "FIRE_EXTINGUISH"
FIRE_SPREAD: "FIRE_SPREAD"
FURNACE: "FURNACE"
GATE: "GATE"
HURT_ANIMALS: "HURT_ANIMALS"
HURT_MONSTERS: "HURT_MONSTERS"
HURT_VILLAGERS: "HURT_VILLAGERS"
ITEM_DROP: "ITEM_DROP"
ITEM_PICKUP: "ITEM_PICKUP"
LEASH: "LEASH"
MILKING: "MILKING"
MOB_SPAWN: "MOB_SPAWN"
MONSTER_SPAWN: "MONSTER_SPAWN"
MOUNT_INVENTORY: "MOUNT_INVENTORY"
RIDING: "RIDING"
MUSIC: "MUSIC"
CHEST: "CHEST"
PLACE_BLOCKS: "PLACE_BLOCKS"
PORTAL: "PORTAL"
PRESSURE_PLATE: "PRESSURE_PLATE"
PVP_OVERWORLD: "PVP_OVERWORLD"
PVP_NETHER: "PVP_NETHER"
PVP_END: "PVP_END"
REDSTONE: "REDSTONE"
SPAWN_EGGS: "SPAWN_EGGS"
SHEARING: "SHEARING"
EGGS: "EGGS"
TRADING: "TRADING"
panel:
title: "Island flags"
flag-item:
name-layout: "&a[name]"
description-layout: |+
&a[description]
&7Allowed for: &f[rank]
help-item:
name: "&aNeed some help?"
island:
locked: "&cCette île est verrouillée!"
language:
panel-title: "Choisissez votre langue"
selected: "&aActuellement sélectionné."
edited: "&aLangue modifiée en &e[lang]&a."

View File

@ -22,7 +22,7 @@ general:
player-has-no-island: "&cあの選手には島がない!"
already-have-island: "&cあなたはすでに島を持っている!"
no-safe-location: "&cスタッフの方がとても親切でした。"
not-leader: "&cあなたの島のリーダーではありません!"
not-owner: "&cあなたの島のリーダーではありません!"
not-in-team: "&cあの選手はあなたのチームにはいない!"
offline-player: "&cそのプレイヤーはオフラインまたは存在しません。"
unknown-player: "&c不明なプレイヤー!"
@ -57,22 +57,22 @@ commands:
add:
parameters: "<リーダー> <プレーヤー>"
description: "リーダーのチームにプレイヤーを追加する"
name-not-leader: "&c[name]はリーダーではありません"
name-not-owner: "&c[name]はリーダーではありません"
name-has-island: "&c[name]には島があります。登録を解除するか、最初に削除します。"
disband:
parameters: "<リーダー>"
description: "チームリーダーのチームを解散"
user-disband-leader: "リーダーじゃない!解散を使用 [leader]"
use-disband-owner: "リーダーじゃない!解散を使用 [owner]"
disbanded: "管理者はあなたのチームを解散!"
kick:
parameters: "<プレーヤー>"
description: "チームからプレーヤーを蹴る"
cannot-kick-leader: "&cチームリーダーを蹴ることはできません。キックのメンバーは、まず"
cannot-kick-owner: "&cチームリーダーを蹴ることはできません。キックのメンバーは、まず"
admin-kicked: "管理者は、チームからあなたを蹴った。"
makeleader:
setowner:
parameters: "<プレーヤー>"
description: "プレーヤーをチームのリーダーにする"
already-leader: "&cプレイヤーはすでにリーダーです!"
already-owner: "&cプレイヤーはすでにリーダーです!"
range:
description: "管理島の範囲コマンド"
display:
@ -168,7 +168,7 @@ commands:
delete:
parameters: ""
description: "プレイヤーの島を削除します。"
cannot-delete-team-leader: "&cすべての島のメンバーは、それを削除する前に島から追い出される必要があります。"
cannot-delete-owner: "&cすべての島のメンバーは、それを削除する前に島から追い出される必要があります。"
deleted-island: "&2[xyz] の島は正常に削除されました。"
bentobox:
description: "BentoBox管理コマンド"
@ -291,7 +291,7 @@ commands:
kick:
description: "島からメンバーを削除する"
parameters: "<プレーヤー>"
leader-kicked: "リーダーが島からあなたを削除しました!"
owner-kicked: "リーダーが島からあなたを削除しました!"
cannot-kick: "自分を削除することはできません!"
demote:
description: "ランクダウンあなたの島のプレーヤーを降格"

View File

@ -26,7 +26,7 @@ general:
player-has-no-island: "&cTen gracz nie ma wyspy!"
already-have-island: "&cMasz już wyspę!"
no-safe-location: "&cNa wyspie nie znaleziono bezpiecznej lokalizacji!"
not-leader: "&cNie jesteś liderem swojej wyspy!"
not-owner: "&cNie jesteś liderem swojej wyspy!"
not-in-team: "&cTen gracz nie jest w twojej drużynie."
offline-player: "&cTen gracz jest offline lub nie istnieje."
unknown-player: "&cNieznany gracz!"
@ -55,22 +55,22 @@ commands:
add:
parameters: "<lider> <gracz>"
description: "dodaj gracza do drużyny lidera"
name-not-leader: "&c[name] nie jest liderem"
name-not-owner: "&c[name] nie jest liderem"
name-has-island: "&c[name] ma wyspę. Najpierw musi ją wyrejestrować lub usunąć."
disband:
parameters: "<lider drużyny>"
description: "rozwiąż drużynę lidera wyspy"
user-disband-leader: "&cNie jesteś liderem! Użyj disband [leader]"
use-disband-owner: "&cNie jesteś liderem! Użyj disband [owner]"
disbanded: "&cAdministrator rozwiązał Twoją drużyne!"
kick:
parameters: "<gracz z drużyny>"
description: "wyrzuć gracza z drużyny"
cannot-kick-leader: "&cNie możesz wyrzucić lidera drużyny. Najpierw wyrzuć członków."
cannot-kick-owner: "&cNie możesz wyrzucić lidera drużyny. Najpierw wyrzuć członków."
admin-kicked: "&cAdministrator wyrzucił Cię z drużyny."
makeleader:
setowner:
parameters: "<gracz>"
description: "uczyń gracza liderem wyspy"
already-leader: "&cGracz jest już liderem!"
already-owner: "&cGracz jest już liderem!"
register:
parameters: "<gracz>"
description: "zarejestruj gracza na niezamieszkanej wyspie, na której jesteś"
@ -215,7 +215,7 @@ commands:
kick:
description: "wyrzuć gracza z swojej wyspy"
parameters: "<gracz>"
leader-kicked: "&cLider wyrzucił Cię z jego wyspy."
owner-kicked: "&cLider wyrzucił Cię z jego wyspy."
cannot-kick: "&cNie możesz wyrzucić samego siebie."
demote:
description: "degraduj gracza na swojej wyspie do roli"

View File

@ -23,7 +23,7 @@ general:
player-has-no-island: "&cNgười chơi đó không có đảo!"
already-have-island: "&cBạn đã có đảo!"
no-safe-location: "&cKhông có địa điểm an toàn nào trên đảo!"
not-leader: "&cBạn không phải đội trưởng!"
not-owner: "&cBạn không phải đội trưởng!"
not-in-team: "&cNgười chơi không có trong đội!"
offline-player: "&cNgười chơi đang offline hoặc không tồn tại."
unknown-player: "&cNgười chơi không tìm thấy!"
@ -129,7 +129,7 @@ commands:
description: "loại bỏ 1 người chơi khỏi đảo"
parameters: "<player>"
type-again: "&cHãy đánh lệnh loại bỏ 1 lần nữa để xác nhận"
leader-kicked: "&cĐội trưởng đã đuổi bạn ra khỏi đội!"
owner-kicked: "&cĐội trưởng đã đuổi bạn ra khỏi đội!"
demote:
description: "hạ cấp bậc người chơi"
parameters: "<player>"

View File

@ -21,7 +21,7 @@ general:
player-has-no-island: "&c该玩家没有岛屿"
already-have-island: "&c您已经有岛屿了"
no-safe-location: "&c岛上没有安全位置"
not-leader: "&c您不是您的岛上的队长"
not-owner: "&c您不是您的岛上的队长"
not-in-team: "&c该玩家不是您的队员"
offline-player: "&c该玩家不在线或不存在。"
unknown-player: "&c[name] 是未知玩家!"
@ -54,19 +54,19 @@ commands:
description: "清空所有玩家在这个世界的重制次数"
team:
add:
parameters: "<leader> <player>"
parameters: "<owner> <player>"
description: "将玩家添加到队长的队伍中"
name-not-leader: "&c[name] 不是队长"
name-not-owner: "&c[name] 不是队长"
name-has-island: "&c[name] 已经有岛屿了。请先注销或删除它们!"
disband:
parameters: "<team leader>"
parameters: "<owner>"
description: "解散队长的队伍"
user-disband-leader: "&c不是队长请用 disband [leader]"
use-disband-owner: "&c不是队长请用 disband [owner]"
disbanded: "&c管理员解散了您的队伍"
kick:
parameters: "<team player>"
description: "从队伍中踢走玩家"
cannot-kick-leader: "&c您不能踢走队长。请先踢走成员"
cannot-kick-owner: "&c您不能踢走队长。请先踢走成员"
admin-kicked: "&c管理员将您从队伍中踢了出来。"
setowner:
parameters: "<player>"
@ -188,7 +188,7 @@ commands:
delete:
parameters: ""
description: "删除玩家的岛屿"
cannot-delete-team-leader: "&c删除之前必须将所有岛屿成员都踢出岛屿。"
cannot-delete-owner: "&c删除之前必须将所有岛屿成员都踢出岛屿。"
deleted-island: "&a位于 &e[xyz] &a的岛屿已经被成功删除。"
why:
parameters: "<player>"
@ -323,7 +323,7 @@ commands:
kick:
description: "从您的岛屿踢出成员"
parameters: "<player>"
leader-kicked: "&c队长将您踢出岛屿"
owner-kicked: "&c队长将您踢出岛屿"
cannot-kick: "&c您不能把自己踢出去"
demote:
description: "将您岛屿上的玩家降阶"

View File

@ -36,7 +36,6 @@ import world.bentobox.bentobox.managers.IslandsManager;
import world.bentobox.bentobox.managers.LocalesManager;
import world.bentobox.bentobox.managers.PlayersManager;
/**
* @author tastybento
*
@ -162,14 +161,14 @@ public class AdminDeleteCommandTest {
* Test method for {@link AdminDeleteCommand#execute(User, String, java.util.List)
*/
@Test
public void testExecuteTeamLeader() {
public void testExecuteOwner() {
when(im.inTeam(Mockito.any(),Mockito.any())).thenReturn(true);
when(im.getOwner(Mockito.any(), Mockito.any())).thenReturn(notUUID);
String[] name = {"tastybento"};
when(pm.getUUID(Mockito.any())).thenReturn(notUUID);
AdminDeleteCommand itl = new AdminDeleteCommand(ac);
assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name)));
Mockito.verify(user).sendMessage("commands.admin.delete.cannot-delete-team-leader");
Mockito.verify(user).sendMessage("commands.admin.delete.cannot-delete-owner");
}
/**

View File

@ -139,7 +139,7 @@ public class AdminTeamAddCommandTest {
AdminTeamAddCommand itl = new AdminTeamAddCommand(ac);
String[] name = {"tastybento", "poslovich"};
// Unknown leader
// Unknown owner
when(pm.getUUID(Mockito.eq("tastybento"))).thenReturn(null);
when(pm.getUUID(Mockito.eq("poslovich"))).thenReturn(notUUID);
assertFalse(itl.execute(user, ac.getLabel(), Arrays.asList(name)));
@ -193,14 +193,14 @@ public class AdminTeamAddCommandTest {
* Test method for {@link AdminTeamAddCommand#execute(User, String, List)}.
*/
@Test
public void testExecuteAddNotLeader() {
public void testExecuteAddNotOwner() {
AdminTeamAddCommand itl = new AdminTeamAddCommand(ac);
String[] name = {"tastybento", "poslovich"};
when(pm.getUUID(Mockito.eq("tastybento"))).thenReturn(uuid);
when(pm.getUUID(Mockito.eq("poslovich"))).thenReturn(notUUID);
// Has island, has team, but not a leader
// Has island, has team, but not an owner
when(im.hasIsland(Mockito.any(),Mockito.eq(uuid))).thenReturn(true);
when(im.inTeam(Mockito.any(),Mockito.eq(uuid))).thenReturn(true);
when(im.getOwner(Mockito.any(),Mockito.eq(uuid))).thenReturn(notUUID);
@ -210,7 +210,7 @@ public class AdminTeamAddCommandTest {
when(im.getIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(island);
assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name)));
Mockito.verify(user).sendMessage("commands.admin.team.add.name-not-leader", "[name]", "tastybento");
Mockito.verify(user).sendMessage("commands.admin.team.add.name-not-owner", "[name]", "tastybento");
Mockito.verify(island).showMembers(Mockito.eq(plugin), Mockito.any(), Mockito.any());
}
@ -225,7 +225,7 @@ public class AdminTeamAddCommandTest {
when(pm.getUUID(Mockito.eq("tastybento"))).thenReturn(uuid);
when(pm.getUUID(Mockito.eq("poslovich"))).thenReturn(notUUID);
// Has island, has team, is leader
// Has island, has team, is owner
when(im.hasIsland(Mockito.any(),Mockito.eq(uuid))).thenReturn(true);
when(im.inTeam(Mockito.any(),Mockito.eq(uuid))).thenReturn(true);
when(im.getOwner(Mockito.any(), Mockito.eq(uuid))).thenReturn(uuid);

View File

@ -151,7 +151,7 @@ public class AdminTeamDisbandCommandTest {
* Test method for {@link AdminTeamDisbandCommand#execute(User, String, List)}.
*/
@Test
public void testExecuteDisbandNotLeader() {
public void testExecuteDisbandNotOwner() {
when(im.inTeam(Mockito.any(), Mockito.any())).thenReturn(true);
Island is = mock(Island.class);
when(im.getIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(is);
@ -159,11 +159,11 @@ public class AdminTeamDisbandCommandTest {
when(pm.getUUID(Mockito.any())).thenReturn(notUUID);
when(im.getOwner(Mockito.any(), Mockito.eq(notUUID))).thenReturn(uuid);
when(pm.getName(Mockito.any())).thenReturn("leader");
when(pm.getName(Mockito.any())).thenReturn("owner");
AdminTeamDisbandCommand itl = new AdminTeamDisbandCommand(ac);
assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name)));
Mockito.verify(user).sendMessage("commands.admin.team.disband.use-disband-leader", "[leader]", "leader");
Mockito.verify(user).sendMessage("commands.admin.team.disband.use-disband-owner", "[owner]", "owner");
}
/**
@ -176,7 +176,7 @@ public class AdminTeamDisbandCommandTest {
when(im.getIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(is);
String[] name = {"tastybento"};
when(pm.getUUID(Mockito.any())).thenReturn(notUUID);
// Leader
// Owner
when(im.getOwner(Mockito.any(), Mockito.eq(notUUID))).thenReturn(notUUID);
// Members
Set<UUID> members = new HashSet<>();

View File

@ -154,7 +154,7 @@ public class AdminTeamKickCommandTest {
* Test method for {@link AdminTeamKickCommand#execute(User, String, List)} .
*/
@Test
public void testExecuteKickLeader() {
public void testExecuteKickOwner() {
when(im.inTeam(Mockito.any(), Mockito.any())).thenReturn(true);
Island is = mock(Island.class);
when(im.getIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(is);
@ -165,7 +165,7 @@ public class AdminTeamKickCommandTest {
AdminTeamKickCommand itl = new AdminTeamKickCommand(ac);
assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name)));
Mockito.verify(user).sendMessage(Mockito.eq("commands.admin.team.kick.cannot-kick-leader"));
Mockito.verify(user).sendMessage(Mockito.eq("commands.admin.team.kick.cannot-kick-owner"));
Mockito.verify(is).showMembers(Mockito.any(), Mockito.any(), Mockito.any());
}

View File

@ -152,7 +152,7 @@ public class AdminTeamSetownerCommandTest {
* Test method for {@link AdminTeamSetownerCommand#execute(User, String, List)}.
*/
@Test
public void testExecuteMakeLeaderAlreadyLeader() {
public void testExecuteMakeOwnerAlreadyOwner() {
when(im.inTeam(Mockito.any(), Mockito.any())).thenReturn(true);
Island is = mock(Island.class);
when(im.getIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(is);
@ -176,7 +176,7 @@ public class AdminTeamSetownerCommandTest {
when(im.getIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(is);
String[] name = {"tastybento"};
when(pm.getUUID(Mockito.any())).thenReturn(notUUID);
// Leader
// Owner
when(im.getOwner(Mockito.any(), Mockito.eq(notUUID))).thenReturn(uuid);
when(pm.getName(Mockito.eq(uuid))).thenReturn("owner");
// Members

View File

@ -131,7 +131,7 @@ public class IslandBanCommandTest {
// *** Error conditions ***
// Ban without an island
// Ban as not a team leader
// Ban as not an owner
// Ban unknown user
// Ban self
// Ban team mate

View File

@ -122,10 +122,9 @@ public class IslandResetCommandTest {
/**
* Test method for .
* @throws IOException
*/
@Test
public void testNoIsland() throws IOException {
public void testNoIsland() {
IslandResetCommand irc = new IslandResetCommand(ic);
// Test the reset command
// Does not have island
@ -134,18 +133,18 @@ public class IslandResetCommandTest {
}
@Test
public void testNotLeader() throws IOException {
public void testNotOwner() {
IslandResetCommand irc = new IslandResetCommand(ic);
// Now has island, but is not the leader
// Now has island, but is not the owner
when(im.hasIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(true);
assertFalse(irc.execute(user, irc.getLabel(), new ArrayList<>()));
Mockito.verify(user).sendMessage("general.errors.not-leader");
Mockito.verify(user).sendMessage("general.errors.not-owner");
}
@Test
public void testHasTeam() throws IOException {
public void testHasTeam() {
IslandResetCommand irc = new IslandResetCommand(ic);
// Now has island, but is not the leader
// Now has island, but is not the owner
when(im.hasIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(true);
// Now is owner, but still has team
when(im.isOwner(Mockito.any(), Mockito.eq(uuid))).thenReturn(true);
@ -154,9 +153,9 @@ public class IslandResetCommandTest {
}
@Test
public void testNoResetsLeft() throws IOException {
public void testNoResetsLeft() {
IslandResetCommand irc = new IslandResetCommand(ic);
// Now has island, but is not the leader
// Now has island, but is not the owner
when(im.hasIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(true);
// Now is owner, but still has team
when(im.isOwner(Mockito.any(), Mockito.eq(uuid))).thenReturn(true);
@ -173,7 +172,7 @@ public class IslandResetCommandTest {
@Test
public void testNoConfirmationRequired() throws IOException {
IslandResetCommand irc = new IslandResetCommand(ic);
// Now has island, but is not the leader
// Now has island, but is not the owner
when(im.hasIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(true);
// Now is owner, but still has team
when(im.isOwner(Mockito.any(), Mockito.eq(uuid))).thenReturn(true);
@ -207,7 +206,7 @@ public class IslandResetCommandTest {
@Test
public void testUnlimitedResets() throws IOException {
IslandResetCommand irc = new IslandResetCommand(ic);
// Now has island, but is not the leader
// Now has island, but is not the owner
when(im.hasIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(true);
// Now is owner, but still has team
when(im.isOwner(Mockito.any(), Mockito.eq(uuid))).thenReturn(true);
@ -244,7 +243,7 @@ public class IslandResetCommandTest {
@Test
public void testConfirmationRequired() throws IOException {
IslandResetCommand irc = new IslandResetCommand(ic);
// Now has island, but is not the leader
// Now has island, but is not the owner
when(im.hasIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(true);
// Now is owner, but still has team
when(im.isOwner(Mockito.any(), Mockito.eq(uuid))).thenReturn(true);
@ -285,7 +284,7 @@ public class IslandResetCommandTest {
@Test
public void testNewIslandError() throws IOException {
IslandResetCommand irc = new IslandResetCommand(ic);
// Now has island, but is not the leader
// Now has island, but is not the owner
when(im.hasIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(true);
// Now is owner, but still has team
when(im.isOwner(Mockito.any(), Mockito.eq(uuid))).thenReturn(true);

View File

@ -128,7 +128,7 @@ public class IslandUnbanCommandTest {
// *** Error conditions ***
// Unban without an island
// Unban as not a team leader
// Unban as not an owner
// Unban unknown user
// Unban self
// Unban someone not banned

View File

@ -1,6 +1,3 @@
/**
*
*/
package world.bentobox.bentobox.api.commands.island.team;
import static org.junit.Assert.assertFalse;
@ -42,7 +39,6 @@ import world.bentobox.bentobox.managers.PlayersManager;
/**
* @author tastybento
*
*/
@RunWith(PowerMockRunner.class)
@PrepareForTest({Bukkit.class, BentoBox.class, User.class })
@ -142,11 +138,11 @@ public class IslandTeamKickCommandTest {
* Test method for .
*/
@Test
public void testExecuteNotTeamLeader() {
public void testExecuteNotTeamOwner() {
when(im.getOwner(Mockito.any(), Mockito.any())).thenReturn(notUUID);
IslandTeamKickCommand itl = new IslandTeamKickCommand(ic);
assertFalse(itl.execute(user, itl.getLabel(), new ArrayList<>()));
Mockito.verify(user).sendMessage(Mockito.eq("general.errors.not-leader"));
Mockito.verify(user).sendMessage(Mockito.eq("general.errors.not-owner"));
}
/**

View File

@ -1,6 +1,3 @@
/**
*
*/
package world.bentobox.bentobox.api.commands.island.team;
import static org.junit.Assert.assertFalse;
@ -119,7 +116,7 @@ public class IslandTeamLeaveCommandTest {
* Test method for .
*/
@Test
public void testExecuteInTeamLeader() {
public void testExecuteInOwner() {
IslandTeamLeaveCommand itl = new IslandTeamLeaveCommand(ic);
assertFalse(itl.execute(user, itl.getLabel(), new ArrayList<>()));
Mockito.verify(user).sendMessage(Mockito.eq("commands.island.team.leave.cannot-leave"));
@ -133,7 +130,7 @@ public class IslandTeamLeaveCommandTest {
when(s.isLeaveConfirmation()).thenReturn(false);
when(im.hasIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(false);
when(im.isOwner(Mockito.any(), Mockito.eq(uuid))).thenReturn(false);
// Add a team leader - null
// Add a team owner - null
when(im.getOwner(Mockito.any(), Mockito.any())).thenReturn(null);
IslandTeamLeaveCommand itl = new IslandTeamLeaveCommand(ic);
@ -152,7 +149,7 @@ public class IslandTeamLeaveCommandTest {
when(s.getConfirmationTime()).thenReturn(3);
when(im.hasIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(false);
when(im.isOwner(Mockito.any(), Mockito.eq(uuid))).thenReturn(false);
// Add a team leader - null
// Add a team owner - null
when(im.getOwner(Mockito.any(), Mockito.any())).thenReturn(null);
IslandTeamLeaveCommand itl = new IslandTeamLeaveCommand(ic);
@ -169,7 +166,7 @@ public class IslandTeamLeaveCommandTest {
when(s.isLeaveConfirmation()).thenReturn(false);
when(im.hasIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(false);
when(im.isOwner(Mockito.any(), Mockito.eq(uuid))).thenReturn(false);
// Add a team leader - null
// Add a team owner - null
when(im.getOwner(Mockito.any(), Mockito.any())).thenReturn(null);
// Require resets

View File

@ -42,7 +42,6 @@ public class IslandCacheTest {
UUID owner = UUID.randomUUID();
Location location;
@Before
public void setUp() throws Exception {
plugin = mock(BentoBox.class);
@ -205,7 +204,7 @@ public class IslandCacheTest {
}
*/
@Test
public void testgetMembers() {
public void testGetMembers() {
// New cache
IslandCache ic = new IslandCache();
ic.addIsland(island);
@ -217,7 +216,7 @@ public class IslandCacheTest {
}
@Test
public void testGetTeamLeader() {
public void testGetOwner() {
// New cache
IslandCache ic = new IslandCache();
ic.addIsland(island);
@ -225,8 +224,6 @@ public class IslandCacheTest {
assertEquals(owner, ic.getOwner(world, owner));
assertNull(ic.getOwner(world, null));
assertNull(ic.getOwner(world, UUID.randomUUID()));
}
@Test