mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2025-12-27 19:09:09 +00:00
fix drop naturally
This commit is contained in:
@@ -33,6 +33,7 @@ import net.momirealms.customcrops.api.misc.value.MathValue;
|
||||
import net.momirealms.customcrops.api.util.EventUtils;
|
||||
import net.momirealms.customcrops.api.util.LocationUtils;
|
||||
import net.momirealms.customcrops.api.util.PlayerUtils;
|
||||
import net.momirealms.customcrops.common.helper.VersionHelper;
|
||||
import net.momirealms.customcrops.common.util.RandomUtils;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@@ -88,7 +89,11 @@ public class ActionDropItem<T> extends AbstractBuiltInAction<T> {
|
||||
if (toInv && player != null) {
|
||||
PlayerUtils.giveItem(player, itemToDrop, itemToDrop.getAmount());
|
||||
} else {
|
||||
location.getWorld().dropItemNaturally(LocationUtils.toBlockCenterLocation(location), itemToDrop);
|
||||
if (VersionHelper.isVersionNewerThan1_21_2()) {
|
||||
location.getWorld().dropItemNaturally(LocationUtils.toBlockCenterLocation(location), itemToDrop);
|
||||
} else {
|
||||
location.getWorld().dropItemNaturally(LocationUtils.toBlockLocation(location), itemToDrop);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, location);
|
||||
|
||||
@@ -34,6 +34,7 @@ import net.momirealms.customcrops.api.misc.value.MathValue;
|
||||
import net.momirealms.customcrops.api.util.EventUtils;
|
||||
import net.momirealms.customcrops.api.util.LocationUtils;
|
||||
import net.momirealms.customcrops.api.util.PlayerUtils;
|
||||
import net.momirealms.customcrops.common.helper.VersionHelper;
|
||||
import net.momirealms.customcrops.common.util.RandomUtils;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@@ -95,7 +96,11 @@ public class ActionQualityCrops<T> extends AbstractBuiltInAction<T> {
|
||||
if (toInv && player != null) {
|
||||
PlayerUtils.giveItem(player, itemStack, itemStack.getAmount());
|
||||
} else {
|
||||
location.getWorld().dropItemNaturally(LocationUtils.toBlockCenterLocation(location), itemStack);
|
||||
if (VersionHelper.isVersionNewerThan1_21_2()) {
|
||||
location.getWorld().dropItemNaturally(LocationUtils.toBlockCenterLocation(location), itemStack);
|
||||
} else {
|
||||
location.getWorld().dropItemNaturally(LocationUtils.toBlockLocation(location), itemStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, location);
|
||||
|
||||
@@ -106,6 +106,10 @@ public class VersionHelper {
|
||||
return version >= 21.39;
|
||||
}
|
||||
|
||||
public static boolean isVersionNewerThan1_21_2() {
|
||||
return version >= 19;
|
||||
}
|
||||
|
||||
public static boolean isFolia() {
|
||||
return folia;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user