Skip to content

Commit

Permalink
Changed teleporting to spawn to not occur if bypass mode is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
OmerBenGera committed Sep 25, 2022
1 parent 2bbc2dd commit 6a8a12e
Showing 1 changed file with 7 additions and 7 deletions.
Expand Up @@ -109,10 +109,6 @@ 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 @@ -126,9 +122,13 @@ private void onPlayerJoin(PlayerJoinEvent e) {
if (!plugin.getProviders().notifySkinsListeners(superiorPlayer))
plugin.getNMSPlayers().setSkinTexture(superiorPlayer);

if (teleportToSpawn) {
superiorPlayer.teleport(plugin.getGrid().getSpawnIsland());
Message.ISLAND_GOT_DELETED_WHILE_INSIDE.send(superiorPlayer);
if (!superiorPlayer.hasBypassModeEnabled()) {
Island delayedIsland = plugin.getGrid().getIslandAt(e.getPlayer().getLocation());
// Checking if the player is in the islands world, not inside an island.
if (plugin.getGrid().isIslandsWorld(superiorPlayer.getWorld()) && delayedIsland == null) {
superiorPlayer.teleport(plugin.getGrid().getSpawnIsland());
Message.ISLAND_GOT_DELETED_WHILE_INSIDE.send(superiorPlayer);
}
}

// Checking auto language detection
Expand Down

0 comments on commit 6a8a12e

Please sign in to comment.