mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-23 05:36:46 +01:00
Added null checks to BlockBreak & BlockDamage events to help with mod
compatibility.
This commit is contained in:
parent
bebcc40987
commit
946b5bb006
@ -153,18 +153,23 @@ public class BlockListener implements Listener {
|
|||||||
*/
|
*/
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onBlockBreak(BlockBreakEvent event) {
|
public void onBlockBreak(BlockBreakEvent event) {
|
||||||
|
if (event instanceof FakeBlockBreakEvent) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
PlayerProfile PP = Users.getProfile(player);
|
PlayerProfile PP = Users.getProfile(player);
|
||||||
|
|
||||||
|
if (PP == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
ItemStack inHand = player.getItemInHand();
|
ItemStack inHand = player.getItemInHand();
|
||||||
|
|
||||||
Config configInstance = Config.getInstance();
|
Config configInstance = Config.getInstance();
|
||||||
Permissions permInstance = Permissions.getInstance();
|
Permissions permInstance = Permissions.getInstance();
|
||||||
|
|
||||||
if (event instanceof FakeBlockBreakEvent) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* HERBALISM */
|
/* HERBALISM */
|
||||||
if (BlockChecks.canBeGreenTerra(block)) {
|
if (BlockChecks.canBeGreenTerra(block)) {
|
||||||
/* Green Terra */
|
/* Green Terra */
|
||||||
@ -264,6 +269,11 @@ public class BlockListener implements Listener {
|
|||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
PlayerProfile PP = Users.getProfile(player);
|
PlayerProfile PP = Users.getProfile(player);
|
||||||
|
|
||||||
|
if (PP == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ItemStack inHand = player.getItemInHand();
|
ItemStack inHand = player.getItemInHand();
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
Material material = block.getType();
|
Material material = block.getType();
|
||||||
|
Loading…
Reference in New Issue
Block a user