mirror of
https://github.com/nkomarn/harbor.git
synced 2024-11-24 02:45:12 +01:00
Clear weather for instant skip as well
This commit is contained in:
parent
2c871f2b26
commit
308d890c00
@ -21,18 +21,7 @@ public class AccelerateNightTask extends BukkitRunnable {
|
|||||||
this.world = world;
|
this.world = world;
|
||||||
|
|
||||||
harbor.getMessages().sendRandomChatMessage(world, "messages.chat.night-skipping");
|
harbor.getMessages().sendRandomChatMessage(world, "messages.chat.night-skipping");
|
||||||
Bukkit.getScheduler().runTask(harbor, () -> {
|
checker.clearWeather(world);
|
||||||
Config config = harbor.getConfiguration();
|
|
||||||
|
|
||||||
if (config.getBoolean("night-skip.clear-rain")) {
|
|
||||||
world.setStorm(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.getBoolean("night-skip.clear-thunder")) {
|
|
||||||
world.setThundering(false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
runTaskTimer(harbor, 1, 1);
|
runTaskTimer(harbor, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,6 +85,7 @@ public class Checker extends BukkitRunnable {
|
|||||||
|
|
||||||
if (config.getBoolean("night-skip.instant-skip")) {
|
if (config.getBoolean("night-skip.instant-skip")) {
|
||||||
messages.sendRandomChatMessage(world, "messages.chat.night-skipped");
|
messages.sendRandomChatMessage(world, "messages.chat.night-skipped");
|
||||||
|
clearWeather(world);
|
||||||
Bukkit.getScheduler().runTask(harbor, () -> world.setTime(config.getInteger("night-skip.daytime-ticks")));
|
Bukkit.getScheduler().runTask(harbor, () -> world.setTime(config.getInteger("night-skip.daytime-ticks")));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -248,4 +249,23 @@ public class Checker extends BukkitRunnable {
|
|||||||
public void resetStatus(@NotNull World world) {
|
public void resetStatus(@NotNull World world) {
|
||||||
skippingWorlds.remove(world.getUID());
|
skippingWorlds.remove(world.getUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resets the weather states in the provided world.
|
||||||
|
*
|
||||||
|
* @param world The world for which to clear weather.
|
||||||
|
*/
|
||||||
|
public void clearWeather(@NotNull World world) {
|
||||||
|
Bukkit.getScheduler().runTask(harbor, () -> {
|
||||||
|
Config config = harbor.getConfiguration();
|
||||||
|
|
||||||
|
if (world.hasStorm() && config.getBoolean("night-skip.clear-rain")) {
|
||||||
|
world.setStorm(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (world.isThundering() && config.getBoolean("night-skip.clear-thunder")) {
|
||||||
|
world.setThundering(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user