mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2025-01-28 10:31:30 +01:00
Fixed Custom Mining priorities.
This commit is contained in:
parent
783782f44f
commit
5c608b8439
@ -37,7 +37,22 @@ public class BlockListener implements Listener {
|
||||
*/
|
||||
boolean customMine = MMOCore.plugin.mineManager.isEnabled(player);
|
||||
ItemStack item = player.getInventory().getItemInMainHand();
|
||||
|
||||
BlockInfo info = MMOCore.plugin.mineManager.getInfo(block.getType());
|
||||
if (info == null)
|
||||
return;
|
||||
|
||||
if (customMine) {
|
||||
/*
|
||||
* calls the event and listen for cancel & for drops changes... also
|
||||
* allows to apply tool durability & enchants to drops, etc.
|
||||
*/
|
||||
CustomBlockMineEvent called = new CustomBlockMineEvent(PlayerData.get(player), block, info);
|
||||
Bukkit.getPluginManager().callEvent(called);
|
||||
if (called.isCancelled()) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
BlockPermissions perms = MMOCore.plugin.restrictionManager.getPermissions(item.getType());
|
||||
if (perms == null) {
|
||||
@ -50,22 +65,7 @@ public class BlockListener implements Listener {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
BlockInfo info = MMOCore.plugin.mineManager.getInfo(block.getType());
|
||||
if (info == null)
|
||||
return;
|
||||
|
||||
/*
|
||||
* calls the event and listen for cancel & for drops changes... also
|
||||
* allows to apply tool durability & enchants to drops, etc.
|
||||
*/
|
||||
CustomBlockMineEvent called = new CustomBlockMineEvent(PlayerData.get(player), block, info);
|
||||
Bukkit.getPluginManager().callEvent(called);
|
||||
if (called.isCancelled()) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* remove vanilla drops if needed
|
||||
@ -98,6 +98,7 @@ public class BlockListener implements Listener {
|
||||
if (drop.getType() != Material.AIR && drop.getAmount() > 0)
|
||||
block.getWorld().dropItemNaturally(dropLocation, drop);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* enable block regen only if custom mine is enabled.
|
||||
|
Loading…
Reference in New Issue
Block a user