Changed Island copy constructor to use getters to fix tests.

This commit is contained in:
tastybento 2020-03-04 18:48:35 -08:00
parent f7a3da1502
commit 7d534d7617

View File

@ -193,28 +193,28 @@ public class Island implements DataObject {
*/ */
public Island(Island island) { public Island(Island island) {
this.center = island.getCenter().clone(); this.center = island.getCenter().clone();
this.createdDate = island.createdDate; this.createdDate = island.getCreatedDate();
this.deleted = island.deleted; this.deleted = island.isDeleted();
this.doNotLoad = island.doNotLoad; this.doNotLoad = island.isDoNotLoad();
this.flags.putAll(island.getFlags()); this.flags.putAll(island.getFlags());
this.gameMode = island.gameMode; this.gameMode = island.getGameMode();
this.history.addAll(island.history); this.history.addAll(island.getHistory());
this.levelHandicap = island.levelHandicap; this.levelHandicap = island.getLevelHandicap();
this.maxEverProtectionRange = island.maxEverProtectionRange; this.maxEverProtectionRange = island.getMaxEverProtectionRange();
this.members.putAll(island.members); this.members.putAll(island.getMembers());
this.name = island.name; this.name = island.getName();
this.owner = island.owner; this.owner = island.getOwner();
this.protectionRange = island.protectionRange; this.protectionRange = island.getProtectionRange();
this.purgeProtected = island.purgeProtected; this.purgeProtected = island.getPurgeProtected();
this.range = island.range; this.range = island.getRange();
this.spawn = island.spawn; this.spawn = island.isSpawn();
island.spawnPoint.forEach((k,v) -> this.spawnPoint.put(k, v.clone())); island.getSpawnPoint().forEach((k,v) -> island.spawnPoint.put(k, v.clone()));
this.uniqueId = island.uniqueId; this.uniqueId = island.getUniqueId();
this.updatedDate = island.updatedDate; this.updatedDate = island.getUpdatedDate();
this.world = island.world; this.world = island.getWorld();
this.cooldowns = island.cooldowns; this.cooldowns = island.getCooldowns();
this.commandRanks = island.commandRanks; this.commandRanks = island.getCommandRanks();
this.reserved = island.reserved; this.reserved = island.isReserved();
} }
/* /*
@ -623,7 +623,7 @@ public class Island implements DataObject {
public boolean hasVisitors() { public boolean hasVisitors() {
return Bukkit.getOnlinePlayers().stream().anyMatch(player -> onIsland(player.getLocation()) && getRank(User.getInstance(player)) == RanksManager.VISITOR_RANK); return Bukkit.getOnlinePlayers().stream().anyMatch(player -> onIsland(player.getLocation()) && getRank(User.getInstance(player)) == RanksManager.VISITOR_RANK);
} }
/** /**
* Returns a list of players that are physically inside the island's protection range * Returns a list of players that are physically inside the island's protection range
* @return list of players * @return list of players
@ -635,7 +635,7 @@ public class Island implements DataObject {
.filter(player -> onIsland(player.getLocation())) .filter(player -> onIsland(player.getLocation()))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
/** /**
* Returns whether this Island has players inside its protection range. * Returns whether this Island has players inside its protection range.
* Note this is equivalent to {@code !island.getPlayersOnIsland().isEmpty()}. * Note this is equivalent to {@code !island.getPlayersOnIsland().isEmpty()}.
@ -647,7 +647,7 @@ public class Island implements DataObject {
public boolean hasPlayersOnIsland() { public boolean hasPlayersOnIsland() {
return Bukkit.getOnlinePlayers().stream().anyMatch(player -> onIsland(player.getLocation())); return Bukkit.getOnlinePlayers().stream().anyMatch(player -> onIsland(player.getLocation()));
} }
/** /**
* Check if the flag is allowed or not * Check if the flag is allowed or not
* For flags that are for the island in general and not related to rank. * For flags that are for the island in general and not related to rank.