mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-02 08:39:49 +01:00
Fixing awkward Bukkit bug related to Flame arrows.
This commit is contained in:
parent
4639b8b939
commit
f5179cdcea
@ -38,10 +38,10 @@ import com.gmail.nossr50.skills.swords.Swords;
|
|||||||
import com.gmail.nossr50.skills.swords.SwordsManager;
|
import com.gmail.nossr50.skills.swords.SwordsManager;
|
||||||
import com.gmail.nossr50.skills.taming.Taming;
|
import com.gmail.nossr50.skills.taming.Taming;
|
||||||
import com.gmail.nossr50.skills.taming.TamingManager;
|
import com.gmail.nossr50.skills.taming.TamingManager;
|
||||||
|
import com.gmail.nossr50.skills.unarmed.Unarmed;
|
||||||
import com.gmail.nossr50.skills.unarmed.UnarmedManager;
|
import com.gmail.nossr50.skills.unarmed.UnarmedManager;
|
||||||
import com.gmail.nossr50.util.ItemChecks;
|
import com.gmail.nossr50.util.ItemChecks;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
|
||||||
import com.gmail.nossr50.util.Users;
|
import com.gmail.nossr50.util.Users;
|
||||||
|
|
||||||
public class Combat {
|
public class Combat {
|
||||||
@ -58,7 +58,7 @@ public class Combat {
|
|||||||
|
|
||||||
switch (damager.getType()) {
|
switch (damager.getType()) {
|
||||||
case PLAYER:
|
case PLAYER:
|
||||||
Player attacker = (Player) event.getDamager();
|
Player attacker = (Player) damager;
|
||||||
|
|
||||||
if (Misc.isNPCPlayer(attacker)) {
|
if (Misc.isNPCPlayer(attacker)) {
|
||||||
return;
|
return;
|
||||||
@ -184,33 +184,37 @@ public class Combat {
|
|||||||
if (targetIsPlayer) {
|
if (targetIsPlayer) {
|
||||||
Player player = (Player) target;
|
Player player = (Player) target;
|
||||||
|
|
||||||
AcrobaticsManager acrobaticsManager = new AcrobaticsManager(player);
|
|
||||||
SwordsManager swordsManager = new SwordsManager(player);
|
|
||||||
|
|
||||||
if (damager instanceof Player) {
|
if (damager instanceof Player) {
|
||||||
if (Swords.pvpEnabled) {
|
if (Swords.pvpEnabled) {
|
||||||
|
SwordsManager swordsManager = new SwordsManager(player);
|
||||||
swordsManager.counterAttackChecks((LivingEntity) damager, event.getDamage());
|
swordsManager.counterAttackChecks((LivingEntity) damager, event.getDamage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Acrobatics.pvpEnabled) {
|
if (Acrobatics.pvpEnabled) {
|
||||||
|
AcrobaticsManager acrobaticsManager = new AcrobaticsManager(player);
|
||||||
acrobaticsManager.dodgeCheck(event);
|
acrobaticsManager.dodgeCheck(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Unarmed.pvpEnabled && player.getItemInHand().getType() == Material.AIR) {
|
||||||
|
UnarmedManager unarmedManager = new UnarmedManager(player);
|
||||||
|
unarmedManager.deflectCheck(event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (Swords.pveEnabled && damager instanceof LivingEntity) {
|
if (Swords.pveEnabled && damager instanceof LivingEntity) {
|
||||||
|
SwordsManager swordsManager = new SwordsManager(player);
|
||||||
swordsManager.counterAttackChecks((LivingEntity) damager, event.getDamage());
|
swordsManager.counterAttackChecks((LivingEntity) damager, event.getDamage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Acrobatics.pveEnabled) {
|
if (Acrobatics.pveEnabled) {
|
||||||
if (damager instanceof LightningStrike && Acrobatics.dodgeLightningDisabled) {
|
if (!(damager instanceof LightningStrike && Acrobatics.dodgeLightningDisabled)) {
|
||||||
return;
|
AcrobaticsManager acrobaticsManager = new AcrobaticsManager(player);
|
||||||
}
|
|
||||||
|
|
||||||
acrobaticsManager.dodgeCheck(event);
|
acrobaticsManager.dodgeCheck(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process archery abilities.
|
* Process archery abilities.
|
||||||
@ -220,19 +224,11 @@ public class Combat {
|
|||||||
* @param event The event to run the archery checks on.
|
* @param event The event to run the archery checks on.
|
||||||
*/
|
*/
|
||||||
public static void archeryCheck(Player shooter, LivingEntity target, EntityDamageByEntityEvent event) {
|
public static void archeryCheck(Player shooter, LivingEntity target, EntityDamageByEntityEvent event) {
|
||||||
if (target instanceof Player) {
|
if (Misc.isNPCPlayer(shooter)) {
|
||||||
Player defender = (Player) target;
|
return;
|
||||||
|
|
||||||
if (defender.getItemInHand().getType().equals(Material.AIR)) {
|
|
||||||
if (configInstance.getUnarmedPVP()) {
|
|
||||||
UnarmedManager unarmedManager = new UnarmedManager(defender);
|
|
||||||
unarmedManager.deflectCheck(event);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ArcheryManager archeryManager = new ArcheryManager(shooter);
|
ArcheryManager archeryManager = new ArcheryManager(shooter);
|
||||||
|
|
||||||
archeryManager.skillShot(event);
|
archeryManager.skillShot(event);
|
||||||
|
|
||||||
if (target instanceof Player) {
|
if (target instanceof Player) {
|
||||||
@ -244,8 +240,7 @@ public class Combat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (target != shooter) {
|
if (target != shooter) {
|
||||||
PlayerProfile profile = Users.getProfile(shooter);
|
startGainXp(shooter, archeryManager.getProfile(), target, SkillType.ARCHERY);
|
||||||
startGainXp(shooter, profile, target, SkillType.ARCHERY);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -322,13 +317,7 @@ public class Combat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (Entity entity : target.getNearbyEntities(2.5, 2.5, 2.5)) {
|
for (Entity entity : target.getNearbyEntities(2.5, 2.5, 2.5)) {
|
||||||
if (entity instanceof Player) {
|
if ((entity instanceof Player && Misc.isNPCPlayer((Player) entity)) || !(entity instanceof LivingEntity) || !shouldBeAffected(attacker, entity)) {
|
||||||
if (Misc.isNPCPlayer((Player) entity)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(entity instanceof LivingEntity)) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -336,10 +325,6 @@ public class Combat {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!shouldBeAffected(attacker, entity)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
PlayerAnimationEvent armswing = new PlayerAnimationEvent(attacker);
|
PlayerAnimationEvent armswing = new PlayerAnimationEvent(attacker);
|
||||||
mcMMO.p.getServer().getPluginManager().callEvent(armswing);
|
mcMMO.p.getServer().getPluginManager().callEvent(armswing);
|
||||||
|
|
||||||
@ -503,19 +488,7 @@ public class Combat {
|
|||||||
if (entity instanceof Player) {
|
if (entity instanceof Player) {
|
||||||
Player defender = (Player) entity;
|
Player defender = (Player) entity;
|
||||||
|
|
||||||
if (!defender.getWorld().getPVP()) {
|
if (!defender.getWorld().getPVP() || defender == player || PartyManager.getInstance().inSameParty(player, defender) || Users.getProfile(defender).getGodMode()) {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (defender == player) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PartyManager.getInstance().inSameParty(player, defender)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Users.getProfile(defender).getGodMode()) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -528,9 +501,7 @@ public class Combat {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (entity instanceof Tameable) {
|
else if (entity instanceof Tameable) {
|
||||||
Tameable pet = (Tameable) entity;
|
if (Misc.isFriendlyPet(player, (Tameable) entity)) {
|
||||||
|
|
||||||
if (Misc.isFriendlyPet(player, pet)) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,11 +60,7 @@ public class ArcheryManager extends SkillManager {
|
|||||||
* @param event The event to modify.
|
* @param event The event to modify.
|
||||||
*/
|
*/
|
||||||
public void skillShot(EntityDamageEvent event) {
|
public void skillShot(EntityDamageEvent event) {
|
||||||
if (Misc.isNPCPlayer(player) || !Permissions.archeryBonus(player)) {
|
if (skillLevel >= Archery.skillShotIncreaseLevel && Permissions.archeryBonus(player)) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (skillLevel >= Archery.skillShotIncreaseLevel) {
|
|
||||||
SkillShotEventHandler eventHandler = new SkillShotEventHandler(this, event);
|
SkillShotEventHandler eventHandler = new SkillShotEventHandler(this, event);
|
||||||
|
|
||||||
eventHandler.calculateDamageBonus();
|
eventHandler.calculateDamageBonus();
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.gmail.nossr50.skills.unarmed;
|
package com.gmail.nossr50.skills.unarmed;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
|
import com.gmail.nossr50.config.Config;
|
||||||
|
|
||||||
public class Unarmed {
|
public class Unarmed {
|
||||||
public static int ironArmMaxBonusDamage = AdvancedConfig.getInstance().getIronArmMaxBonus();
|
public static int ironArmMaxBonusDamage = AdvancedConfig.getInstance().getIronArmMaxBonus();
|
||||||
@ -15,5 +16,8 @@ public class Unarmed {
|
|||||||
public static double ironGripMaxChance = AdvancedConfig.getInstance().getIronGripChanceMax();
|
public static double ironGripMaxChance = AdvancedConfig.getInstance().getIronGripChanceMax();
|
||||||
public static int ironGripMaxBonusLevel = AdvancedConfig.getInstance().getIronGripMaxBonusLevel();
|
public static int ironGripMaxBonusLevel = AdvancedConfig.getInstance().getIronGripMaxBonusLevel();
|
||||||
|
|
||||||
|
public static boolean pvpEnabled = Config.getInstance().getUnarmedPVP();
|
||||||
|
public static boolean pveEnabled = Config.getInstance().getUnarmedPVE();
|
||||||
|
|
||||||
public static double berserkDamageModifier = 1.5;
|
public static double berserkDamageModifier = 1.5;
|
||||||
}
|
}
|
@ -49,9 +49,6 @@ public class UnarmedManager extends SkillManager {
|
|||||||
* @param event The event to modify
|
* @param event The event to modify
|
||||||
*/
|
*/
|
||||||
public void deflectCheck(EntityDamageEvent event) {
|
public void deflectCheck(EntityDamageEvent event) {
|
||||||
if (player == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!Permissions.deflect(player)) {
|
if (!Permissions.deflect(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user