mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-01-31 14:49:35 +01:00
Fixed bug with checking if an entity is wearing armor.
This commit is contained in:
parent
176ffcc3d1
commit
cedfb1a538
@ -10,6 +10,7 @@ Key:
|
|||||||
Version 1.4.00-dev
|
Version 1.4.00-dev
|
||||||
+ Added new cancellable McMMOPlayerDisarmEvent for Citizens compatibility - fires whenever a player is disarmed.
|
+ Added new cancellable McMMOPlayerDisarmEvent for Citizens compatibility - fires whenever a player is disarmed.
|
||||||
= Fixed bug where Impact was applied incorrectly due to an inverted method call
|
= Fixed bug where Impact was applied incorrectly due to an inverted method call
|
||||||
|
= Fixed bug where Impact improperly determined the defender's armor
|
||||||
= Fixed ArrayIndexOutOfBoundsException resulting from being unranked in a skill when using FlatFile
|
= Fixed ArrayIndexOutOfBoundsException resulting from being unranked in a skill when using FlatFile
|
||||||
! Changed how Tree Feller is handled, it should now put less stress on the CPU
|
! Changed how Tree Feller is handled, it should now put less stress on the CPU
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@ import org.bukkit.entity.LivingEntity;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Tameable;
|
import org.bukkit.entity.Tameable;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.inventory.EntityEquipment;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
|
|
||||||
@ -57,11 +56,11 @@ public class Misc {
|
|||||||
* @return true if the player has armor, false otherwise
|
* @return true if the player has armor, false otherwise
|
||||||
*/
|
*/
|
||||||
public static boolean hasArmor(LivingEntity entity) {
|
public static boolean hasArmor(LivingEntity entity) {
|
||||||
EntityEquipment equipment = entity.getEquipment();
|
for (ItemStack armor : entity.getEquipment().getArmorContents()) {
|
||||||
|
if (armor.getType() != Material.AIR) {
|
||||||
if (equipment.getBoots() != null || equipment.getChestplate() != null || equipment.getHelmet() != null || equipment.getLeggings() != null) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user