public static void setArmourAccordingly(final Player player, boolean enabled) {
final PlayerInventory inv = player.getInventory();
ItemStack[] armours = inv.getContents();
// Check the whole inventory for armour pieces
for (int i = 0; i < armours.length; i++) {
ItemStack piece = armours[i];
if (piece != null && piece.getType() != Material.AIR) {
Messenger.debug("Attempting to apply armour value to item", player);
//If this piece is one of the ones being worn right now
if(ArrayUtils.contains(inv.getArmorContents(), armours[i]))
armours[i] = apply(piece, enabled); //Apply/remove values according state of module in this world
else armours[i] = apply(piece, false); //Otherwise set values back to default
}
}
player.getInventory().setContents(armours);
}
ModuleOldArmourStrength.java 文件源码
java
阅读 22
收藏 0
点赞 0
评论 0
项目:BukkitOldCombatMechanics
作者:
评论列表
文章目录