mirror of
https://github.com/darverdevs/Uranium.git
synced 2024-12-03 05:54:18 -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) {
|
||||
if (!(event.getAction() == Action.RIGHT_CLICK_BLOCK)) return;
|
||||
User user = UserManager.getUser(event.getPlayer());
|
||||
if (user == null) return;
|
||||
if (!user.isVanished()) return;
|
||||
|
||||
if (event.getClickedBlock().getType() == Material.CHEST
|
||||
|
@ -96,6 +97,7 @@ public class PlayerListener implements Listener {
|
|||
@EventHandler(ignoreCancelled = true)
|
||||
public void onInventoryClick(InventoryClickEvent event) {
|
||||
User user = UserManager.getUser((Player) event.getWhoClicked());
|
||||
if (user == null) return;
|
||||
if (!user.isVanished()) return;
|
||||
|
||||
if (event.getInventory().getType() == InventoryType.CHEST)
|
||||
|
@ -106,6 +108,7 @@ public class PlayerListener implements Listener {
|
|||
public void onPlayerDamageEntity(EntityDamageByEntityEvent event) {
|
||||
if (!(event.getEntity() instanceof Player) || !(event.getDamager() instanceof Player)) return;
|
||||
User user = UserManager.getUser((Player) event.getDamager());
|
||||
if (user == null) return;
|
||||
|
||||
if (user.isVanished()) {
|
||||
event.setCancelled(true);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name: Uranium
|
||||
version: 1.0-LITE
|
||||
version: 1.0.1-LITE
|
||||
main: uranium.Main
|
||||
description: A moderation utility for Eaglercraft 1.8 servers.
|
||||
author: Cold
|
||||
|
|
Loading…
Reference in New Issue
Block a user