mirror of
				https://github.com/mcMMO-Dev/mcMMO.git
				synced 2025-10-30 16:53:43 +01:00 
			
		
		
		
	Rework of Swords handling
This commit is contained in:
		| @@ -1,101 +0,0 @@ | |||||||
| package com.gmail.nossr50.skills.combat; |  | ||||||
|  |  | ||||||
| import java.util.Random; |  | ||||||
|  |  | ||||||
| import org.bukkit.entity.AnimalTamer; |  | ||||||
| import org.bukkit.entity.Entity; |  | ||||||
| import org.bukkit.entity.LivingEntity; |  | ||||||
| import org.bukkit.entity.Player; |  | ||||||
| import org.bukkit.entity.Tameable; |  | ||||||
|  |  | ||||||
| import com.gmail.nossr50.datatypes.PlayerProfile; |  | ||||||
| import com.gmail.nossr50.datatypes.SkillType; |  | ||||||
| import com.gmail.nossr50.locale.LocaleLoader; |  | ||||||
| import com.gmail.nossr50.party.PartyManager; |  | ||||||
| import com.gmail.nossr50.runnables.BleedTimer; |  | ||||||
| import com.gmail.nossr50.util.Combat; |  | ||||||
| import com.gmail.nossr50.util.ItemChecks; |  | ||||||
| import com.gmail.nossr50.util.Misc; |  | ||||||
| import com.gmail.nossr50.util.Permissions; |  | ||||||
| import com.gmail.nossr50.util.Users; |  | ||||||
|  |  | ||||||
| public class Swords { |  | ||||||
|     private static Random random = new Random(); |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * Check for Bleed effect. |  | ||||||
|      * |  | ||||||
|      * @param attacker The attacking player |  | ||||||
|      * @param defender The defending entity |  | ||||||
|      */ |  | ||||||
|     public static void bleedCheck(Player attacker, LivingEntity defender) { |  | ||||||
|  |  | ||||||
|         if (defender instanceof Tameable) { |  | ||||||
|             Tameable pet = (Tameable) defender; |  | ||||||
|  |  | ||||||
|             if (pet.isTamed()) { |  | ||||||
|                 AnimalTamer tamer = pet.getOwner(); |  | ||||||
|  |  | ||||||
|                 if (tamer instanceof Player) { |  | ||||||
|                     Player owner = (Player) tamer; |  | ||||||
|  |  | ||||||
|                     if (owner == attacker || PartyManager.getInstance().inSameParty(attacker, owner)) { |  | ||||||
|                         return; |  | ||||||
|                     } |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         final int MAX_BONUS_LEVEL = 750; |  | ||||||
|  |  | ||||||
|         PlayerProfile PPa = Users.getProfile(attacker); |  | ||||||
|         int skillLevel = PPa.getSkillLevel(SkillType.SWORDS); |  | ||||||
|         int skillCheck = Misc.skillCheck(skillLevel, MAX_BONUS_LEVEL); |  | ||||||
|  |  | ||||||
|         if (random.nextInt(1000) <= skillCheck && !defender.isDead()) { |  | ||||||
|             int bleedTicks = 0; |  | ||||||
|  |  | ||||||
|             if (skillLevel >= 750) { |  | ||||||
|                 bleedTicks = 3; |  | ||||||
|             } |  | ||||||
|             else { |  | ||||||
|                 bleedTicks = 2; |  | ||||||
|             } |  | ||||||
|  |  | ||||||
|             BleedTimer.add(defender, bleedTicks); |  | ||||||
|             attacker.sendMessage(LocaleLoader.getString("Swords.Combat.Bleeding")); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * Counter-attack entities. |  | ||||||
|      * |  | ||||||
|      * @param attacker The attacking entity |  | ||||||
|      * @param defender The defending player |  | ||||||
|      * @param damage The amount of damage being countered |  | ||||||
|      */ |  | ||||||
|     public static void counterAttackChecks(Entity attacker, Player defender, int damage) { |  | ||||||
|         if (!(attacker instanceof LivingEntity)) { |  | ||||||
|             return; |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         PlayerProfile PPd = Users.getProfile(defender); |  | ||||||
|  |  | ||||||
|         if (ItemChecks.isSword(defender.getItemInHand()) && Permissions.getInstance().counterAttack(defender)) { |  | ||||||
|             final int MAX_BONUS_LEVEL = 600; |  | ||||||
|             final int COUNTER_ATTACK_MODIFIER = 2; |  | ||||||
|  |  | ||||||
|             int skillLevel = PPd.getSkillLevel(SkillType.SWORDS); |  | ||||||
|             int skillCheck = Misc.skillCheck(skillLevel, MAX_BONUS_LEVEL); |  | ||||||
|  |  | ||||||
|             if (random.nextInt(2000) <= skillCheck) { |  | ||||||
|                 Combat.dealDamage((LivingEntity) attacker, damage / COUNTER_ATTACK_MODIFIER); |  | ||||||
|                 defender.sendMessage(LocaleLoader.getString("Swords.Combat.Countered")); |  | ||||||
|  |  | ||||||
|                 if (attacker instanceof Player) { |  | ||||||
|                     ((Player) attacker).sendMessage(LocaleLoader.getString("Swords.Combat.Counter.Hit")); |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @@ -0,0 +1,49 @@ | |||||||
|  | package com.gmail.nossr50.skills.swords; | ||||||
|  |  | ||||||
|  | import org.bukkit.entity.LivingEntity; | ||||||
|  | import org.bukkit.entity.Player; | ||||||
|  |  | ||||||
|  | import com.gmail.nossr50.locale.LocaleLoader; | ||||||
|  | import com.gmail.nossr50.runnables.BleedTimer; | ||||||
|  | import com.gmail.nossr50.util.Misc; | ||||||
|  |  | ||||||
|  | public class BleedEventHandler { | ||||||
|  |     private SwordsManager manager; | ||||||
|  |     private int skillLevel; | ||||||
|  |     private LivingEntity defender; | ||||||
|  |  | ||||||
|  |     protected int skillModifier; | ||||||
|  |  | ||||||
|  |     protected BleedEventHandler(SwordsManager manager, LivingEntity defender) { | ||||||
|  |         this.manager = manager; | ||||||
|  |         this.skillLevel = manager.getSkillLevel(); | ||||||
|  |         this.defender = defender; | ||||||
|  |  | ||||||
|  |         calculateSkillModifier(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     protected void calculateSkillModifier() { | ||||||
|  |         this.skillModifier = Misc.skillCheck(skillLevel, Swords.BLEED_MAX_BONUS_LEVEL); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     protected void addBleedTicks() { | ||||||
|  |         int bleedTicks; | ||||||
|  |  | ||||||
|  |         if (skillLevel >= Swords.BLEED_MAX_BONUS_LEVEL) { | ||||||
|  |             bleedTicks = Swords.MAX_BLEED_TICKS; | ||||||
|  |         } | ||||||
|  |         else { | ||||||
|  |             bleedTicks = Swords.BASE_BLEED_TICKS; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         BleedTimer.add(defender, bleedTicks); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     protected void sendAbilityMessages() { | ||||||
|  |         manager.getPlayer().sendMessage(LocaleLoader.getString("Swords.Combat.Bleeding")); | ||||||
|  |  | ||||||
|  |         if (defender instanceof Player) { | ||||||
|  |             ((Player) defender).sendMessage(LocaleLoader.getString("Swords.Combat.Bleeding.Started")); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -0,0 +1,45 @@ | |||||||
|  | package com.gmail.nossr50.skills.swords; | ||||||
|  |  | ||||||
|  | import org.bukkit.entity.LivingEntity; | ||||||
|  | import org.bukkit.entity.Player; | ||||||
|  |  | ||||||
|  | import com.gmail.nossr50.locale.LocaleLoader; | ||||||
|  | import com.gmail.nossr50.util.Combat; | ||||||
|  | import com.gmail.nossr50.util.ItemChecks; | ||||||
|  | import com.gmail.nossr50.util.Misc; | ||||||
|  |  | ||||||
|  | public class CounterAttackEventHandler { | ||||||
|  |     private SwordsManager manager; | ||||||
|  |     private Player player; | ||||||
|  |     private LivingEntity attacker; | ||||||
|  |     private int damage; | ||||||
|  |  | ||||||
|  |     protected int skillModifier; | ||||||
|  |  | ||||||
|  |     protected CounterAttackEventHandler(SwordsManager manager, LivingEntity attacker, int damage) { | ||||||
|  |         this.manager = manager; | ||||||
|  |         this.player = manager.getPlayer(); | ||||||
|  |         this.attacker = attacker; | ||||||
|  |         this.damage = damage; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     protected boolean isHoldingSword() { | ||||||
|  |         return ItemChecks.isSword(player.getItemInHand()); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     protected void calculateSkillModifier() { | ||||||
|  |         this.skillModifier = Misc.skillCheck(manager.getSkillLevel(), Swords.COUNTER_ATTACK_MAX_BONUS_LEVEL); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     protected void dealDamage() { | ||||||
|  |         Combat.dealDamage(attacker, damage / Swords.COUNTER_ATTACK_MODIFIER); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     protected void sendAbilityMessages() { | ||||||
|  |         player.sendMessage(LocaleLoader.getString("Swords.Combat.Countered")); | ||||||
|  |  | ||||||
|  |         if (attacker instanceof Player) { | ||||||
|  |             ((Player) attacker).sendMessage(LocaleLoader.getString("Swords.Combat.Counter.Hit")); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -0,0 +1,25 @@ | |||||||
|  | package com.gmail.nossr50.skills.swords; | ||||||
|  |  | ||||||
|  | import org.bukkit.entity.LivingEntity; | ||||||
|  | import org.bukkit.entity.Player; | ||||||
|  |  | ||||||
|  | import com.gmail.nossr50.datatypes.SkillType; | ||||||
|  | import com.gmail.nossr50.runnables.BleedTimer; | ||||||
|  | import com.gmail.nossr50.util.Combat; | ||||||
|  |  | ||||||
|  | public class SerratedStrikesEventHandler { | ||||||
|  |     private Player player; | ||||||
|  |     private LivingEntity target; | ||||||
|  |     private int damage; | ||||||
|  |  | ||||||
|  |     protected SerratedStrikesEventHandler(SwordsManager manager, LivingEntity target, int damage) { | ||||||
|  |         this.player = manager.getPlayer(); | ||||||
|  |         this.target = target; | ||||||
|  |         this.damage = damage; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     protected void applyAbilityEffects() { | ||||||
|  |         Combat.applyAbilityAoE(player, target, damage / Swords.SERRATED_STRIKES_MODIFIER, SkillType.SWORDS); | ||||||
|  |         BleedTimer.add(target, Swords.SERRATED_STRIKES_BLEED_TICKS); | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										21
									
								
								src/main/java/com/gmail/nossr50/skills/swords/Swords.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								src/main/java/com/gmail/nossr50/skills/swords/Swords.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | |||||||
|  | package com.gmail.nossr50.skills.swords; | ||||||
|  |  | ||||||
|  | import java.util.Random; | ||||||
|  |  | ||||||
|  | public class Swords { | ||||||
|  |     public static final int BLEED_MAX_BONUS_LEVEL = 750; | ||||||
|  |     public static final int MAX_BLEED_TICKS = 3; | ||||||
|  |     public static final int BASE_BLEED_TICKS = 2; | ||||||
|  |  | ||||||
|  |     public static final int COUNTER_ATTACK_MAX_BONUS_LEVEL = 600; | ||||||
|  |     public static final int COUNTER_ATTACK_MODIFIER = 2; | ||||||
|  |  | ||||||
|  |     public static final int SERRATED_STRIKES_MODIFIER = 4; | ||||||
|  |     public static final int SERRATED_STRIKES_BLEED_TICKS = 5; | ||||||
|  |  | ||||||
|  |     private static Random random = new Random(); | ||||||
|  |  | ||||||
|  |     protected static Random getRandom() { | ||||||
|  |         return random; | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -0,0 +1,79 @@ | |||||||
|  | package com.gmail.nossr50.skills.swords; | ||||||
|  |  | ||||||
|  | import org.bukkit.entity.LivingEntity; | ||||||
|  | import org.bukkit.entity.Player; | ||||||
|  |  | ||||||
|  | import com.gmail.nossr50.datatypes.PlayerProfile; | ||||||
|  | import com.gmail.nossr50.datatypes.SkillType; | ||||||
|  | import com.gmail.nossr50.util.Combat; | ||||||
|  | import com.gmail.nossr50.util.Permissions; | ||||||
|  | import com.gmail.nossr50.util.Users; | ||||||
|  |  | ||||||
|  | public class SwordsManager { | ||||||
|  |     private Player player; | ||||||
|  |     private PlayerProfile profile; | ||||||
|  |     private int skillLevel; | ||||||
|  |     private Permissions permissionsInstance; | ||||||
|  |  | ||||||
|  |     public SwordsManager (Player player) { | ||||||
|  |         this.player = player; | ||||||
|  |         this.profile = Users.getProfile(player); | ||||||
|  |         this.skillLevel = profile.getSkillLevel(SkillType.SWORDS); | ||||||
|  |         this.permissionsInstance =  Permissions.getInstance(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * Check for Bleed effect. | ||||||
|  |      * | ||||||
|  |      * @param defender The defending entity | ||||||
|  |      */ | ||||||
|  |     public void bleedCheck(LivingEntity defender) { | ||||||
|  |         if (!permissionsInstance.swordsBleed(player)) { | ||||||
|  |             return; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         if (Combat.shouldBeAffected(player, defender)) { | ||||||
|  |             BleedEventHandler eventHandler = new BleedEventHandler(this, defender); | ||||||
|  |  | ||||||
|  |             if (Swords.getRandom().nextInt(1000) < eventHandler.skillModifier) { | ||||||
|  |                 eventHandler.addBleedTicks(); | ||||||
|  |                 eventHandler.sendAbilityMessages(); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public void counterAttackChecks(LivingEntity attacker, int damage) { | ||||||
|  |         if (!permissionsInstance.counterAttack(player)) { | ||||||
|  |             return; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         CounterAttackEventHandler eventHandler = new CounterAttackEventHandler(this, attacker, damage); | ||||||
|  |  | ||||||
|  |         if (eventHandler.isHoldingSword()) { | ||||||
|  |             eventHandler.calculateSkillModifier(); | ||||||
|  |  | ||||||
|  |             if (Swords.getRandom().nextInt(2000) < eventHandler.skillModifier) { | ||||||
|  |                 eventHandler.dealDamage(); | ||||||
|  |                 eventHandler.sendAbilityMessages(); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public void serratedStrikes(LivingEntity target, int damage) { | ||||||
|  |         if (!permissionsInstance.serratedStrikes(player)) { | ||||||
|  |             return; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         SerratedStrikesEventHandler eventHandler = new SerratedStrikesEventHandler(this, target, damage); | ||||||
|  |  | ||||||
|  |         eventHandler.applyAbilityEffects();  | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     protected int getSkillLevel() { | ||||||
|  |         return skillLevel; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     protected Player getPlayer() { | ||||||
|  |         return player; | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -34,6 +34,7 @@ import com.gmail.nossr50.skills.acrobatics.AcrobaticsManager; | |||||||
| import com.gmail.nossr50.skills.archery.ArcheryManager; | import com.gmail.nossr50.skills.archery.ArcheryManager; | ||||||
| import com.gmail.nossr50.skills.combat.Axes; | import com.gmail.nossr50.skills.combat.Axes; | ||||||
| import com.gmail.nossr50.skills.swords.Swords; | import com.gmail.nossr50.skills.swords.Swords; | ||||||
|  | import com.gmail.nossr50.skills.swords.SwordsManager; | ||||||
| import com.gmail.nossr50.skills.taming.TamingManager; | import com.gmail.nossr50.skills.taming.TamingManager; | ||||||
| import com.gmail.nossr50.skills.unarmed.UnarmedManager; | import com.gmail.nossr50.skills.unarmed.UnarmedManager; | ||||||
|  |  | ||||||
| @@ -64,7 +65,7 @@ public class Combat { | |||||||
|  |  | ||||||
|             combatAbilityChecks(attacker); |             combatAbilityChecks(attacker); | ||||||
|  |  | ||||||
|             if (ItemChecks.isSword(itemInHand) && permInstance.swords(attacker)) { |             if (ItemChecks.isSword(itemInHand)) { | ||||||
|                 if (!configInstance.getSwordsPVP()) { |                 if (!configInstance.getSwordsPVP()) { | ||||||
|                     if (targetIsPlayer || targetIsTamedPet) { |                     if (targetIsPlayer || targetIsTamedPet) { | ||||||
|                         return; |                         return; | ||||||
| @@ -77,13 +78,12 @@ public class Combat { | |||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|                 if (permInstance.swordsBleed(attacker)) { |                 SwordsManager swordsManager = new SwordsManager(attacker); | ||||||
|                     Swords.bleedCheck(attacker, target); |  | ||||||
|                 } |  | ||||||
|  |  | ||||||
|                 if (PPa.getAbilityMode(AbilityType.SERRATED_STRIKES) && permInstance.serratedStrikes(attacker)) { |                 swordsManager.bleedCheck(target); | ||||||
|                     applyAbilityAoE(attacker, target, event.getDamage() / 4, SkillType.SWORDS); |  | ||||||
|                     BleedTimer.add(target, 5); |                 if (PPa.getAbilityMode(AbilityType.SERRATED_STRIKES)) { | ||||||
|  |                     swordsManager.serratedStrikes(target, event.getDamage()); | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|                 startGainXp(attacker, PPa, target, SkillType.SWORDS); |                 startGainXp(attacker, PPa, target, SkillType.SWORDS); | ||||||
| @@ -199,14 +199,17 @@ public class Combat { | |||||||
|         } |         } | ||||||
|  |  | ||||||
|         if (target instanceof Player) { |         if (target instanceof Player) { | ||||||
|             AcrobaticsManager acroManager = new AcrobaticsManager((Player) target); |             Player player = (Player) target; | ||||||
|  |  | ||||||
|  |             AcrobaticsManager acroManager = new AcrobaticsManager(player); | ||||||
|  |             SwordsManager swordsManager = new SwordsManager(player); | ||||||
|  |  | ||||||
|             if (configInstance.getSwordsPVP() && damager instanceof Player) { |             if (configInstance.getSwordsPVP() && damager instanceof Player) { | ||||||
|                 Swords.counterAttackChecks(damager, (Player) target, event.getDamage()); |                 swordsManager.counterAttackChecks((Player) damager, event.getDamage()); | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             if (configInstance.getSwordsPVE() && !(damager instanceof Player)) { |             if (configInstance.getSwordsPVE() && !(damager instanceof Player)) { | ||||||
|                 Swords.counterAttackChecks(damager, (Player) target, event.getDamage()); |                 swordsManager.counterAttackChecks((LivingEntity) damager, event.getDamage()); | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             if (configInstance.getAcrobaticsPVP() && damager instanceof Player) { |             if (configInstance.getAcrobaticsPVP() && damager instanceof Player) { | ||||||
| @@ -339,7 +342,7 @@ public class Combat { | |||||||
|      * @param damage The initial damage amount |      * @param damage The initial damage amount | ||||||
|      * @param type The type of skill being used |      * @param type The type of skill being used | ||||||
|      */ |      */ | ||||||
|     private static void applyAbilityAoE(Player attacker, LivingEntity target, int damage, SkillType type) { |     public static void applyAbilityAoE(Player attacker, LivingEntity target, int damage, SkillType type) { | ||||||
|         ItemStack inHand = attacker.getItemInHand(); |         ItemStack inHand = attacker.getItemInHand(); | ||||||
|  |  | ||||||
|         if (ModChecks.isCustomTool(inHand) && !ModChecks.getToolFromItemStack(inHand).isAbilityEnabled()) { |         if (ModChecks.isCustomTool(inHand) && !ModChecks.getToolFromItemStack(inHand).isAbilityEnabled()) { | ||||||
| @@ -362,28 +365,7 @@ public class Combat { | |||||||
|                 break; |                 break; | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             if (entity instanceof Player) { |             if (!shouldBeAffected(attacker, target)) { | ||||||
|                 Player defender = (Player) entity; |  | ||||||
|  |  | ||||||
|                 if (!target.getWorld().getPVP()) { |  | ||||||
|                     continue; |  | ||||||
|                 } |  | ||||||
|  |  | ||||||
|                 if (defender.getName().equals(attacker.getName())) { |  | ||||||
|                     continue; |  | ||||||
|                 } |  | ||||||
|  |  | ||||||
|                 if (PartyManager.getInstance().inSameParty(attacker, defender)) { |  | ||||||
|                     continue; |  | ||||||
|                 } |  | ||||||
|  |  | ||||||
|                 PlayerProfile playerProfile = Users.getProfile((Player) entity); |  | ||||||
|  |  | ||||||
|                 if (playerProfile.getGodMode()) { |  | ||||||
|                     continue; |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|             else if (!shouldBeAffected(attacker, target)) { |  | ||||||
|                 continue; |                 continue; | ||||||
|             } |             } | ||||||
|  |  | ||||||
| @@ -396,7 +378,7 @@ public class Combat { | |||||||
|                     ((Player) entity).sendMessage(LocaleLoader.getString("Swords.Combat.SS.Struck")); |                     ((Player) entity).sendMessage(LocaleLoader.getString("Swords.Combat.SS.Struck")); | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|                 BleedTimer.add((LivingEntity) entity, 5); |                 BleedTimer.add((LivingEntity) entity, Swords.SERRATED_STRIKES_BLEED_TICKS); | ||||||
|  |  | ||||||
|                 break; |                 break; | ||||||
|  |  | ||||||
| @@ -526,9 +508,26 @@ public class Combat { | |||||||
|      * @return true if the LivingEntity should be damaged, false otherwise. |      * @return true if the LivingEntity should be damaged, false otherwise. | ||||||
|      */ |      */ | ||||||
|     public static boolean shouldBeAffected(Player player, LivingEntity livingEntity) { |     public static boolean shouldBeAffected(Player player, LivingEntity livingEntity) { | ||||||
|         boolean isAffected = true; |         if (livingEntity instanceof Player) { | ||||||
|  |             Player defender = (Player) livingEntity; | ||||||
|  |  | ||||||
|         if (livingEntity instanceof Tameable) { |             if (!defender.getWorld().getPVP()) { | ||||||
|  |                 return false; | ||||||
|  |             } | ||||||
|  |  | ||||||
|  |             if (defender.getName().equals(player.getName())) { | ||||||
|  |                 return false; | ||||||
|  |             } | ||||||
|  |  | ||||||
|  |             if (PartyManager.getInstance().inSameParty(player, defender)) { | ||||||
|  |                 return false; | ||||||
|  |             } | ||||||
|  |  | ||||||
|  |             if (Users.getProfile(defender).getGodMode()) { | ||||||
|  |                 return false; | ||||||
|  |             } | ||||||
|  |         }    | ||||||
|  |         else if (livingEntity instanceof Tameable) { | ||||||
|             Tameable pet = (Tameable) livingEntity; |             Tameable pet = (Tameable) livingEntity; | ||||||
|  |  | ||||||
|             if (pet.isTamed()) { |             if (pet.isTamed()) { | ||||||
| @@ -538,12 +537,12 @@ public class Combat { | |||||||
|                     Player owner = (Player) tamer; |                     Player owner = (Player) tamer; | ||||||
|  |  | ||||||
|                     if (owner == player || PartyManager.getInstance().inSameParty(player, owner)) { |                     if (owner == player || PartyManager.getInstance().inSameParty(player, owner)) { | ||||||
|                         isAffected = false; |                         return false; | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         return isAffected; |         return true; | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -235,6 +235,7 @@ Swords.Ability.Ready=[[GREEN]]**YOU READY YOUR SWORD** | |||||||
| Swords.Combat.Bleed.Chance=[[RED]]Bleed Chance: [[YELLOW]]{0} | Swords.Combat.Bleed.Chance=[[RED]]Bleed Chance: [[YELLOW]]{0} | ||||||
| Swords.Combat.Bleed.Length=[[RED]]Bleed Length: [[YELLOW]]{0} ticks | Swords.Combat.Bleed.Length=[[RED]]Bleed Length: [[YELLOW]]{0} ticks | ||||||
| Swords.Combat.Bleed.Note=[[GRAY]]NOTE: [[YELLOW]]1 Tick happens every 2 seconds | Swords.Combat.Bleed.Note=[[GRAY]]NOTE: [[YELLOW]]1 Tick happens every 2 seconds | ||||||
|  | Swords.Combat.Bleeding.Started=[[DARK_RED]] You're bleeding! | ||||||
| Swords.Combat.Bleeding.Stopped=[[GRAY]]The bleeding has [[GREEN]]stopped[[GRAY]]! | Swords.Combat.Bleeding.Stopped=[[GRAY]]The bleeding has [[GREEN]]stopped[[GRAY]]! | ||||||
| Swords.Combat.Bleeding=[[GREEN]]**ENEMY BLEEDING** | Swords.Combat.Bleeding=[[GREEN]]**ENEMY BLEEDING** | ||||||
| Swords.Combat.Counter.Chance=[[RED]]Counter Attack Chance: [[YELLOW]]{0} | Swords.Combat.Counter.Chance=[[RED]]Counter Attack Chance: [[YELLOW]]{0} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 GJ
					GJ