Skip to content

Conversation

@tastybento
Copy link
Member

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR bumps the plugin to version 3.11.2 and refines island/home teleport and primary-island handling, while updating the build to target newer Paper and Java 21 settings.

Changes:

  • Extend IslandsManager.getIsland(World, UUID) to prefer the island the (online) player is currently on, and introduce a new homeTeleportAsync(Island, User, boolean) overload plus getPrimaryIsland(World, UUID) convenience method.
  • Adjust island creation (NewIsland) and /is go logic to use the new APIs (including support for island-name destinations) and to better manage spawn/home locations and primary islands.
  • Update Gradle build configuration for version 3.11.2, newer Paper API, and consistent Java 21 compilation; adapt tests to the updated method overloads.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/test/java/world/bentobox/bentobox/api/commands/island/IslandExpelCommandTest.java Tightens the Mockito verification to the homeTeleportAsync(World, Player) overload after new overloads were added.
src/main/java/world/bentobox/bentobox/managers/island/NewIsland.java After island creation, now sets the island-based home location and primary island, and uses the new homeTeleportAsync(Island, User, boolean) for first-time teleports.
src/main/java/world/bentobox/bentobox/managers/IslandsManager.java Changes getIsland(World, UUID) to check the player’s current island when online, adds getPrimaryIsland(World, UUID) and homeTeleportAsync(Island, User[, boolean]), and wires these into existing home-location logic.
src/main/java/world/bentobox/bentobox/database/objects/Island.java Simplifies setSpawnPoint to avoid unnecessary setChanged() calls and to clone the stored Location.
src/main/java/world/bentobox/bentobox/api/commands/island/IslandGoCommand.java Refactors /is go to distinguish between island names and home names, setting primary islands accordingly and using either the existing world-based teleport or the new island-based teleport.
build.gradle.kts Bumps plugin version to 3.11.2, updates Paper API version, drops the Spigot compile-only dependency, and standardizes Java 21 compiler options for main and test sources.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1841 to +1847
public CompletableFuture<Void> homeTeleportAsync(Island island, User user, boolean newIsland) {
Location loc = island.getHome("");
user.sendMessage("commands.island.go.teleport");
goingHome.add(user.getUniqueId());
readyPlayer(user.getPlayer());
return Util.teleportAsync(Objects.requireNonNull(user.getPlayer()), loc).thenAccept(b -> {
// Only run the commands if the player is successfully teleported
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

homeTeleportAsync(Island, User, boolean) calls island.getHome("") directly and passes the result to Util.teleportAsync(...) without any null check or fallback. For islands that do not yet have a default home (e.g., no-paste creations or legacy islands without homes), island.getHome("") can be null, which will lead to a null Location being used for teleportation and likely a runtime exception. To keep behavior consistent with the existing world-based homeTeleportAsync overload, this method should resolve a safe home location (e.g., via getHomeLocation(island) or equivalent safe-location logic) and handle the case where no home exists before attempting teleport.

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

Comment on lines +1830 to +1855
public CompletableFuture<Void> homeTeleportAsync(Island island, User user) {
return homeTeleportAsync(island, user, false);
}

/**
* Teleport the user home
* @param island island
* @param user user
* @param newIsland true if this is a new island first time teleport
* @return future when it is done
*/
public CompletableFuture<Void> homeTeleportAsync(Island island, User user, boolean newIsland) {
Location loc = island.getHome("");
user.sendMessage("commands.island.go.teleport");
goingHome.add(user.getUniqueId());
readyPlayer(user.getPlayer());
return Util.teleportAsync(Objects.requireNonNull(user.getPlayer()), loc).thenAccept(b -> {
// Only run the commands if the player is successfully teleported
if (Boolean.TRUE.equals(b)) {
teleported(island.getWorld(), user, "", newIsland, island);
this.setPrimaryIsland(user.getUniqueId(), island);
} else {
// Remove from mid-teleport set
goingHome.remove(user.getUniqueId());
}
});
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new overload homeTeleportAsync(Island, User, boolean) in IslandsManager is not covered by existing tests, whereas other teleport-related behaviors (e.g., the world-based homeTeleportAsync overloads and listeners using them) do have tests. Consider adding unit tests for this method, particularly for cases where the island has and does not have a default home, to ensure it behaves correctly and stays aligned with the existing safe-teleport logic.

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

Copy link
Contributor

Copilot AI commented Jan 31, 2026

@tastybento I've opened a new pull request, #2792, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

Copilot AI commented Jan 31, 2026

@tastybento I've opened a new pull request, #2793, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 2 commits January 31, 2026 17:25
Co-authored-by: tastybento <4407265+tastybento@users.noreply.github.com>
Fix Javadoc @link syntax in getPrimaryIsland method
@sonarqubecloud
Copy link

Copy link
Contributor

Copilot AI commented Jan 31, 2026

@tastybento I've opened a new pull request, #2794, to work on those changes. Once the pull request is ready, I'll request review from you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants