From 8d8e311bfdfd88a40ddc0b74e600a9d795b376e9 Mon Sep 17 00:00:00 2001 From: XiaoMoMi <972454774@qq.com> Date: Wed, 3 Apr 2024 19:08:33 +0800 Subject: [PATCH] changed config keys --- .../api/mechanic/world/level/WorldSetting.java | 10 +++++----- .../momirealms/customcrops/mechanic/world/CChunk.java | 1 - .../customcrops/mechanic/world/WorldManagerImpl.java | 2 +- .../net/momirealms/customcrops/util/ConfigUtils.java | 4 ++-- plugin/src/main/resources/config.yml | 4 ++-- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/api/src/main/java/net/momirealms/customcrops/api/mechanic/world/level/WorldSetting.java b/api/src/main/java/net/momirealms/customcrops/api/mechanic/world/level/WorldSetting.java index da4b268..e9a9b0d 100644 --- a/api/src/main/java/net/momirealms/customcrops/api/mechanic/world/level/WorldSetting.java +++ b/api/src/main/java/net/momirealms/customcrops/api/mechanic/world/level/WorldSetting.java @@ -24,7 +24,7 @@ public class WorldSetting implements Cloneable { private final int tickCropInterval; private final int tickPotInterval; private final int tickSprinklerInterval; - private final boolean offlineGrow; + private final boolean offlineTick; private final boolean enableSeason; private final boolean autoSeasonChange; private final int seasonDuration; @@ -47,7 +47,7 @@ public class WorldSetting implements Cloneable { int tickPotInterval, boolean tickSprinklerRandomly, int tickSprinklerInterval, - boolean offlineGrow, + boolean offlineTick, int maxOfflineTime, boolean enableSeason, boolean autoSeasonChange, @@ -62,7 +62,7 @@ public class WorldSetting implements Cloneable { this.tickCropInterval = tickCropInterval; this.tickPotInterval = tickPotInterval; this.tickSprinklerInterval = tickSprinklerInterval; - this.offlineGrow = offlineGrow; + this.offlineTick = offlineTick; this.maxOfflineTime = maxOfflineTime; this.enableSeason = enableSeason; this.autoSeasonChange = autoSeasonChange; @@ -137,8 +137,8 @@ public class WorldSetting implements Cloneable { return tickSprinklerInterval; } - public boolean isOfflineGrow() { - return offlineGrow; + public boolean isOfflineTick() { + return offlineTick; } public boolean isEnableSeason() { diff --git a/plugin/src/main/java/net/momirealms/customcrops/mechanic/world/CChunk.java b/plugin/src/main/java/net/momirealms/customcrops/mechanic/world/CChunk.java index 1bac59b..60743b0 100644 --- a/plugin/src/main/java/net/momirealms/customcrops/mechanic/world/CChunk.java +++ b/plugin/src/main/java/net/momirealms/customcrops/mechanic/world/CChunk.java @@ -94,7 +94,6 @@ public class CChunk implements CustomCropsChunk { this.lastLoadedTime = current; var setting = cWorld.getWorldSetting(); int minTickUnit = setting.getMinTickUnit(); - for (int i = 0; i < offlineTimeInSeconds; i++) { this.loadedSeconds++; if (this.loadedSeconds >= minTickUnit) { diff --git a/plugin/src/main/java/net/momirealms/customcrops/mechanic/world/WorldManagerImpl.java b/plugin/src/main/java/net/momirealms/customcrops/mechanic/world/WorldManagerImpl.java index a9800bf..e8d9ea2 100644 --- a/plugin/src/main/java/net/momirealms/customcrops/mechanic/world/WorldManagerImpl.java +++ b/plugin/src/main/java/net/momirealms/customcrops/mechanic/world/WorldManagerImpl.java @@ -481,7 +481,7 @@ public class WorldManagerImpl implements WorldManager, Listener { this.worldAdaptor.loadChunkData(customCropsWorld, chunkPos); // offline grow part - if (!customCropsWorld.getWorldSetting().isOfflineGrow()) return; + if (!customCropsWorld.getWorldSetting().isOfflineTick()) return; // If chunk data not exists, return Optional optionalChunk = customCropsWorld.getLoadedChunkAt(chunkPos); diff --git a/plugin/src/main/java/net/momirealms/customcrops/util/ConfigUtils.java b/plugin/src/main/java/net/momirealms/customcrops/util/ConfigUtils.java index 7ae8212..dc08207 100644 --- a/plugin/src/main/java/net/momirealms/customcrops/util/ConfigUtils.java +++ b/plugin/src/main/java/net/momirealms/customcrops/util/ConfigUtils.java @@ -70,8 +70,8 @@ public class ConfigUtils { section.getInt("pot.tick-interval", 2), getRandomTickModeByString(section.getString("sprinkler.mode")), section.getInt("sprinkler.tick-interval", 2), - section.getBoolean("offline-growth.enable", false), - section.getInt("offline-growth.max-offline-seconds", 1200), + section.getBoolean("offline-tick.enable", false), + section.getInt("offline-tick.max-offline-seconds", 1200), section.getBoolean("season.enable", false), section.getBoolean("season.auto-alternation", false), section.getInt("season.duration", 28), diff --git a/plugin/src/main/resources/config.yml b/plugin/src/main/resources/config.yml index f94b33d..182af7d 100644 --- a/plugin/src/main/resources/config.yml +++ b/plugin/src/main/resources/config.yml @@ -46,10 +46,10 @@ worlds: # For crops, under the same conditions, the growth rate of crops is basically the same # For sprinklers and pots, they would work periodically. min-tick-unit: 300 - # Offline growth settings + # Offline tick settings # This option allows crops to grow even if the world is unloaded or the server is closed # This may lead to some issues caused by timeliness conditions for instance seasons - offline-growth: + offline-tick: enable: false # Maximum offline time recorded in seconds # Please do not set this option to a value that is too large,