Update getShooter() to getLastDamageCause() for players

This commit is contained in:
HappyPikachu 2015-01-05 19:48:38 -05:00
parent 84a38a9aa8
commit 1aa81ef940
3 changed files with 23 additions and 14 deletions

View File

@ -576,10 +576,9 @@ public class PlayerListener implements Listener, ColorUtil {
if (damager instanceof Projectile) {
Projectile p = (Projectile) damager;
if (p.getShooter() instanceof Player) {
if(evt.getEntity().getLastDamageCause().getEntity() instanceof Player) {
Player player = (Player) p.getShooter();
Player player = (Player) evt.getEntity().getLastDamageCause().getEntity();
boolean okay = true;
if (plugin.citizens != null) {
@ -648,11 +647,10 @@ public class PlayerListener implements Listener, ColorUtil {
if (damager != null) {
if (damager instanceof Projectile) {
if(evt.getEntity().getLastDamageCause().getEntity() instanceof Player) {
Projectile p = (Projectile) damager;
if (p.getShooter() instanceof Player) {
Player player = (Player) p.getShooter();
Player player = (Player) evt.getEntity().getLastDamageCause().getEntity();
if (plugin.checkQuester(player.getName()) == false) {

View File

@ -177,7 +177,8 @@ public class Quest {
return testRequirements(quester.getPlayer());
}
public boolean testRequirements(Player player) {
@SuppressWarnings("deprecation")
public boolean testRequirements(Player player) {
Quester quester = plugin.getQuester(player.getUniqueId());

View File

@ -4,6 +4,7 @@ import java.util.EnumMap;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import org.bukkit.DyeColor;
import org.bukkit.Location;
import org.bukkit.Material;
@ -32,12 +33,15 @@ public class Stage {
LinkedList<ItemStack> itemsToDeliver = new LinkedList<ItemStack>();
LinkedList<Integer> itemDeliveryTargets = new LinkedList<Integer>() {
@Override
private static final long serialVersionUID = -2774443496142382127L;
@Override
public boolean equals(Object o) {
if (o instanceof LinkedList) {
LinkedList<Integer> otherList = (LinkedList<Integer>) o;
@SuppressWarnings("unchecked")
LinkedList<Integer> otherList = (LinkedList<Integer>) o;
for (Integer i : this) {
@ -58,12 +62,15 @@ public class Stage {
public LinkedList<Integer> citizensToInteract = new LinkedList<Integer>() {
@Override
private static final long serialVersionUID = -4086855121042524435L;
@Override
public boolean equals(Object o) {
if (o instanceof LinkedList) {
LinkedList<Integer> otherList = (LinkedList<Integer>) o;
@SuppressWarnings("unchecked")
LinkedList<Integer> otherList = (LinkedList<Integer>) o;
for (Integer i : this) {
@ -82,12 +89,15 @@ public class Stage {
};
public LinkedList<Integer> citizensToKill = new LinkedList<Integer>() {
@Override
private static final long serialVersionUID = 7705964814014176415L;
@Override
public boolean equals(Object o) {
if (o instanceof LinkedList) {
LinkedList<Integer> otherList = (LinkedList<Integer>) o;
@SuppressWarnings("unchecked")
LinkedList<Integer> otherList = (LinkedList<Integer>) o;
for (Integer i : this) {