Skip to content

Commit

Permalink
Fixed player times and weather do not update when entering islands (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
OmerBenGera committed Jul 14, 2022
1 parent 0823c26 commit d8ad2b8
Showing 1 changed file with 18 additions and 14 deletions.
Expand Up @@ -458,21 +458,25 @@ public boolean preventPlayerEnterIsland(SuperiorPlayer superiorPlayer,

Player player = superiorPlayer.asPlayer();
if (player != null && (plugin.getSettings().getSpawn().isProtected() || !toIsland.isSpawn())) {
if (toIsland.hasSettingsEnabled(IslandFlags.ALWAYS_DAY)) {
player.setPlayerTime(0, false);
} else if (toIsland.hasSettingsEnabled(IslandFlags.ALWAYS_MIDDLE_DAY)) {
player.setPlayerTime(6000, false);
} else if (toIsland.hasSettingsEnabled(IslandFlags.ALWAYS_NIGHT)) {
player.setPlayerTime(14000, false);
} else if (toIsland.hasSettingsEnabled(IslandFlags.ALWAYS_MIDDLE_NIGHT)) {
player.setPlayerTime(18000, false);
}
BukkitExecutor.sync(() -> {
// Update player time and player weather with a delay.
// Fixes https://github.com/BG-Software-LLC/SuperiorSkyblock2/issues/1260
if (toIsland.hasSettingsEnabled(IslandFlags.ALWAYS_DAY)) {
player.setPlayerTime(0, false);
} else if (toIsland.hasSettingsEnabled(IslandFlags.ALWAYS_MIDDLE_DAY)) {
player.setPlayerTime(6000, false);
} else if (toIsland.hasSettingsEnabled(IslandFlags.ALWAYS_NIGHT)) {
player.setPlayerTime(14000, false);
} else if (toIsland.hasSettingsEnabled(IslandFlags.ALWAYS_MIDDLE_NIGHT)) {
player.setPlayerTime(18000, false);
}

if (toIsland.hasSettingsEnabled(IslandFlags.ALWAYS_SHINY)) {
player.setPlayerWeather(WeatherType.CLEAR);
} else if (toIsland.hasSettingsEnabled(IslandFlags.ALWAYS_RAIN)) {
player.setPlayerWeather(WeatherType.DOWNFALL);
}
if (toIsland.hasSettingsEnabled(IslandFlags.ALWAYS_SHINY)) {
player.setPlayerWeather(WeatherType.CLEAR);
} else if (toIsland.hasSettingsEnabled(IslandFlags.ALWAYS_RAIN)) {
player.setPlayerWeather(WeatherType.DOWNFALL);
}
}, 1L);
}

toIsland.applyEffects(superiorPlayer);
Expand Down

0 comments on commit d8ad2b8

Please sign in to comment.