Fix experience & improvements to block events (#8067)

This is a lot but basically adds a method to disable the dropping of experience and drops experience by default.
This way things that require XP to be dropped manually (via modification), they can drop XP themselves when needed but without touching anywhere else that may drop xp.

It should be noted this causes breakNaturally() to now drop experience.
This commit is contained in:
Owen1212055 2024-01-04 15:18:59 -05:00
parent 635ece80cf
commit 9940519717
6 changed files with 144 additions and 21 deletions

View file

@ -15,6 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import org.bukkit.block.Block;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.block.BlockEvent;
+import org.bukkit.event.block.BlockExpEvent;
+import org.bukkit.inventory.ItemStack;
+import org.jetbrains.annotations.NotNull;
+
@ -25,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * <p>
+ * Currently called for piston's and liquid flows.
+ */
+public class BlockBreakBlockEvent extends BlockEvent {
+public class BlockBreakBlockEvent extends BlockExpEvent {
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
@ -33,7 +34,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ private final Block source;
+
+ public BlockBreakBlockEvent(@NotNull Block block, @NotNull Block source, @NotNull List<ItemStack> drops) {
+ super(block);
+ super(block, 0);
+ this.source = source;
+ this.drops = drops;
+ }