From 2bf6b035982712f55239300154648f657767404d Mon Sep 17 00:00:00 2001 From: zavdav <157126752+zavdav@users.noreply.github.com> Date: Wed, 5 Mar 2025 00:48:52 +0100 Subject: [PATCH] Fix ClassCastException and register /afk in plugin.yml --- .../fundamentals/listener/FundamentalsEntityListener.java | 2 ++ FundamentalsCore/src/main/resources/plugin.yml | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/FundamentalsCore/src/main/java/com/johnymuffin/beta/fundamentals/listener/FundamentalsEntityListener.java b/FundamentalsCore/src/main/java/com/johnymuffin/beta/fundamentals/listener/FundamentalsEntityListener.java index 3cb4c31..0c24479 100644 --- a/FundamentalsCore/src/main/java/com/johnymuffin/beta/fundamentals/listener/FundamentalsEntityListener.java +++ b/FundamentalsCore/src/main/java/com/johnymuffin/beta/fundamentals/listener/FundamentalsEntityListener.java @@ -47,12 +47,14 @@ public void onEntityDamage(EntityDamageEvent event) { if (dmgEvent.getDamager() == null || !(dmgEvent.getDamager() instanceof Player)) return; FundamentalsPlayer fPlayer = plugin.getPlayerMap().getPlayer((Player) dmgEvent.getDamager()); if (fPlayer.isAFK()) event.setCancelled(true); + break; } case PROJECTILE: { LivingEntity shooter = ((Projectile) dmgEvent.getDamager()).getShooter(); if (!(shooter instanceof Player)) return; FundamentalsPlayer fPlayer = plugin.getPlayerMap().getPlayer((Player) shooter); if (fPlayer.isAFK()) event.setCancelled(true); + break; } } } diff --git a/FundamentalsCore/src/main/resources/plugin.yml b/FundamentalsCore/src/main/resources/plugin.yml index 0c45fbe..c52188f 100644 --- a/FundamentalsCore/src/main/resources/plugin.yml +++ b/FundamentalsCore/src/main/resources/plugin.yml @@ -14,9 +14,9 @@ commands: # heal: # description: Heals a player # usage: / -# afk: -# description: Set a plad -# usage: / + afk: + description: Toggles your afk status + usage: / hat: description: Puts the held block on the players head. usage: /