新增对掉落物的优化,可以吃到精准采集buff

This commit is contained in:
zhangyuheng 2024-10-06 23:00:06 +08:00
parent bda0f8dee7
commit 007142891b
2 changed files with 6 additions and 3 deletions

View File

@ -6,7 +6,7 @@
<groupId>cn.lunadeer</groupId> <groupId>cn.lunadeer</groupId>
<artifactId>LiteWorldEdit</artifactId> <artifactId>LiteWorldEdit</artifactId>
<version>2.4.3.9</version> <version>2.5.0.1</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>LiteWorldEdit</name> <name>LiteWorldEdit</name>

View File

@ -8,6 +8,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
public class Remove extends Job { public class Remove extends Job {
@ -45,10 +46,12 @@ public class Remove extends Job {
BlockBreakEvent event = new BlockBreakEvent(raw_block, _creator); BlockBreakEvent event = new BlockBreakEvent(raw_block, _creator);
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {
Material block_type = raw_block.getType(); Collection<ItemStack> drops = raw_block.getDrops(pickaxe, _creator);
raw_block.setType(Material.AIR); raw_block.setType(Material.AIR);
if (LiteWorldEdit.instance.getConfigMgr().isDropItems()) { if (LiteWorldEdit.instance.getConfigMgr().isDropItems()) {
raw_block.getWorld().dropItemNaturally(raw_block.getLocation(), new ItemStack(block_type)); for (ItemStack drop : drops) {
raw_block.getWorld().dropItemNaturally(raw_block.getLocation(), drop);
}
} }
// 损坏镐 // 损坏镐
if (!_creator.isOp() && _creator.getGameMode() != GameMode.CREATIVE) { if (!_creator.isOp() && _creator.getGameMode() != GameMode.CREATIVE) {