fix(listeners): fix NPE in onPlayerDamageEntity

This commit is contained in:
ColdDev 2022-11-05 20:35:44 +00:00
parent e50b5b8c70
commit 4f683e0545
2 changed files with 4 additions and 1 deletions

View File

@ -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);

View File

@ -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