mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2024-12-22 04:37:42 +01:00
#1025 - Fix Custom Block Drop / Breaking Power Bug
This commit is contained in:
parent
d4a30f90f6
commit
165eb39714
@ -52,7 +52,20 @@ public class CustomBlockListener implements Listener {
|
||||
|
||||
final int power = MMOUtils.getPickaxePower(event.getPlayer());
|
||||
|
||||
if(block.requirePowerToBreak() && power < block.getRequiredPower()) {
|
||||
if ( block.requirePowerToBreak() && block.getRequiredPower()>0 ){
|
||||
if (power < block.getRequiredPower()) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
else if (power >= block.getRequiredPower()) {
|
||||
event.setDropItems(false);
|
||||
event.setExpToDrop(event.getPlayer().getGameMode() == GameMode.CREATIVE ? 0
|
||||
: MMOUtils.getPickaxePower(event.getPlayer()) >= block.getRequiredPower()
|
||||
? block.getMaxExpDrop() == 0 && block.getMinExpDrop() == 0 ? 0
|
||||
: RANDOM.nextInt((block.getMaxExpDrop() - block.getMinExpDrop()) + 1) + block.getMinExpDrop()
|
||||
: 0);
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@ -65,6 +78,7 @@ public class CustomBlockListener implements Listener {
|
||||
: 0);
|
||||
}
|
||||
|
||||
|
||||
@Deprecated
|
||||
private static int getPickaxePower(Player player) {
|
||||
return MMOUtils.getPickaxePower(player);
|
||||
|
Loading…
Reference in New Issue
Block a user