Java Code Examples for org.bukkit.attribute.AttributeInstance#removeModifier()
The following examples show how to use
org.bukkit.attribute.AttributeInstance#removeModifier() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AttributeKit.java From PGM with GNU Affero General Public License v3.0 | 5 votes |
@Override public void remove(MatchPlayer player) { for (Map.Entry<String, AttributeModifier> entry : modifiers.entries()) { AttributeInstance attributeValue = player.getBukkit().getAttribute(Attribute.byName(entry.getKey())); if (attributeValue != null && attributeValue.getModifiers().contains(entry.getValue())) { attributeValue.removeModifier(entry.getValue()); } } }
Example 2
Source File: AttributePlayerFacet.java From ProjectAres with GNU Affero General Public License v3.0 | 5 votes |
private boolean removeModifier0(Attribute attribute, AttributeModifier modifier) { AttributeInstance attributeValue = player.getAttribute(attribute); if(attributeValue != null && attributeValue.getModifiers().contains(modifier)) { attributeValue.removeModifier(modifier); return true; } return false; }
Example 3
Source File: MatchPlayerImpl.java From PGM with GNU Affero General Public License v3.0 | 4 votes |
@Override public void reset() { getMatch().callEvent(new PlayerResetEvent(this)); setFrozen(false); Player bukkit = getBukkit(); bukkit.closeInventory(); resetInventory(); bukkit.setArrowsStuck(0); bukkit.setExhaustion(0); bukkit.setFallDistance(0); bukkit.setFireTicks(0); bukkit.setFoodLevel(20); // full bukkit.setHealth(bukkit.getMaxHealth()); bukkit.setLevel(0); bukkit.setExp(0); // clear xp bukkit.setSaturation(5); // default bukkit.setAllowFlight(false); bukkit.setFlying(false); bukkit.setSneaking(false); bukkit.setSprinting(false); bukkit.setFlySpeed(0.1f); bukkit.setKnockbackReduction(0); bukkit.setWalkSpeed(WalkSpeedKit.BUKKIT_DEFAULT); for (PotionEffect effect : bukkit.getActivePotionEffects()) { if (effect.getType() != null) { bukkit.removePotionEffect(effect.getType()); } } for (Attribute attribute : ATTRIBUTES) { AttributeInstance attributes = bukkit.getAttribute(attribute); if (attributes == null) continue; for (AttributeModifier modifier : attributes.getModifiers()) { attributes.removeModifier(modifier); } } NMSHacks.setAbsorption(bukkit, 0); // we only reset bed spawn here so people don't have to see annoying messages when they respawn bukkit.setBedSpawnLocation(null); }
Example 4
Source File: AttributeUtils.java From ProjectAres with GNU Affero General Public License v3.0 | 4 votes |
public static void removeModifier(Attributable attributable, AttributeModifier modifier) { for(Attribute attribute : Attribute.values()) { final AttributeInstance instance = attributable.getAttribute(attribute); if(instance != null) instance.removeModifier(modifier); } }