1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-19 19:25:48 +00:00

fix: add version check

This commit is contained in:
ybw0014 2023-09-07 00:39:03 -04:00
parent 2fd3d0e50c
commit 67fd5183f8
No known key found for this signature in database
GPG Key ID: 04C1F3339F03F9EE

View File

@ -5,6 +5,8 @@ import java.util.concurrent.ThreadLocalRandom;
import javax.annotation.ParametersAreNonnullByDefault;
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import org.bukkit.Material;
import org.bukkit.entity.Creeper;
import org.bukkit.entity.Monster;
@ -80,7 +82,8 @@ public class SwordOfBeheading extends SimpleSlimefunItem<EntityKillHandler> {
}
}
case PIGLIN -> {
if (random.nextInt(100) < chancePiglin.getValue()) {
if (Slimefun.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_20) &&
random.nextInt(100) < chancePiglin.getValue()) {
e.getDrops().add(new ItemStack(Material.PIGLIN_HEAD));
}
}