mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-01-02 06:28:13 +01:00
This commit is contained in:
parent
5ebbc2e374
commit
0fe453c163
@ -2,6 +2,7 @@ package us.tastybento.bskyblock.listeners;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
@ -40,6 +41,13 @@ public class JoinLeaveListener implements Listener {
|
||||
if (plugin.getPlayers().isKnown(playerUUID)) {
|
||||
// Load player
|
||||
players.addPlayer(playerUUID);
|
||||
// Sanity check a few things
|
||||
for (Location loc : players.getHomeLocations(playerUUID).values()) {
|
||||
if (!plugin.getIslands().locationIsOnIsland(event.getPlayer(), loc)) {
|
||||
players.clearHomeLocations(playerUUID);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Reset resets if the admin changes it to or from unlimited
|
||||
if (plugin.getSettings().getResetLimit() < players.getResetsLeft(playerUUID) || (plugin.getSettings().getResetLimit() >= 0 && players.getResetsLeft(playerUUID) < 0)) {
|
||||
players.setResetsLeft(playerUUID, plugin.getSettings().getResetLimit());
|
||||
|
@ -182,7 +182,7 @@ public abstract class AbstractFlagListener implements Listener {
|
||||
}
|
||||
}
|
||||
// Check if the plugin is set in User (required for testing)
|
||||
user.setPlugin(plugin);
|
||||
User.setPlugin(plugin);
|
||||
|
||||
if (island.isPresent()) {
|
||||
if (!island.get().isAllowed(user, flag)) {
|
||||
|
@ -689,7 +689,7 @@ public class IslandsManager {
|
||||
* @return true if on valid island, false if not
|
||||
*/
|
||||
public boolean playerIsOnIsland(User user) {
|
||||
return getIslandAt(user.getLocation()).map(x -> x.onIsland(user.getLocation())).orElse(false);
|
||||
return Optional.ofNullable(getIsland(user.getUniqueId())).map(i -> i.onIsland(user.getLocation())).orElse(false);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user