Added island registration/unregistration.

Island center was not correctly being kept as immutable.
This commit is contained in:
tastybento 2018-06-23 15:45:09 -07:00
parent 97cf9b4132
commit 9b8d42f692
16 changed files with 109 additions and 55 deletions

View File

@ -77,6 +77,7 @@ commands:
description: "register player to unowned island you are on" description: "register player to unowned island you are on"
registered-island: "&aRegistered player to island at [xyz]." registered-island: "&aRegistered player to island at [xyz]."
already-owned: "&cIsland is already owned by another player!" already-owned: "&cIsland is already owned by another player!"
no-island-here: "&cThere is no island here. Confirm to make one."
unregister: unregister:
parameters: "<owner>" parameters: "<owner>"
description: "unregister owner from island, but keep island blocks" description: "unregister owner from island, but keep island blocks"
@ -100,6 +101,7 @@ commands:
is-spawn: "Island is a spawn island" is-spawn: "Island is a spawn island"
banned-players: "Banned players:" banned-players: "Banned players:"
banned-format: "&c[name]" banned-format: "&c[name]"
unowned: "&cUnonwed"
version: version:
description: "display %bsb_plugin_name% and addons versions" description: "display %bsb_plugin_name% and addons versions"
setrange: setrange:

View File

@ -30,7 +30,7 @@ public class AdminInfoCommand extends CompositeCommand {
// If there are no args, then the player wants info on the island at this location // If there are no args, then the player wants info on the island at this location
if (args.isEmpty()) { if (args.isEmpty()) {
getPlugin().log("DEBUG: getting info - no args"); getPlugin().log("DEBUG: getting info - no args");
if (!getIslands().getIslandAt(user.getLocation()).map(i -> i.showInfo(getPlugin(), user)).orElse(false)) { if (!getIslands().getIslandAt(user.getLocation()).map(i -> i.showInfo(getPlugin(), user, getWorld())).orElse(false)) {
user.sendMessage("commands.admin.info.no-island"); user.sendMessage("commands.admin.info.no-island");
return false; return false;
} }
@ -47,7 +47,7 @@ public class AdminInfoCommand extends CompositeCommand {
return false; return false;
} }
// Show info for this player // Show info for this player
getIslands().getIsland(getWorld(), targetUUID).showInfo(getPlugin(), user); getIslands().getIsland(getWorld(), targetUUID).showInfo(getPlugin(), user, getWorld());
return true; return true;
} }
} }

View File

@ -1,9 +1,13 @@
package us.tastybento.bskyblock.commands.admin; package us.tastybento.bskyblock.commands.admin;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.UUID; import java.util.UUID;
import org.bukkit.Location;
import org.bukkit.Material;
import us.tastybento.bskyblock.api.commands.CompositeCommand; import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.user.User; import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.database.objects.Island; import us.tastybento.bskyblock.database.objects.Island;
@ -44,8 +48,6 @@ public class AdminRegisterCommand extends CompositeCommand {
user.sendMessage("commands.admin.register.cannot-register-team-player"); user.sendMessage("commands.admin.register.cannot-register-team-player");
return false; return false;
} }
getIslands().getIslandAt(user.getLocation()).ifPresent(i -> getPlugin().log("DEBUG: island at this location is " + i.getCenter()));
// Check if island is owned // Check if island is owned
Optional<Island> island = getIslands().getIslandAt(user.getLocation()); Optional<Island> island = getIslands().getIslandAt(user.getLocation());
@ -54,13 +56,51 @@ public class AdminRegisterCommand extends CompositeCommand {
return false; return false;
} }
// Register island if it exists // Register island if it exists
return island.map(i -> { if (!island.map(i -> {
// Island exists // Island exists
getIslands().makeLeader(user, targetUUID, i, getPermissionPrefix()); getIslands().makeLeader(user, targetUUID, i, getPermissionPrefix());
user.sendMessage("commands.admin.register.registered-island", "[xyz]", Util.xyz(i.getCenter().toVector())); user.sendMessage("commands.admin.register.registered-island", "[xyz]", Util.xyz(i.getCenter().toVector()));
user.sendMessage("general.success"); user.sendMessage("general.success");
return true; return true;
}).orElse(false); // Island does not exist }).orElse(false)) {
// Island does not exist
user.sendMessage("commands.admin.register.no-island-here");
this.askConfirmation(user, () -> {
// Make island here
Island i = getIslands().createIsland(getClosestIsland(user.getLocation()), targetUUID);
getIslands().makeLeader(user, targetUUID, i, getPermissionPrefix());
getWorld().getBlockAt(i.getCenter()).setType(Material.BEDROCK);
user.sendMessage("commands.admin.register.registered-island", "[xyz]", Util.xyz(i.getCenter().toVector()));
user.sendMessage("general.success");
});
return false;
}
return true;
} }
@Override
public Optional<List<String>> tabComplete(User user, String alias, List<String> args) {
String lastArg = !args.isEmpty() ? args.get(args.size()-1) : "";
if (args.isEmpty()) {
// Don't show every player on the server. Require at least the first letter
return Optional.empty();
}
List<String> options = new ArrayList<>(Util.getOnlinePlayerList(user));
return Optional.of(Util.tabLimit(options, lastArg));
}
/**
* This returns the coordinate of where an island should be on the grid.
*
* @param location
* @return Location of where an island should be on a grid in this world
*/
public Location getClosestIsland(Location location) {
int dist = getIWM().getIslandDistance(getWorld()) * 2;
long x = Math.round((double) location.getBlockX() / dist) * dist + getIWM().getIslandXOffset(getWorld());
long z = Math.round((double) location.getBlockZ() / dist) * dist + getIWM().getIslandZOffset(getWorld());
long y = getIWM().getIslandHeight(getWorld());
return new Location(location.getWorld(), x, y, z);
}
} }

View File

@ -1,6 +1,8 @@
package us.tastybento.bskyblock.commands.admin; package us.tastybento.bskyblock.commands.admin;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Optional;
import java.util.UUID; import java.util.UUID;
import us.tastybento.bskyblock.api.commands.CompositeCommand; import us.tastybento.bskyblock.api.commands.CompositeCommand;
@ -44,7 +46,19 @@ public class AdminUnregisterCommand extends CompositeCommand {
// Unregister island // Unregister island
user.sendMessage("commands.admin.unregister.unregistered-island", "[xyz]", Util.xyz(getIslands().getIsland(getWorld(), targetUUID).getCenter().toVector())); user.sendMessage("commands.admin.unregister.unregistered-island", "[xyz]", Util.xyz(getIslands().getIsland(getWorld(), targetUUID).getCenter().toVector()));
getIslands().removePlayer(getWorld(), targetUUID); getIslands().removePlayer(getWorld(), targetUUID);
getPlayers().clearHomeLocations(getWorld(), targetUUID);
user.sendMessage("general.success"); user.sendMessage("general.success");
return true; return true;
} }
@Override
public Optional<List<String>> tabComplete(User user, String alias, List<String> args) {
String lastArg = !args.isEmpty() ? args.get(args.size()-1) : "";
if (args.isEmpty()) {
// Don't show every player on the server. Require at least the first letter
return Optional.empty();
}
List<String> options = new ArrayList<>(Util.getOnlinePlayerList(user));
return Optional.of(Util.tabLimit(options, lastArg));
}
} }

View File

@ -45,7 +45,7 @@ public class AdminTeamAddCommand extends CompositeCommand {
} }
if (getIslands().inTeam(getWorld(), leaderUUID) && !getIslands().getTeamLeader(getWorld(), leaderUUID).equals(leaderUUID)) { if (getIslands().inTeam(getWorld(), leaderUUID) && !getIslands().getTeamLeader(getWorld(), leaderUUID).equals(leaderUUID)) {
user.sendMessage("commands.admin.team.add.name-not-leader", TextVariables.NAME, args.get(0)); user.sendMessage("commands.admin.team.add.name-not-leader", TextVariables.NAME, args.get(0));
getIslands().getIsland(getWorld(), leaderUUID).showMembers(getPlugin(), user); getIslands().getIsland(getWorld(), leaderUUID).showMembers(getPlugin(), user, getWorld());
return false; return false;
} }
if (getIslands().inTeam(getWorld(), targetUUID)) { if (getIslands().inTeam(getWorld(), targetUUID)) {

View File

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

View File

@ -57,7 +57,7 @@ public class IslandTeamCommand extends CompositeCommand {
} }
} }
// Show members of island // Show members of island
getIslands().getIsland(getWorld(), playerUUID).showMembers(getPlugin(), user); getIslands().getIsland(getWorld(), playerUUID).showMembers(getPlugin(), user, getWorld());
return true; return true;
} }

View File

@ -8,7 +8,6 @@ import java.util.Map.Entry;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.World; import org.bukkit.World;
@ -110,7 +109,8 @@ public class Island implements DataObject {
createdDate = System.currentTimeMillis(); createdDate = System.currentTimeMillis();
updatedDate = System.currentTimeMillis(); updatedDate = System.currentTimeMillis();
world = location.getWorld(); world = location.getWorld();
center = location; // Make a copy of the location
center = new Location(location.getWorld(), location.getX(), location.getY(), location.getZ());
range = BSkyBlock.getInstance().getIWM().getIslandDistance(world); range = BSkyBlock.getInstance().getIWM().getIslandDistance(world);
minX = center.getBlockX() - range; minX = center.getBlockX() - range;
minZ = center.getBlockZ() - range; minZ = center.getBlockZ() - range;
@ -378,7 +378,6 @@ public class Island implements DataObject {
* @return true if in the island space * @return true if in the island space
*/ */
public boolean inIslandSpace(int x, int z) { public boolean inIslandSpace(int x, int z) {
Bukkit.getLogger().info("DEBUG: minX = " + minX + " range = " + range + " minZ = " + minZ);
return x >= minX && x < minX + range*2 && z >= minZ && z < minZ + range*2; return x >= minX && x < minX + range*2 && z >= minZ && z < minZ + range*2;
} }
@ -649,9 +648,10 @@ public class Island implements DataObject {
* Show info on the island * Show info on the island
* @param plugin - plugin * @param plugin - plugin
* @param user - the user who is receiving the info * @param user - the user who is receiving the info
* @param world
* @return true always * @return true always
*/ */
public boolean showInfo(BSkyBlock plugin, User user) { public boolean showInfo(BSkyBlock plugin, User user, World world) {
user.sendMessage("commands.admin.info.title"); user.sendMessage("commands.admin.info.title");
if (owner == null) { if (owner == null) {
user.sendMessage("commands.admin.info.unowned"); user.sendMessage("commands.admin.info.unowned");
@ -665,7 +665,7 @@ public class Island implements DataObject {
String total = plugin.getSettings().getResetLimit() < 0 ? "Unlimited" : String.valueOf(plugin.getSettings().getResetLimit()); String total = plugin.getSettings().getResetLimit() < 0 ? "Unlimited" : String.valueOf(plugin.getSettings().getResetLimit());
user.sendMessage("commands.admin.info.resets-left", "[number]", resets, "[total]", total); user.sendMessage("commands.admin.info.resets-left", "[number]", resets, "[total]", total);
// Show team members // Show team members
showMembers(plugin, user); showMembers(plugin, user, world);
} }
Vector location = center.toVector(); Vector location = center.toVector();
user.sendMessage("commands.admin.info.island-location", "[xyz]", Util.xyz(location)); user.sendMessage("commands.admin.info.island-location", "[xyz]", Util.xyz(location));
@ -691,9 +691,10 @@ public class Island implements DataObject {
* Shows the members of this island * Shows the members of this island
* @param plugin - plugin * @param plugin - plugin
* @param user - user who is requesting * @param user - user who is requesting
* @param world
*/ */
public void showMembers(BSkyBlock plugin, User user) { public void showMembers(BSkyBlock plugin, User user, World world) {
if (plugin.getIslands().inTeam(user.getWorld(), user.getUniqueId())) { if (plugin.getIslands().inTeam(world, user.getUniqueId())) {
user.sendMessage("commands.admin.info.team-members-title"); user.sendMessage("commands.admin.info.team-members-title");
members.forEach((u, i) -> { members.forEach((u, i) -> {
if (owner.equals(u)) { if (owner.equals(u)) {

View File

@ -710,7 +710,7 @@ public class IslandsManager {
} }
} }
}; };
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, save); Bukkit.getScheduler().runTaskAsynchronously(plugin, save);
} else { } else {
for(Island island : collection){ for(Island island : collection){
try { try {

View File

@ -8,18 +8,14 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import us.tastybento.bskyblock.database.objects.Island; import us.tastybento.bskyblock.database.objects.Island;
import us.tastybento.bskyblock.util.Util; import us.tastybento.bskyblock.util.Util;
public class IslandCache { public class IslandCache {
private BiMap<Location, Island> islandsByLocation; private Map<Location, Island> islandsByLocation;
/** /**
* Every player who is associated with an island is in this map. * Every player who is associated with an island is in this map.
*/ */
@ -27,7 +23,7 @@ public class IslandCache {
private Map<World, IslandGrid> grids; private Map<World, IslandGrid> grids;
public IslandCache() { public IslandCache() {
islandsByLocation = HashBiMap.create(); islandsByLocation = new HashMap<>();
islandsByUUID = new HashMap<>(); islandsByUUID = new HashMap<>();
grids = new HashMap<>(); grids = new HashMap<>();
} }
@ -38,10 +34,17 @@ public class IslandCache {
* @return true if successfully added, false if not * @return true if successfully added, false if not
*/ */
public boolean addIsland(Island island) { public boolean addIsland(Island island) {
if (island.getCenter() == null || island.getWorld() == null) {
return false;
}
islandsByLocation.put(island.getCenter(), island); islandsByLocation.put(island.getCenter(), island);
// Make world
islandsByUUID.putIfAbsent(island.getWorld(), new HashMap<>()); islandsByUUID.putIfAbsent(island.getWorld(), new HashMap<>());
islandsByUUID.get(island.getWorld()).put(island.getOwner(), island); // Only add islands to this map if they are owned
island.getMemberSet().forEach(member -> islandsByUUID.get(island.getWorld()).put(member, island)); if (island.getOwner() != null) {
islandsByUUID.get(island.getWorld()).put(island.getOwner(), island);
island.getMemberSet().forEach(member -> islandsByUUID.get(island.getWorld()).put(member, island));
}
return addToGrid(island); return addToGrid(island);
} }
@ -168,19 +171,16 @@ public class IslandCache {
* @param uuid - player's UUID * @param uuid - player's UUID
*/ */
public void removePlayer(World world, UUID uuid) { public void removePlayer(World world, UUID uuid) {
Bukkit.getLogger().info("DEBUG: removing " + uuid + " in " + world.getName());
world = Util.getWorld(world); world = Util.getWorld(world);
islandsByUUID.putIfAbsent(world, new HashMap<>()); islandsByUUID.putIfAbsent(world, new HashMap<>());
Island island = islandsByUUID.get(world).get(uuid); Island island = islandsByUUID.get(world).get(uuid);
if (island != null) { if (island != null) {
Bukkit.getLogger().info("DEBUG: island found");
if (island.getOwner() != null && island.getOwner().equals(uuid)) { if (island.getOwner() != null && island.getOwner().equals(uuid)) {
Bukkit.getLogger().info("DEBUG: owner is not null and uuid is owner");
// Clear ownership and members // Clear ownership and members
island.getMembers().clear(); island.getMembers().clear();
island.setOwner(null); island.setOwner(null);
//islandsByLocation.put(island.getCenter(), island);
} else { } else {
Bukkit.getLogger().info("DEBUG: owner is not uuid - just remove member");
// Remove player from the island membership // Remove player from the island membership
island.removeMember(uuid); island.removeMember(uuid);
} }

View File

@ -1,9 +1,6 @@
package us.tastybento.bskyblock.managers.island; package us.tastybento.bskyblock.managers.island;
import java.util.Map.Entry; import java.util.Map.Entry;
import org.bukkit.Bukkit;
import java.util.TreeMap; import java.util.TreeMap;
import us.tastybento.bskyblock.database.objects.Island; import us.tastybento.bskyblock.database.objects.Island;
@ -72,17 +69,13 @@ public class IslandGrid {
* @return Island or null * @return Island or null
*/ */
public Island getIslandAt(int x, int z) { public Island getIslandAt(int x, int z) {
Bukkit.getLogger().info("DEBUG: x and z = " + x + " " + z);
Entry<Integer, TreeMap<Integer, Island>> en = grid.floorEntry(x); Entry<Integer, TreeMap<Integer, Island>> en = grid.floorEntry(x);
if (en != null) { if (en != null) {
Entry<Integer, Island> ent = en.getValue().floorEntry(z); Entry<Integer, Island> ent = en.getValue().floorEntry(z);
if (ent != null) { if (ent != null) {
Bukkit.getLogger().info("DEBUG: found island");
// Check if in the island range // Check if in the island range
Island island = ent.getValue(); Island island = ent.getValue();
Bukkit.getLogger().info("DEBUG: island center = " + island.getCenter());
if (island.inIslandSpace(x, z)) { if (island.inIslandSpace(x, z)) {
Bukkit.getLogger().info("DEBUG: in island space");
return island; return island;
} }
} }

View File

@ -6,6 +6,8 @@ import java.lang.reflect.Type;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import org.apache.commons.lang.math.NumberUtils; import org.apache.commons.lang.math.NumberUtils;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -151,13 +153,12 @@ public class Util {
* @return a list of online players this player can see * @return a list of online players this player can see
*/ */
public static List<String> getOnlinePlayerList(User user) { public static List<String> getOnlinePlayerList(User user) {
final List<String> returned = new ArrayList<>(); if (user == null || !user.isPlayer()) {
for (Player p : Bukkit.getServer().getOnlinePlayers()) { // Console and null get to see every player
if (user == null || user.getPlayer().canSee(p)) { return Bukkit.getOnlinePlayers().stream().map(Player::getName).collect(Collectors.toList());
returned.add(p.getName());
}
} }
return returned; // Otherwise prevent invisible players from seeing
return Bukkit.getOnlinePlayers().stream().filter(p -> user.getPlayer().canSee(p)).map(Player::getName).collect(Collectors.toList());
} }
/** /**

View File

@ -175,7 +175,7 @@ public class AdminInfoCommandTest {
Island is = mock(Island.class); Island is = mock(Island.class);
when(im.getIsland(Mockito.any(), Mockito.eq(notUUID))).thenReturn(is); when(im.getIsland(Mockito.any(), Mockito.eq(notUUID))).thenReturn(is);
assertTrue(itl.execute(user, Arrays.asList(name))); assertTrue(itl.execute(user, Arrays.asList(name)));
Mockito.verify(is).showInfo(Mockito.eq(plugin), Mockito.eq(user)); Mockito.verify(is).showInfo(Mockito.eq(plugin), Mockito.eq(user), Mockito.any());
} }
/** /**
@ -204,7 +204,7 @@ public class AdminInfoCommandTest {
// Island has owner // Island has owner
Island is = mock(Island.class); Island is = mock(Island.class);
when(is.getOwner()).thenReturn(uuid); when(is.getOwner()).thenReturn(uuid);
when(is.showInfo(Mockito.any(), Mockito.any())).thenReturn(true); when(is.showInfo(Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(true);
Optional<Island> opi = Optional.of(is); Optional<Island> opi = Optional.of(is);
when(im.getIslandAt(Mockito.any())).thenReturn(opi); when(im.getIslandAt(Mockito.any())).thenReturn(opi);
when(user.getLocation()).thenReturn(loc); when(user.getLocation()).thenReturn(loc);
@ -212,6 +212,6 @@ public class AdminInfoCommandTest {
assertTrue(itl.execute(user, new ArrayList<>())); assertTrue(itl.execute(user, new ArrayList<>()));
// Confirm other verifications // Confirm other verifications
Mockito.verify(is).showInfo(Mockito.eq(plugin), Mockito.eq(user)); Mockito.verify(is).showInfo(Mockito.eq(plugin), Mockito.eq(user), Mockito.any());
} }
} }

View File

@ -221,7 +221,7 @@ public class AdminTeamAddCommandTest {
assertFalse(itl.execute(user, Arrays.asList(name))); assertFalse(itl.execute(user, 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-leader", "[name]", "tastybento");
Mockito.verify(island).showMembers(Mockito.eq(plugin), Mockito.any()); Mockito.verify(island).showMembers(Mockito.eq(plugin), Mockito.any(), Mockito.any());
} }
/** /**

View File

@ -176,7 +176,7 @@ public class AdminTeamKickCommandTest {
AdminTeamKickCommand itl = new AdminTeamKickCommand(ac); AdminTeamKickCommand itl = new AdminTeamKickCommand(ac);
assertFalse(itl.execute(user, Arrays.asList(name))); assertFalse(itl.execute(user, 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-leader"));
Mockito.verify(is).showMembers(plugin, user); Mockito.verify(is).showMembers(Mockito.any(), Mockito.any(), Mockito.any());
} }
/** /**

View File

@ -159,6 +159,9 @@ public class IslandsManagerTest {
PowerMockito.mockStatic(Util.class); PowerMockito.mockStatic(Util.class);
when(Util.getWorld(Mockito.any())).thenReturn(world); when(Util.getWorld(Mockito.any())).thenReturn(world);
// Scheduler
when(Bukkit.getScheduler()).thenReturn(mock(BukkitScheduler.class));
} }
@ -426,7 +429,7 @@ public class IslandsManagerTest {
IslandsManager im = new IslandsManager(plugin); IslandsManager im = new IslandsManager(plugin);
Island island = im.createIsland(location); Island island = im.createIsland(location);
assertNotNull(island); assertNotNull(island);
assertEquals(island.getCenter(), location); assertEquals(island.getCenter().getWorld(), location.getWorld());
} }
/** /**
@ -438,7 +441,7 @@ public class IslandsManagerTest {
IslandsManager im = new IslandsManager(plugin); IslandsManager im = new IslandsManager(plugin);
Island island = im.createIsland(location, owner); Island island = im.createIsland(location, owner);
assertNotNull(island); assertNotNull(island);
assertEquals(location, island.getCenter()); assertEquals(island.getCenter().getWorld(), location.getWorld());
assertEquals(owner, island.getOwner()); assertEquals(owner, island.getOwner());
} }
@ -517,7 +520,7 @@ public class IslandsManagerTest {
public void testGetIslandLocation() { public void testGetIslandLocation() {
IslandsManager im = new IslandsManager(plugin); IslandsManager im = new IslandsManager(plugin);
im.createIsland(location, uuid); im.createIsland(location, uuid);
assertEquals(location, im.getIslandLocation(world, uuid)); assertEquals(world, im.getIslandLocation(world, uuid).getWorld());
assertNull(im.getIslandLocation(world, UUID.randomUUID())); assertNull(im.getIslandLocation(world, UUID.randomUUID()));
} }