only reset game rules if needed

This commit is contained in:
Jack Fitch
2022-10-22 11:55:22 -04:00
parent a932b1b966
commit b9a1451bc9
2 changed files with 5 additions and 3 deletions

View File

@@ -3,7 +3,7 @@ plugins {
} }
group = 'io.github.Jack1424' group = 'io.github.Jack1424'
version = '1.0.0' version = '1.0.1'
repositories { repositories {
mavenCentral() mavenCentral()

View File

@@ -54,8 +54,10 @@ public final class RealTimeWeather extends JavaPlugin implements Listener {
if (world.getEnvironment().equals(World.Environment.NORMAL)) { if (world.getEnvironment().equals(World.Environment.NORMAL)) {
debug("Re-enabling normal daylight and weather cycles..."); debug("Re-enabling normal daylight and weather cycles...");
world.setGameRule(GameRule.DO_DAYLIGHT_CYCLE, true); if (timeEnabled)
world.setGameRule(GameRule.DO_WEATHER_CYCLE, true); world.setGameRule(GameRule.DO_DAYLIGHT_CYCLE, true);
if (weatherEnabled)
world.setGameRule(GameRule.DO_WEATHER_CYCLE, true);
} }
logger.info("Stopping..."); logger.info("Stopping...");