forked from Upstream/mmocore
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);
|
boolean customMine = MMOCore.plugin.mineManager.isEnabled(player);
|
||||||
ItemStack item = player.getInventory().getItemInMainHand();
|
ItemStack item = player.getInventory().getItemInMainHand();
|
||||||
|
|
||||||
|
BlockInfo info = MMOCore.plugin.mineManager.getInfo(block.getType());
|
||||||
|
if (info == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (customMine) {
|
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());
|
BlockPermissions perms = MMOCore.plugin.restrictionManager.getPermissions(item.getType());
|
||||||
if (perms == null) {
|
if (perms == null) {
|
||||||
@ -50,22 +65,7 @@ public class BlockListener implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
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
|
* remove vanilla drops if needed
|
||||||
@ -98,6 +98,7 @@ public class BlockListener implements Listener {
|
|||||||
if (drop.getType() != Material.AIR && drop.getAmount() > 0)
|
if (drop.getType() != Material.AIR && drop.getAmount() > 0)
|
||||||
block.getWorld().dropItemNaturally(dropLocation, drop);
|
block.getWorld().dropItemNaturally(dropLocation, drop);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* enable block regen only if custom mine is enabled.
|
* enable block regen only if custom mine is enabled.
|
||||||
|
Loading…
Reference in New Issue
Block a user