Fix ClassCastException in HitQuestTracker

This commit is contained in:
cnr 2017-07-13 18:02:39 -07:00
parent 5cac083941
commit da08868206

View File

@ -1,13 +1,10 @@
package nautilus.game.arcade.quest; package nautilus.game.arcade.quest;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Item; import org.bukkit.entity.Item;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
import mineplex.core.common.util.UtilItem;
import mineplex.core.quests.TriggerType; import mineplex.core.quests.TriggerType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
@ -31,14 +28,14 @@ public class HitQuestTracker extends QuestTracker<Game>
{ {
if (!getGame().IsLive()) if (!getGame().IsLive())
return; return;
if (!(event.getEntity() instanceof Player)) if (!(event.getDamager() instanceof Player) || !(event.getEntity() instanceof Item))
return; return;
Item itemEntity = (Item) event.getEntity(); Item itemEntity = (Item) event.getEntity();
String item = itemEntity.getItemStack().getType().toString(); String item = itemEntity.getItemStack().getType().toString();
incrementQuests((Player) event.getDamager(), 1, "Player", item, getGame().GetKit((Player) event.getDamager()).GetName() + "Kit"); incrementQuests((Player) event.getDamager(), 1, "Player", item, getGame().GetKit((Player) event.getDamager()).GetName() + "Kit");
} }