Fixes spaming in console when teleporting to non-BB worlds.

https://github.com/BentoBoxWorld/bentobox/issues/310

Also added comment to @return value in Addon API
This commit is contained in:
tastybento 2018-11-10 10:22:05 -08:00
parent 68873e033f
commit 3b36ab8814
2 changed files with 9 additions and 2 deletions

View File

@ -333,7 +333,7 @@ public abstract class Addon {
/**
* Returns the permission prefix corresponding to this addon.
* It contains the addon's name plus a trailing dot.
* @return
* @return Permission prefix string
*/
public String getPermissionPrefix() {
return this.getDescription().getName().toLowerCase() + ".";

View File

@ -286,6 +286,13 @@ public class IslandsManager {
* @return Optional Island object
*/
public Optional<Island> getIslandAt(Location location) {
// If this is not an Island World or a standard Nether or End, skip
if (!plugin.getIWM().inWorld(location)
|| (plugin.getIWM().isNether(location.getWorld()) && !plugin.getIWM().isNetherIslands(location.getWorld()))
|| (plugin.getIWM().isEnd(location.getWorld()) && !plugin.getIWM().isEndIslands(location.getWorld()))
) {
return Optional.empty();
}
// Do not return an island if there is no nether or end or islands in them
if ((location.getWorld().getEnvironment().equals(World.Environment.NETHER) &&
(!plugin.getIWM().isNetherGenerate(location.getWorld()) || !plugin.getIWM().isNetherIslands(location.getWorld())))
@ -636,7 +643,7 @@ public class IslandsManager {
return false;
}
return (user.getLocation().getWorld() == world)
&& getProtectedIslandAt(user.getLocation())
&& getProtectedIslandAt(user.getLocation())
.map(i -> i.getMembers().entrySet().stream()
.anyMatch(en -> en.getKey().equals(user.getUniqueId()) && en.getValue() > RanksManager.VISITOR_RANK))
.orElse(false);