Skip to content

Commit

Permalink
Fixed incorrect detection of invalid island when joining the server
Browse files Browse the repository at this point in the history
  • Loading branch information
OmerBenGera committed Aug 19, 2022
1 parent 6482d64 commit 7bd626e
Showing 1 changed file with 5 additions and 2 deletions.
Expand Up @@ -109,6 +109,10 @@ private void onPlayerJoin(PlayerJoinEvent e) {
notifyPlayerJoin(superiorPlayer);

Island island = plugin.getGrid().getIslandAt(e.getPlayer().getLocation());

// Checking if the player is in the islands world, not inside an island.
boolean teleportToSpawn = plugin.getGrid().isIslandsWorld(superiorPlayer.getWorld()) && island == null;

if (island != null) {
onPlayerEnterIsland(superiorPlayer, null, null, e.getPlayer().getLocation(), island,
IslandEnterEvent.EnterCause.PLAYER_JOIN);
Expand All @@ -122,8 +126,7 @@ private void onPlayerJoin(PlayerJoinEvent e) {
if (!plugin.getProviders().notifySkinsListeners(superiorPlayer))
plugin.getNMSPlayers().setSkinTexture(superiorPlayer);

// Checking if the player is in the islands world, not inside an island.
if (plugin.getGrid().isIslandsWorld(superiorPlayer.getWorld()) && island == null) {
if (teleportToSpawn) {
superiorPlayer.teleport(plugin.getGrid().getSpawnIsland());
Message.ISLAND_GOT_DELETED_WHILE_INSIDE.send(superiorPlayer);
}
Expand Down

0 comments on commit 7bd626e

Please sign in to comment.