mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2026-01-06 15:51:52 +00:00
Fixed some bugs
This commit is contained in:
@@ -91,10 +91,8 @@ public class CustomCropsWorldImpl<W> implements CustomCropsWorld<W> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -17,7 +17,9 @@
|
|||||||
|
|
||||||
package net.momirealms.customcrops.api.event;
|
package net.momirealms.customcrops.api.event;
|
||||||
|
|
||||||
|
import net.momirealms.customcrops.api.core.BuiltInBlockMechanics;
|
||||||
import net.momirealms.customcrops.api.core.block.BreakReason;
|
import net.momirealms.customcrops.api.core.block.BreakReason;
|
||||||
|
import net.momirealms.customcrops.api.core.block.CropBlock;
|
||||||
import net.momirealms.customcrops.api.core.mechanic.crop.CropConfig;
|
import net.momirealms.customcrops.api.core.mechanic.crop.CropConfig;
|
||||||
import net.momirealms.customcrops.api.core.world.CustomCropsBlockState;
|
import net.momirealms.customcrops.api.core.world.CustomCropsBlockState;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
|||||||
@@ -426,6 +426,7 @@ public abstract class AbstractRequirementManager<T> implements RequirementManage
|
|||||||
return context -> {
|
return context -> {
|
||||||
Location location = requireNonNull(context.arg(ContextKeys.LOCATION));
|
Location location = requireNonNull(context.arg(ContextKeys.LOCATION));
|
||||||
Season season = plugin.getWorldManager().getSeason(location.getWorld());
|
Season season = plugin.getWorldManager().getSeason(location.getWorld());
|
||||||
|
if (season == Season.DISABLE) return true;
|
||||||
if (!seasons.contains(season.name())) return true;
|
if (!seasons.contains(season.name())) return true;
|
||||||
if (runActions) ActionManager.trigger(context, actions);
|
if (runActions) ActionManager.trigger(context, actions);
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -28,13 +28,17 @@ public class RealisticSeasonsProvider implements SeasonProvider {
|
|||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Season getSeason(@NotNull World world) {
|
public Season getSeason(@NotNull World world) {
|
||||||
return switch (SeasonsAPI.getInstance().getSeason(world)) {
|
try {
|
||||||
case WINTER -> Season.WINTER;
|
return switch (SeasonsAPI.getInstance().getSeason(world)) {
|
||||||
case SPRING -> Season.SPRING;
|
case WINTER -> Season.WINTER;
|
||||||
case SUMMER -> Season.SUMMER;
|
case SPRING -> Season.SPRING;
|
||||||
case FALL -> Season.AUTUMN;
|
case SUMMER -> Season.SUMMER;
|
||||||
case DISABLED, RESTORE -> Season.DISABLE;
|
case FALL -> Season.AUTUMN;
|
||||||
};
|
case DISABLED, RESTORE -> Season.DISABLE;
|
||||||
|
};
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
return Season.DISABLE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Project settings
|
# Project settings
|
||||||
# Rule: [major update].[feature update].[bug fix]
|
# Rule: [major update].[feature update].[bug fix]
|
||||||
project_version=3.6.6
|
project_version=3.6.7
|
||||||
config_version=39
|
config_version=39
|
||||||
project_group=net.momirealms
|
project_group=net.momirealms
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ import net.momirealms.customcrops.bukkit.action.PlayerActionManager;
|
|||||||
import net.momirealms.customcrops.bukkit.command.BukkitCommandManager;
|
import net.momirealms.customcrops.bukkit.command.BukkitCommandManager;
|
||||||
import net.momirealms.customcrops.bukkit.config.BukkitConfigManager;
|
import net.momirealms.customcrops.bukkit.config.BukkitConfigManager;
|
||||||
import net.momirealms.customcrops.bukkit.integration.BukkitIntegrationManager;
|
import net.momirealms.customcrops.bukkit.integration.BukkitIntegrationManager;
|
||||||
import net.momirealms.customcrops.bukkit.integration.worldedit.CustomCropsDelegateExtent;
|
|
||||||
import net.momirealms.customcrops.bukkit.integration.worldedit.WorldEditHook;
|
import net.momirealms.customcrops.bukkit.integration.worldedit.WorldEditHook;
|
||||||
import net.momirealms.customcrops.bukkit.item.BukkitItemManager;
|
import net.momirealms.customcrops.bukkit.item.BukkitItemManager;
|
||||||
import net.momirealms.customcrops.bukkit.requirement.BlockRequirementManager;
|
import net.momirealms.customcrops.bukkit.requirement.BlockRequirementManager;
|
||||||
@@ -197,8 +196,8 @@ public class BukkitCustomCropsPluginImpl extends BukkitCustomCropsPlugin {
|
|||||||
Runnable delayedInitTask = () -> {
|
Runnable delayedInitTask = () -> {
|
||||||
((SimpleRegistryAccess) registryAccess).freeze();
|
((SimpleRegistryAccess) registryAccess).freeze();
|
||||||
logger.info("Registry access has been frozen");
|
logger.info("Registry access has been frozen");
|
||||||
((BukkitItemManager) itemManager).setAntiGriefLib(AntiGriefLib.builder((JavaPlugin) getBoostrap()).silentLogs(true).ignoreOP(true).build());
|
|
||||||
EventUtils.fireAndForget(new CustomCropsReloadEvent(this));
|
EventUtils.fireAndForget(new CustomCropsReloadEvent(this));
|
||||||
|
((BukkitItemManager) itemManager).setAntiGriefLib(AntiGriefLib.builder((JavaPlugin) getBoostrap()).silentLogs(true).ignoreOP(true).build());
|
||||||
};
|
};
|
||||||
|
|
||||||
// delayed init task
|
// delayed init task
|
||||||
@@ -225,10 +224,10 @@ public class BukkitCustomCropsPluginImpl extends BukkitCustomCropsPlugin {
|
|||||||
|
|
||||||
this.worldManager.unload();
|
this.worldManager.unload();
|
||||||
|
|
||||||
|
this.placeholderManager.reload();
|
||||||
this.configManager.reload();
|
this.configManager.reload();
|
||||||
this.debugger = ConfigManager.debug() ? (s) -> logger.info("[DEBUG] " + s.toString()) : (s) -> {};
|
this.debugger = ConfigManager.debug() ? (s) -> logger.info("[DEBUG] " + s.toString()) : (s) -> {};
|
||||||
this.coolDownManager.reload();
|
this.coolDownManager.reload();
|
||||||
this.placeholderManager.reload();
|
|
||||||
this.translationManager.reload();
|
this.translationManager.reload();
|
||||||
this.hologramManager.reload();
|
this.hologramManager.reload();
|
||||||
|
|
||||||
|
|||||||
@@ -152,6 +152,15 @@ public class BukkitConfigManager extends ConfigManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Section placeholderSection = config.getSection("other-settings.placeholder-register");
|
||||||
|
if (placeholderSection != null) {
|
||||||
|
for (Map.Entry<String, Object> entry : placeholderSection.getStringRouteMappedValues(false).entrySet()) {
|
||||||
|
if (entry.getValue() instanceof String original) {
|
||||||
|
plugin.getPlaceholderManager().registerCustomPlaceholder(entry.getKey(), original);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (String id : scarecrow) {
|
for (String id : scarecrow) {
|
||||||
Registries.BLOCKS.register(id, BuiltInBlockMechanics.SCARECROW.mechanic());
|
Registries.BLOCKS.register(id, BuiltInBlockMechanics.SCARECROW.mechanic());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user