Przeglądaj źródła

Fixed possible ClassCastException from catching something other than a
mob when using the Shake Mob skill

GJ 13 lat temu
rodzic
commit
ca9ce1ba1b

+ 1 - 0
Changelog.txt

@@ -29,6 +29,7 @@ Version 1.3.10-dev
  = Fixed "lower tool" messages still being displayed even when ability messages are disabled.
  = Fixed "lower tool" messages still being displayed even when ability messages are disabled.
  = Fixed custom blocks not dropping the proper item with Super Breaker when Silk Touch is used
  = Fixed custom blocks not dropping the proper item with Super Breaker when Silk Touch is used
  = Fixed custom woodcutting blocks throwing errors.
  = Fixed custom woodcutting blocks throwing errors.
+ = Fixed possible ClassCastException from catching something other than a mob when using the Shake Mob skill
  ! Changed the format by which Chunklets are stored to be much smaller, and much faster to load
  ! Changed the format by which Chunklets are stored to be much smaller, and much faster to load
  ! Optimized how player placed blocks are tracked
  ! Optimized how player placed blocks are tracked
 
 

+ 5 - 0
src/main/java/com/gmail/nossr50/listeners/PlayerListener.java

@@ -3,6 +3,7 @@ package com.gmail.nossr50.listeners;
 import org.bukkit.ChatColor;
 import org.bukkit.ChatColor;
 import org.bukkit.Material;
 import org.bukkit.Material;
 import org.bukkit.block.Block;
 import org.bukkit.block.Block;
+import org.bukkit.entity.LivingEntity;
 import org.bukkit.entity.Player;
 import org.bukkit.entity.Player;
 import org.bukkit.event.EventHandler;
 import org.bukkit.event.EventHandler;
 import org.bukkit.event.EventPriority;
 import org.bukkit.event.EventPriority;
@@ -96,6 +97,10 @@ public class PlayerListener implements Listener {
                 break;
                 break;
 
 
             case CAUGHT_ENTITY:
             case CAUGHT_ENTITY:
+                if (!(event.getCaught() instanceof LivingEntity)) {
+                    return;
+                }
+
                 if (Users.getProfile(player).getSkillLevel(SkillType.FISHING) >= 150 && Permissions.getInstance().shakeMob(player)) {
                 if (Users.getProfile(player).getSkillLevel(SkillType.FISHING) >= 150 && Permissions.getInstance().shakeMob(player)) {
                     Fishing.shakeMob(event);
                     Fishing.shakeMob(event);
                 }
                 }