mirror of
https://github.com/darverdevs/Uranium.git
synced 2024-12-03 22:14:16 -08:00
fix(listeners): fix NPE in onPlayerDamageEntity
This commit is contained in:
parent
e50b5b8c70
commit
4f683e0545
|
@ -80,6 +80,7 @@ public class PlayerListener implements Listener {
|
||||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||||
if (!(event.getAction() == Action.RIGHT_CLICK_BLOCK)) return;
|
if (!(event.getAction() == Action.RIGHT_CLICK_BLOCK)) return;
|
||||||
User user = UserManager.getUser(event.getPlayer());
|
User user = UserManager.getUser(event.getPlayer());
|
||||||
|
if (user == null) return;
|
||||||
if (!user.isVanished()) return;
|
if (!user.isVanished()) return;
|
||||||
|
|
||||||
if (event.getClickedBlock().getType() == Material.CHEST
|
if (event.getClickedBlock().getType() == Material.CHEST
|
||||||
|
@ -96,6 +97,7 @@ public class PlayerListener implements Listener {
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void onInventoryClick(InventoryClickEvent event) {
|
public void onInventoryClick(InventoryClickEvent event) {
|
||||||
User user = UserManager.getUser((Player) event.getWhoClicked());
|
User user = UserManager.getUser((Player) event.getWhoClicked());
|
||||||
|
if (user == null) return;
|
||||||
if (!user.isVanished()) return;
|
if (!user.isVanished()) return;
|
||||||
|
|
||||||
if (event.getInventory().getType() == InventoryType.CHEST)
|
if (event.getInventory().getType() == InventoryType.CHEST)
|
||||||
|
@ -106,6 +108,7 @@ public class PlayerListener implements Listener {
|
||||||
public void onPlayerDamageEntity(EntityDamageByEntityEvent event) {
|
public void onPlayerDamageEntity(EntityDamageByEntityEvent event) {
|
||||||
if (!(event.getEntity() instanceof Player) || !(event.getDamager() instanceof Player)) return;
|
if (!(event.getEntity() instanceof Player) || !(event.getDamager() instanceof Player)) return;
|
||||||
User user = UserManager.getUser((Player) event.getDamager());
|
User user = UserManager.getUser((Player) event.getDamager());
|
||||||
|
if (user == null) return;
|
||||||
|
|
||||||
if (user.isVanished()) {
|
if (user.isVanished()) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name: Uranium
|
name: Uranium
|
||||||
version: 1.0-LITE
|
version: 1.0.1-LITE
|
||||||
main: uranium.Main
|
main: uranium.Main
|
||||||
description: A moderation utility for Eaglercraft 1.8 servers.
|
description: A moderation utility for Eaglercraft 1.8 servers.
|
||||||
author: Cold
|
author: Cold
|
||||||
|
|
Loading…
Reference in New Issue
Block a user