public static PVPMode getPVPMode(Player player){ Objects.requireNonNull(player, "player cannot be null!"); return player.getAttribute(Attribute.GENERIC_ATTACK_SPEED).getBaseValue() == 4 ? PVPMode.NEW_PVP : PVPMode.OLD_PVP; }
@Override public double getSpeedAttributeMultiplier(final Player player) { final AttributeInstance attrInst = player.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED); final double val = attrInst.getValue() / attrInst.getBaseValue(); final AttributeModifier mod = getModifier(attrInst, AttribUtil.ID_SPRINT_BOOST); return mod == null ? val : (val / getMultiplier(mod)); }
@EventHandler(priority = EventPriority.HIGHEST) public void onPlayerQuit(PlayerQuitEvent e){ Player player = e.getPlayer(); AttributeInstance attribute = player.getAttribute(Attribute.GENERIC_ATTACK_SPEED); double baseValue = attribute.getBaseValue(); if(baseValue != 4){ //If basevalue is not 1.9 default, set it back attribute.setBaseValue(4); player.saveData(); } }
/** * Gives an increased max health reward to a player. * * @param player * @param amount * @return the reward text to display to the player */ @SuppressWarnings("deprecation") private String rewardMaxHealth(Player player, int amount) { if (serverVersion >= 9) { AttributeInstance playerAttribute = player.getAttribute(Attribute.GENERIC_MAX_HEALTH); playerAttribute.setBaseValue(playerAttribute.getBaseValue() + amount); } else { player.setMaxHealth(player.getMaxHealth() + amount); } return ChatColor.translateAlternateColorCodes('&', StringUtils.replaceOnce(langIncreaseMaxHealthRewardReceived, "AMOUNT", Integer.toString(amount))); }
private void checkAttackSpeed(Player player){ World world = player.getWorld(); //If module is disabled, set attack speed to 1.9 default double attackSpeed = Config.moduleEnabled("disable-attack-cooldown", world) ? module().getDouble("generic-attack-speed") : 4; AttributeInstance attribute = player.getAttribute(Attribute.GENERIC_ATTACK_SPEED); double baseValue = attribute.getBaseValue(); if(baseValue != attackSpeed){ attribute.setBaseValue(attackSpeed); player.saveData(); } }
oldFoodLevel = player.getFoodLevel(); if (is1_9) { oldMaxHealth = player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue();
double baseValue = attribute.getBaseValue(); String message = "&1[OCM] &aAttack cooldown ";
if (knockbackResistance != null && livingTarget != null) { AttributeInstance knockBackAttribute = livingTarget.getAttribute(Attribute.GENERIC_KNOCKBACK_RESISTANCE); previousKnockbackResistance = knockBackAttribute.getBaseValue(); knockBackAttribute.setBaseValue(knockbackResistance);
tmhor.setHorseHealth(mh); tmhor.setHealth(h.getHealth()); tmhor.setSpeed(h.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).getBaseValue());
tmhor.setDomesticity(horse.getDomestication()); tmhor.setJumpStrength(horse.getJumpStrength()); tmhor.setSpeed(horse.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).getBaseValue()); tmlla.setDomesticity(llama.getDomestication()); tmlla.setJumpStrength(llama.getJumpStrength()); tmlla.setSpeed(llama.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).getBaseValue());
tmlla.setDomesticity(ll.getDomestication()); tmlla.setJumpStrength(ll.getJumpStrength()); tmlla.setSpeed(ll.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).getBaseValue());