mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2025-12-28 03:19:15 +00:00
Check point for future big changes
This commit is contained in:
@@ -36,6 +36,7 @@ import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.Dispenser;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
@@ -100,6 +101,18 @@ public abstract class AbstractCustomListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler (ignoreCancelled = true)
|
||||
public void onBlockFalling(EntityChangeBlockEvent event) {
|
||||
if (event.getEntity() instanceof FallingBlock fallingBlock) {
|
||||
final Block block = event.getBlock();
|
||||
final Location location = block.getLocation();
|
||||
Optional<CustomCropsBlock> customCropsBlock = CustomCropsPlugin.get().getWorldManager().getBlockAt(SimpleLocation.of(location));
|
||||
if (customCropsBlock.isPresent()) {
|
||||
fallingBlock.setCancelDrop(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler (ignoreCancelled = true)
|
||||
public void onInteractBlock(PlayerInteractEvent event) {
|
||||
if (event.getHand() != EquipmentSlot.HAND)
|
||||
|
||||
@@ -69,29 +69,27 @@ public interface CustomProvider {
|
||||
}
|
||||
|
||||
default CRotation removeAnythingAt(Location location) {
|
||||
if (!removeBlock(location)) {
|
||||
Collection<Entity> entities = location.getWorld().getNearbyEntities(LocationUtils.toCenterLocation(location), 0.5,0.51,0.5);
|
||||
entities.removeIf(entity -> {
|
||||
EntityType type = entity.getType();
|
||||
return type != EntityType.ITEM_FRAME
|
||||
&& (!VersionManager.isHigherThan1_19_R3() || type != EntityType.ITEM_DISPLAY);
|
||||
});
|
||||
if (entities.size() == 0) return CRotation.NONE;
|
||||
CRotation previousCRotation;
|
||||
Entity first = entities.stream().findFirst().get();
|
||||
if (first instanceof ItemFrame itemFrame) {
|
||||
previousCRotation = CRotation.getByRotation(itemFrame.getRotation());
|
||||
} else if (VersionManager.isHigherThan1_19_R3()) {
|
||||
previousCRotation = DisplayEntityUtils.getRotation(first);
|
||||
} else {
|
||||
previousCRotation = CRotation.NONE;
|
||||
}
|
||||
for (Entity entity : entities) {
|
||||
removeFurniture(entity);
|
||||
}
|
||||
return previousCRotation;
|
||||
removeBlock(location);
|
||||
Collection<Entity> entities = location.getWorld().getNearbyEntities(LocationUtils.toCenterLocation(location), 0.5,0.51,0.5);
|
||||
entities.removeIf(entity -> {
|
||||
EntityType type = entity.getType();
|
||||
return type != EntityType.ITEM_FRAME
|
||||
&& (!VersionManager.isHigherThan1_19_R3() || type != EntityType.ITEM_DISPLAY);
|
||||
});
|
||||
if (entities.isEmpty()) return CRotation.NONE;
|
||||
CRotation previousCRotation;
|
||||
Entity first = entities.stream().findFirst().get();
|
||||
if (first instanceof ItemFrame itemFrame) {
|
||||
previousCRotation = CRotation.getByRotation(itemFrame.getRotation());
|
||||
} else if (VersionManager.isHigherThan1_19_R3()) {
|
||||
previousCRotation = DisplayEntityUtils.getRotation(first);
|
||||
} else {
|
||||
previousCRotation = CRotation.NONE;
|
||||
}
|
||||
return CRotation.NONE;
|
||||
for (Entity entity : entities) {
|
||||
removeFurniture(entity);
|
||||
}
|
||||
return previousCRotation;
|
||||
}
|
||||
|
||||
default String getSomethingAt(Location location) {
|
||||
|
||||
@@ -8,7 +8,7 @@ plugins {
|
||||
allprojects {
|
||||
|
||||
project.group = "net.momirealms"
|
||||
project.version = "3.4.8"
|
||||
project.version = "3.4.8.1"
|
||||
|
||||
apply<JavaPlugin>()
|
||||
apply(plugin = "java")
|
||||
|
||||
@@ -4,7 +4,7 @@ dependencies {
|
||||
compileOnly("com.infernalsuite.aswm:api:1.20.4-R0.1-SNAPSHOT")
|
||||
|
||||
// Command
|
||||
compileOnly("dev.jorel:commandapi-bukkit-core:9.3.0")
|
||||
compileOnly("dev.jorel:commandapi-bukkit-core:9.4.1")
|
||||
|
||||
// Common hooks
|
||||
compileOnly("me.clip:placeholderapi:2.11.5")
|
||||
@@ -12,7 +12,7 @@ dependencies {
|
||||
compileOnly("com.github.MilkBowl:VaultAPI:1.7")
|
||||
|
||||
// Utils
|
||||
compileOnly("dev.dejvokep:boosted-yaml:1.3.2")
|
||||
compileOnly("dev.dejvokep:boosted-yaml:1.3.4")
|
||||
compileOnly("commons-io:commons-io:2.15.1")
|
||||
compileOnly("com.google.code.gson:gson:2.10.1")
|
||||
compileOnly("net.objecthunter:exp4j:0.4.8")
|
||||
@@ -50,13 +50,13 @@ dependencies {
|
||||
implementation(project(":oraxen-legacy"))
|
||||
implementation(project(":oraxen-j21"))
|
||||
implementation(project(":legacy-api"))
|
||||
compileOnly("net.kyori:adventure-api:4.16.0")
|
||||
compileOnly("net.kyori:adventure-api:4.17.0")
|
||||
compileOnly("net.kyori:adventure-platform-bukkit:4.3.2")
|
||||
compileOnly("com.github.Xiao-MoMi:AntiGriefLib:0.11")
|
||||
compileOnly("com.github.Xiao-MoMi:BiomeAPI:0.6")
|
||||
|
||||
compileOnly("net.kyori:adventure-text-minimessage:4.16.0")
|
||||
compileOnly("net.kyori:adventure-text-serializer-legacy:4.16.0")
|
||||
compileOnly("net.kyori:adventure-text-minimessage:4.17.0")
|
||||
compileOnly("net.kyori:adventure-text-serializer-legacy:4.17.0")
|
||||
compileOnly("de.tr7zw:item-nbt-api:2.12.4")
|
||||
compileOnly("org.bstats:bstats-bukkit:3.0.2")
|
||||
implementation("com.flowpowered:flow-nbt:2.0.2")
|
||||
|
||||
@@ -72,7 +72,7 @@ public enum Dependency {
|
||||
BOOSTED_YAML(
|
||||
"dev{}dejvokep",
|
||||
"boosted-yaml",
|
||||
"1.3.2",
|
||||
"1.3.4",
|
||||
null,
|
||||
"boosted-yaml",
|
||||
Relocation.of("boostedyaml", "dev{}dejvokep{}boostedyaml")
|
||||
|
||||
Reference in New Issue
Block a user