Fixes sethome in nether and end bug.

https://github.com/BentoBoxWorld/BentoBox/issues/538
This commit is contained in:
tastybento 2019-02-11 14:46:54 -08:00
parent 1d5057ec5a
commit dd3bd6d9e7
3 changed files with 12 additions and 7 deletions

View File

@ -22,16 +22,21 @@ public class IslandSethomeCommand extends ConfirmableCommand {
}
@Override
public boolean execute(User user, String label, List<String> args) {
public boolean canExecute(User user, String label, List<String> args) {
// Check island
if (getPlugin().getIslands().getIsland(getWorld(), user.getUniqueId()) == null) {
user.sendMessage("general.errors.no-island");
return false;
}
if (!getPlugin().getIslands().userIsOnIsland(getWorld(), user)) {
if (!getPlugin().getIslands().userIsOnIsland(user.getWorld(), user)) {
user.sendMessage("commands.island.sethome.must-be-on-your-island");
return false;
}
return true;
}
@Override
public boolean execute(User user, String label, List<String> args) {
if (args.isEmpty()) {
// island sethome
setHome(user, 1);

View File

@ -289,7 +289,7 @@ public class IslandsManager {
/**
* Gets the island for this player. If they are in a team, the team island is returned.
* @param world world to check
* @param world world to check. Includes nether and end worlds.
* @param uuid user's uuid
* @return Island or null
*/
@ -736,7 +736,7 @@ public class IslandsManager {
/**
* Checks if an online player is in the protected area of an island he owns or he is part of.
*
* @param world the World to check, if null the method will always return {@code false}.
* @param world the World to check. Typically this is the user's world. Does not check nether or end worlds. If null the method will always return {@code false}.
* @param user the User to check, if null or if this is not a Player the method will always return {@code false}.
*
* @return {@code true} if this User is located within the protected area of an island he owns or he is part of,

View File

@ -116,8 +116,8 @@ public class IslandCache {
/**
* Returns island referenced by UUID
* @param world world to check
* @param uuid player
* @param world world to check. Includes nether and end worlds.
* @param uuid player's UUID
* @return island or null if none
*/
@Nullable