9
0
mirror of https://github.com/Xiao-MoMi/Custom-Crops.git synced 2025-12-26 10:29:10 +00:00

3.0.2-hotfix

This commit is contained in:
Xiao-MoMi
2023-04-21 01:24:55 +08:00
parent 0c5017297e
commit 458c0c0327
4 changed files with 13 additions and 2 deletions

View File

@@ -200,6 +200,12 @@ public interface PlatformInterface {
return false;
}
default void removeAnyThingAt(Location location) {
removeAnyBlock(location);
removeItemFrame(location);
if (CustomCrops.getInstance().getVersionHelper().isVersionNewerThan1_19_R3()) removeItemDisplay(location);
}
default void placeCustomItem(Location location, String id, ItemMode itemMode) {
if (itemMode == ItemMode.TRIPWIRE)
placeTripWire(location, id);

View File

@@ -21,6 +21,7 @@ import net.momirealms.customcrops.CustomCrops;
import net.momirealms.customcrops.api.object.ItemMode;
import net.momirealms.customcrops.api.object.crop.StageConfig;
import net.momirealms.customcrops.api.object.world.SimpleLocation;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.Nullable;
@@ -38,7 +39,9 @@ public class BreakImpl implements Action {
public void doOn(@Nullable Player player, @Nullable SimpleLocation crop_loc, ItemMode itemMode) {
if (crop_loc == null) return;
CustomCrops.getInstance().getScheduler().runTask(() -> {
CustomCrops.getInstance().getPlatformInterface().removeCustomItem(crop_loc.getBukkitLocation(), itemMode);
Location bLoc = crop_loc.getBukkitLocation();
if (bLoc == null) return;
CustomCrops.getInstance().getPlatformInterface().removeAnyThingAt(bLoc);
CustomCrops.getInstance().getWorldDataManager().removeCropData(crop_loc);
});
if (triggerAction && stage_id != null) {

View File

@@ -19,6 +19,7 @@ package net.momirealms.customcrops.api.object.season;
import net.momirealms.customcrops.CustomCrops;
import net.momirealms.customcrops.api.object.Function;
import net.momirealms.customcrops.api.object.basic.ConfigManager;
import org.jetbrains.annotations.Nullable;
import java.util.concurrent.ConcurrentHashMap;
@@ -53,6 +54,7 @@ public class SeasonManager extends Function {
}
public CCSeason getSeason(String world) {
if (ConfigManager.syncSeason) world = ConfigManager.referenceWorld;
SeasonData seasonData = seasonMap.get(world);
if (seasonData == null) return CCSeason.UNKNOWN;
return seasonData.getSeason();