mirror of
https://github.com/PlayPro/CoreProtect.git
synced 2024-11-28 12:55:34 +01:00
Fixed dropper transactions not being logged when using Paper
This commit is contained in:
parent
d7910262be
commit
1b6d2ec667
@ -49,7 +49,7 @@ public final class BlockDispenseListener extends Queue implements Listener {
|
||||
boolean dispenseSuccess = !event.getVelocity().equals(new Vector()); // true if velocity is set
|
||||
boolean dispenseRelative = newBlock.getLocation().equals(velocityLocation); // true if velocity location matches relative location
|
||||
|
||||
if (!BlockPreDispenseListener.useBlockPreDispenseEvent) {
|
||||
if (!BlockPreDispenseListener.useBlockPreDispenseEvent || (!BlockPreDispenseListener.useForDroppers && block.getType() == Material.DROPPER)) {
|
||||
if (dispenseRelative || material.equals(Material.FLINT_AND_STEEL) || material.equals(Material.SHEARS)) {
|
||||
forceItem = false;
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package net.coreprotect.paper.listener;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
@ -18,6 +19,7 @@ import net.coreprotect.listener.player.InventoryChangeListener;
|
||||
public final class BlockPreDispenseListener extends Queue implements Listener {
|
||||
|
||||
public static boolean useBlockPreDispenseEvent = true;
|
||||
public static boolean useForDroppers = false;
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onBlockPreDispense(BlockPreDispenseEvent event) {
|
||||
@ -29,6 +31,10 @@ public final class BlockPreDispenseListener extends Queue implements Listener {
|
||||
|
||||
BlockData blockData = block.getBlockData();
|
||||
if (blockData instanceof Dispenser) {
|
||||
if (!useForDroppers && block.getType() == Material.DROPPER) {
|
||||
useForDroppers = true;
|
||||
}
|
||||
|
||||
String user = "#dispenser";
|
||||
ItemStack[] inventory = ((InventoryHolder) block.getState()).getInventory().getStorageContents();
|
||||
InventoryChangeListener.inventoryTransaction(user, block.getLocation(), inventory);
|
||||
|
Loading…
Reference in New Issue
Block a user