mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
Update to the new ProjectileSource API
This commit is contained in:
parent
72d26fed0f
commit
09557e378b
2
pom.xml
2
pom.xml
@ -121,7 +121,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bukkit</groupId>
|
<groupId>org.bukkit</groupId>
|
||||||
<artifactId>bukkit</artifactId>
|
<artifactId>bukkit</artifactId>
|
||||||
<version>1.6.4-R2.0</version>
|
<version>LATEST</version>
|
||||||
<type>jar</type>
|
<type>jar</type>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
@ -35,6 +35,7 @@ import org.bukkit.inventory.meta.PotionMeta;
|
|||||||
import org.bukkit.metadata.FixedMetadataValue;
|
import org.bukkit.metadata.FixedMetadataValue;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
import org.bukkit.projectiles.ProjectileSource;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
@ -169,7 +170,11 @@ public class EntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (attacker instanceof Projectile) {
|
if (attacker instanceof Projectile) {
|
||||||
attacker = ((Projectile) attacker).getShooter();
|
ProjectileSource projectileSource = ((Projectile) attacker).getShooter();
|
||||||
|
|
||||||
|
if (projectileSource instanceof LivingEntity) {
|
||||||
|
attacker = (LivingEntity) projectileSource;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (attacker instanceof Tameable) {
|
else if (attacker instanceof Tameable) {
|
||||||
AnimalTamer animalTamer = ((Tameable) attacker).getOwner();
|
AnimalTamer animalTamer = ((Tameable) attacker).getOwner();
|
||||||
|
@ -16,6 +16,7 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.projectiles.ProjectileSource;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
@ -262,10 +263,10 @@ public final class CombatUtils {
|
|||||||
}
|
}
|
||||||
else if (entityType == EntityType.ARROW) {
|
else if (entityType == EntityType.ARROW) {
|
||||||
Arrow arrow = (Arrow) damager;
|
Arrow arrow = (Arrow) damager;
|
||||||
LivingEntity shooter = arrow.getShooter();
|
ProjectileSource projectileSource = arrow.getShooter();
|
||||||
|
|
||||||
if (shooter != null && shooter instanceof Player && SkillType.ARCHERY.shouldProcess(target)) {
|
if (projectileSource != null && projectileSource instanceof Player && SkillType.ARCHERY.shouldProcess(target)) {
|
||||||
Player player = (Player) shooter;
|
Player player = (Player) projectileSource;
|
||||||
|
|
||||||
if (!Misc.isNPCEntity(player) && SkillType.ARCHERY.getPermissions(player)) {
|
if (!Misc.isNPCEntity(player) && SkillType.ARCHERY.getPermissions(player)) {
|
||||||
processArcheryCombat(target, player, event, arrow);
|
processArcheryCombat(target, player, event, arrow);
|
||||||
|
Loading…
Reference in New Issue
Block a user