mirror of
https://github.com/Auxilor/Reforges.git
synced 2025-12-28 11:29:20 +00:00
Fixed several bugs
This commit is contained in:
@@ -4,7 +4,6 @@ import com.willfp.eco.core.EcoPlugin;
|
||||
import com.willfp.eco.core.display.Display;
|
||||
import com.willfp.eco.core.display.DisplayModule;
|
||||
import com.willfp.eco.core.display.DisplayPriority;
|
||||
import com.willfp.eco.core.fast.FastItemStack;
|
||||
import com.willfp.eco.util.SkullUtils;
|
||||
import com.willfp.reforges.reforges.Reforge;
|
||||
import com.willfp.reforges.reforges.meta.ReforgeTarget;
|
||||
@@ -41,12 +40,23 @@ public class ReforgesDisplay extends DisplayModule {
|
||||
|
||||
ItemMeta meta = itemStack.getItemMeta();
|
||||
assert meta != null;
|
||||
List<String> lore = meta.hasLore() ? meta.getLore() : new ArrayList<>();
|
||||
assert lore != null;
|
||||
|
||||
Reforge reforge = ReforgeUtils.getReforge(meta);
|
||||
Reforge stone = ReforgeUtils.getReforgeStone(meta);
|
||||
|
||||
FastItemStack fastItemStack = FastItemStack.wrap(itemStack);
|
||||
List<String> lore = fastItemStack.getLore();
|
||||
if (reforge == null && stone == null) {
|
||||
if (this.getPlugin().getConfigYml().getBool("reforge.show-reforgable")) {
|
||||
List<String> addLore = new ArrayList<>();
|
||||
|
||||
for (String string : this.getPlugin().getConfigYml().getStrings("reforge.reforgable-suffix")) {
|
||||
addLore.add(Display.PREFIX + string);
|
||||
}
|
||||
|
||||
lore.addAll(addLore);
|
||||
}
|
||||
}
|
||||
|
||||
if (stone != null) {
|
||||
meta.setDisplayName(this.getPlugin().getConfigYml().getString("reforge.stone.name").replace("%reforge%", stone.getName()));
|
||||
@@ -57,10 +67,6 @@ public class ReforgesDisplay extends DisplayModule {
|
||||
stoneLore.add(Display.PREFIX + string.replace("%reforge%", stone.getName()));
|
||||
}
|
||||
lore.addAll(0, stoneLore);
|
||||
} else {
|
||||
if (itemStack.getType() == Material.PLAYER_HEAD) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (reforge != null) {
|
||||
@@ -85,13 +91,7 @@ public class ReforgesDisplay extends DisplayModule {
|
||||
}
|
||||
}
|
||||
|
||||
if (reforge == null && this.getPlugin().getConfigYml().getBool("reforge.show-reforgable") && itemStack.getType() != Material.PLAYER_HEAD) {
|
||||
List<String> addLore = this.getPlugin().getConfigYml().getStrings("reforge.reforgable-suffix");
|
||||
|
||||
addLore.replaceAll(s -> Display.PREFIX + s);
|
||||
lore.addAll(addLore);
|
||||
}
|
||||
|
||||
fastItemStack.setLore(lore);
|
||||
meta.setLore(lore);
|
||||
itemStack.setItemMeta(meta);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,14 +7,11 @@ import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.attribute.AttributeModifier;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class ReforgeLight extends Reforge {
|
||||
private AttributeModifier speedModifier;
|
||||
private AttributeModifier kbModifier;
|
||||
@@ -26,18 +23,14 @@ public class ReforgeLight extends Reforge {
|
||||
@Override
|
||||
protected void postUpdate() {
|
||||
this.speedModifier = new AttributeModifier(
|
||||
UUID.nameUUIDFromBytes("light-speed".getBytes()),
|
||||
"light-speed",
|
||||
this.getConfig().getDouble(Reforges.CONFIG_LOCATION + "speed-multiplier") - 1,
|
||||
AttributeModifier.Operation.MULTIPLY_SCALAR_1,
|
||||
EquipmentSlot.HAND
|
||||
AttributeModifier.Operation.MULTIPLY_SCALAR_1
|
||||
);
|
||||
this.kbModifier = new AttributeModifier(
|
||||
UUID.nameUUIDFromBytes("light-kb".getBytes()),
|
||||
"light-kb",
|
||||
this.getConfig().getDouble(Reforges.CONFIG_LOCATION + "knockback-multiplier") - 1,
|
||||
AttributeModifier.Operation.MULTIPLY_SCALAR_1,
|
||||
EquipmentSlot.HAND
|
||||
AttributeModifier.Operation.MULTIPLY_SCALAR_1
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,14 +7,11 @@ import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.attribute.AttributeModifier;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class ReforgeStrong extends Reforge {
|
||||
private AttributeModifier kbModifier;
|
||||
|
||||
@@ -30,11 +27,9 @@ public class ReforgeStrong extends Reforge {
|
||||
@Override
|
||||
protected void postUpdate() {
|
||||
this.kbModifier = new AttributeModifier(
|
||||
UUID.nameUUIDFromBytes("strong-kb".getBytes()),
|
||||
"strong-kb",
|
||||
this.getConfig().getDouble(Reforges.CONFIG_LOCATION + "knockback-multiplier") - 1,
|
||||
AttributeModifier.Operation.MULTIPLY_SCALAR_1,
|
||||
EquipmentSlot.HAND
|
||||
AttributeModifier.Operation.MULTIPLY_SCALAR_1
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,6 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class ReforgeThin extends Reforge {
|
||||
private AttributeModifier speedModifier;
|
||||
|
||||
@@ -24,7 +22,6 @@ public class ReforgeThin extends Reforge {
|
||||
@Override
|
||||
protected void postUpdate() {
|
||||
this.speedModifier = new AttributeModifier(
|
||||
UUID.nameUUIDFromBytes("thin-speed".getBytes()),
|
||||
"thin-speed",
|
||||
this.getConfig().getDouble(Reforges.CONFIG_LOCATION + "speed-multiplier") - 1,
|
||||
AttributeModifier.Operation.MULTIPLY_SCALAR_1
|
||||
|
||||
@@ -12,8 +12,6 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class ReforgeTough extends Reforge {
|
||||
private AttributeModifier speedModifier;
|
||||
|
||||
@@ -24,7 +22,6 @@ public class ReforgeTough extends Reforge {
|
||||
@Override
|
||||
protected void postUpdate() {
|
||||
this.speedModifier = new AttributeModifier(
|
||||
UUID.nameUUIDFromBytes("tough-speed".getBytes()),
|
||||
"tough-speed",
|
||||
this.getConfig().getDouble(Reforges.CONFIG_LOCATION + "speed-multiplier") - 1,
|
||||
AttributeModifier.Operation.MULTIPLY_SCALAR_1
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
version = 1.0.0
|
||||
version = 1.0.1
|
||||
plugin-name = Reforges
|
||||
Reference in New Issue
Block a user