mirror of
https://github.com/Auxilor/Reforges.git
synced 2025-12-27 10:59:23 +00:00
Attribute changes
This commit is contained in:
@@ -13,27 +13,10 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ReforgeLight extends Reforge {
|
||||
private AttributeModifier speedModifier;
|
||||
private AttributeModifier kbModifier;
|
||||
|
||||
public ReforgeLight() {
|
||||
super("light");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void postUpdate() {
|
||||
this.speedModifier = new AttributeModifier(
|
||||
"light-speed",
|
||||
this.getConfig().getDouble(Reforges.CONFIG_LOCATION + "speed-multiplier") - 1,
|
||||
AttributeModifier.Operation.MULTIPLY_SCALAR_1
|
||||
);
|
||||
this.kbModifier = new AttributeModifier(
|
||||
"light-kb",
|
||||
this.getConfig().getDouble(Reforges.CONFIG_LOCATION + "knockback-multiplier") - 1,
|
||||
AttributeModifier.Operation.MULTIPLY_SCALAR_1
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReforgeTarget getTarget() {
|
||||
return ReforgeTarget.MELEE;
|
||||
@@ -51,8 +34,16 @@ public class ReforgeLight extends Reforge {
|
||||
ItemMeta meta = itemStack.getItemMeta();
|
||||
assert meta != null;
|
||||
|
||||
meta.addAttributeModifier(Attribute.GENERIC_ATTACK_SPEED, speedModifier);
|
||||
meta.addAttributeModifier(Attribute.GENERIC_ATTACK_KNOCKBACK, kbModifier);
|
||||
meta.addAttributeModifier(Attribute.GENERIC_ATTACK_SPEED, new AttributeModifier(
|
||||
"light-speed",
|
||||
this.getConfig().getDouble(Reforges.CONFIG_LOCATION + "speed-multiplier") - 1,
|
||||
AttributeModifier.Operation.MULTIPLY_SCALAR_1
|
||||
));
|
||||
meta.addAttributeModifier(Attribute.GENERIC_ATTACK_KNOCKBACK, new AttributeModifier(
|
||||
"light-kb",
|
||||
this.getConfig().getDouble(Reforges.CONFIG_LOCATION + "knockback-multiplier") - 1,
|
||||
AttributeModifier.Operation.MULTIPLY_SCALAR_1
|
||||
));
|
||||
meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
|
||||
itemStack.setItemMeta(meta);
|
||||
}
|
||||
@@ -62,8 +53,16 @@ public class ReforgeLight extends Reforge {
|
||||
ItemMeta meta = itemStack.getItemMeta();
|
||||
assert meta != null;
|
||||
|
||||
meta.removeAttributeModifier(Attribute.GENERIC_ATTACK_SPEED, speedModifier);
|
||||
meta.removeAttributeModifier(Attribute.GENERIC_ATTACK_KNOCKBACK, kbModifier);
|
||||
meta.removeAttributeModifier(Attribute.GENERIC_ATTACK_SPEED, new AttributeModifier(
|
||||
"light-speed",
|
||||
this.getConfig().getDouble(Reforges.CONFIG_LOCATION + "speed-multiplier") - 1,
|
||||
AttributeModifier.Operation.MULTIPLY_SCALAR_1
|
||||
));
|
||||
meta.removeAttributeModifier(Attribute.GENERIC_ATTACK_KNOCKBACK, new AttributeModifier(
|
||||
"light-kb",
|
||||
this.getConfig().getDouble(Reforges.CONFIG_LOCATION + "knockback-multiplier") - 1,
|
||||
AttributeModifier.Operation.MULTIPLY_SCALAR_1
|
||||
));
|
||||
itemStack.setItemMeta(meta);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,8 +13,6 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ReforgeStrong extends Reforge {
|
||||
private AttributeModifier kbModifier;
|
||||
|
||||
public ReforgeStrong() {
|
||||
super("strong");
|
||||
}
|
||||
@@ -24,15 +22,6 @@ public class ReforgeStrong extends Reforge {
|
||||
return ReforgeTarget.MELEE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void postUpdate() {
|
||||
this.kbModifier = new AttributeModifier(
|
||||
"strong-kb",
|
||||
this.getConfig().getDouble(Reforges.CONFIG_LOCATION + "knockback-multiplier") - 1,
|
||||
AttributeModifier.Operation.MULTIPLY_SCALAR_1
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMeleeAttack(@NotNull final LivingEntity attacker,
|
||||
@NotNull final LivingEntity victim,
|
||||
@@ -45,7 +34,11 @@ public class ReforgeStrong extends Reforge {
|
||||
ItemMeta meta = itemStack.getItemMeta();
|
||||
assert meta != null;
|
||||
|
||||
meta.addAttributeModifier(Attribute.GENERIC_ATTACK_KNOCKBACK, kbModifier);
|
||||
meta.addAttributeModifier(Attribute.GENERIC_ATTACK_KNOCKBACK, new AttributeModifier(
|
||||
"strong-kb",
|
||||
this.getConfig().getDouble(Reforges.CONFIG_LOCATION + "knockback-multiplier") - 1,
|
||||
AttributeModifier.Operation.MULTIPLY_SCALAR_1
|
||||
));
|
||||
meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
|
||||
itemStack.setItemMeta(meta);
|
||||
}
|
||||
@@ -55,7 +48,11 @@ public class ReforgeStrong extends Reforge {
|
||||
ItemMeta meta = itemStack.getItemMeta();
|
||||
assert meta != null;
|
||||
|
||||
meta.removeAttributeModifier(Attribute.GENERIC_ATTACK_KNOCKBACK, kbModifier);
|
||||
meta.removeAttributeModifier(Attribute.GENERIC_ATTACK_KNOCKBACK, new AttributeModifier(
|
||||
"strong-kb",
|
||||
this.getConfig().getDouble(Reforges.CONFIG_LOCATION + "knockback-multiplier") - 1,
|
||||
AttributeModifier.Operation.MULTIPLY_SCALAR_1
|
||||
));
|
||||
itemStack.setItemMeta(meta);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,21 +13,10 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ReforgeThin extends Reforge {
|
||||
private AttributeModifier speedModifier;
|
||||
|
||||
public ReforgeThin() {
|
||||
super("thin");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void postUpdate() {
|
||||
this.speedModifier = new AttributeModifier(
|
||||
"thin-speed",
|
||||
this.getConfig().getDouble(Reforges.CONFIG_LOCATION + "speed-multiplier") - 1,
|
||||
AttributeModifier.Operation.MULTIPLY_SCALAR_1
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReforgeTarget getTarget() {
|
||||
return ReforgeTarget.ARMOR;
|
||||
@@ -44,7 +33,11 @@ public class ReforgeThin extends Reforge {
|
||||
ItemMeta meta = itemStack.getItemMeta();
|
||||
assert meta != null;
|
||||
|
||||
meta.addAttributeModifier(Attribute.GENERIC_MOVEMENT_SPEED, speedModifier);
|
||||
meta.addAttributeModifier(Attribute.GENERIC_MOVEMENT_SPEED, new AttributeModifier(
|
||||
"thin-speed",
|
||||
this.getConfig().getDouble(Reforges.CONFIG_LOCATION + "speed-multiplier") - 1,
|
||||
AttributeModifier.Operation.MULTIPLY_SCALAR_1
|
||||
));
|
||||
meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
|
||||
itemStack.setItemMeta(meta);
|
||||
}
|
||||
@@ -54,7 +47,11 @@ public class ReforgeThin extends Reforge {
|
||||
ItemMeta meta = itemStack.getItemMeta();
|
||||
assert meta != null;
|
||||
|
||||
meta.removeAttributeModifier(Attribute.GENERIC_MOVEMENT_SPEED, speedModifier);
|
||||
meta.removeAttributeModifier(Attribute.GENERIC_MOVEMENT_SPEED, new AttributeModifier(
|
||||
"thin-speed",
|
||||
this.getConfig().getDouble(Reforges.CONFIG_LOCATION + "speed-multiplier") - 1,
|
||||
AttributeModifier.Operation.MULTIPLY_SCALAR_1
|
||||
));
|
||||
itemStack.setItemMeta(meta);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,21 +13,10 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ReforgeTough extends Reforge {
|
||||
private AttributeModifier speedModifier;
|
||||
|
||||
public ReforgeTough() {
|
||||
super("tough");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void postUpdate() {
|
||||
this.speedModifier = new AttributeModifier(
|
||||
"tough-speed",
|
||||
this.getConfig().getDouble(Reforges.CONFIG_LOCATION + "speed-multiplier") - 1,
|
||||
AttributeModifier.Operation.MULTIPLY_SCALAR_1
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReforgeTarget getTarget() {
|
||||
return ReforgeTarget.ARMOR;
|
||||
@@ -44,7 +33,11 @@ public class ReforgeTough extends Reforge {
|
||||
ItemMeta meta = itemStack.getItemMeta();
|
||||
assert meta != null;
|
||||
|
||||
meta.addAttributeModifier(Attribute.GENERIC_MOVEMENT_SPEED, speedModifier);
|
||||
meta.addAttributeModifier(Attribute.GENERIC_MOVEMENT_SPEED, new AttributeModifier(
|
||||
"tough-speed",
|
||||
this.getConfig().getDouble(Reforges.CONFIG_LOCATION + "speed-multiplier") - 1,
|
||||
AttributeModifier.Operation.MULTIPLY_SCALAR_1
|
||||
));
|
||||
meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
|
||||
itemStack.setItemMeta(meta);
|
||||
}
|
||||
@@ -54,7 +47,11 @@ public class ReforgeTough extends Reforge {
|
||||
ItemMeta meta = itemStack.getItemMeta();
|
||||
assert meta != null;
|
||||
|
||||
meta.removeAttributeModifier(Attribute.GENERIC_MOVEMENT_SPEED, speedModifier);
|
||||
meta.removeAttributeModifier(Attribute.GENERIC_MOVEMENT_SPEED, new AttributeModifier(
|
||||
"tough-speed",
|
||||
this.getConfig().getDouble(Reforges.CONFIG_LOCATION + "speed-multiplier") - 1,
|
||||
AttributeModifier.Operation.MULTIPLY_SCALAR_1
|
||||
));
|
||||
itemStack.setItemMeta(meta);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user