mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-28 05:35:44 +01:00
Fix for issue where team members are sometimes not recognized.
https://github.com/BentoBoxWorld/bentobox/issues/318
This commit is contained in:
parent
0346ea8a23
commit
d9783c8d73
@ -636,8 +636,7 @@ public class IslandsManager {
|
||||
}
|
||||
return getProtectedIslandAt(user.getLocation())
|
||||
.map(i -> i.getMembers().entrySet().stream()
|
||||
.map(en -> en.getKey().equals(user.getUniqueId()) && en.getValue() > RanksManager.VISITOR_RANK)
|
||||
.findAny().orElse(false))
|
||||
.anyMatch(en -> en.getKey().equals(user.getUniqueId()) && en.getValue() > RanksManager.VISITOR_RANK))
|
||||
.orElse(false);
|
||||
}
|
||||
|
||||
|
@ -830,9 +830,29 @@ public class IslandsManagerTest {
|
||||
when(is.getMembers()).thenReturn(members);
|
||||
assertFalse(im.userIsOnIsland(world, user));
|
||||
|
||||
// One member, just the owner
|
||||
members.put(user.getUniqueId(), RanksManager.MEMBER_RANK);
|
||||
assertTrue(im.userIsOnIsland(world, user));
|
||||
|
||||
// Add some members
|
||||
members.put(UUID.randomUUID(), RanksManager.MEMBER_RANK);
|
||||
members.put(UUID.randomUUID(), RanksManager.MEMBER_RANK);
|
||||
members.put(UUID.randomUUID(), RanksManager.MEMBER_RANK);
|
||||
members.put(UUID.randomUUID(), RanksManager.MEMBER_RANK);
|
||||
members.put(UUID.randomUUID(), RanksManager.MEMBER_RANK);
|
||||
members.put(UUID.randomUUID(), RanksManager.MEMBER_RANK);
|
||||
members.put(UUID.randomUUID(), RanksManager.MEMBER_RANK);
|
||||
assertTrue(im.userIsOnIsland(world, user));
|
||||
|
||||
// Add some other ranks
|
||||
members.put(UUID.randomUUID(), RanksManager.BANNED_RANK);
|
||||
members.put(UUID.randomUUID(), RanksManager.BANNED_RANK);
|
||||
members.put(UUID.randomUUID(), RanksManager.COOP_RANK);
|
||||
members.put(UUID.randomUUID(), RanksManager.TRUSTED_RANK);
|
||||
members.put(UUID.randomUUID(), RanksManager.BANNED_RANK);
|
||||
assertTrue(im.userIsOnIsland(world, user));
|
||||
|
||||
// Confirm that if user is not above Member rank then it fails
|
||||
members.put(user.getUniqueId(), RanksManager.BANNED_RANK);
|
||||
assertFalse(im.userIsOnIsland(world, user));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user