Fix duplicate enchants
This commit is contained in:
@@ -4,7 +4,7 @@ plugins {
|
||||
}
|
||||
|
||||
group = 'com.kasetoatz'
|
||||
version = '1.0'
|
||||
version = '1.2'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
@@ -23,7 +23,7 @@ tasks {
|
||||
// Configure the Minecraft version for our task.
|
||||
// This is the only required configuration besides applying the plugin.
|
||||
// Your plugin's jar (or shadowJar if present) will be used automatically.
|
||||
minecraftVersion("1.21")
|
||||
minecraftVersion("1.21.8")
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -15,6 +15,8 @@ import org.bukkit.inventory.view.AnvilView;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import static com.kasetoatz.superArmor.Multiplier.multipliers;
|
||||
@@ -128,6 +130,10 @@ public final class SuperArmor extends JavaPlugin implements Listener {
|
||||
getEnchants(right).forEach((enchant, level) -> {
|
||||
if (isValidEnchant(left, enchant))
|
||||
{
|
||||
if (Objects.equals(getEnchants(left).getOrDefault(enchant, -1), level))
|
||||
{
|
||||
level = Math.min(enchant.getMaxLevel(), level + 1);
|
||||
}
|
||||
if (result.getItemMeta() instanceof EnchantmentStorageMeta meta)
|
||||
{
|
||||
meta.addStoredEnchant(enchant, level, true);
|
||||
|
@@ -1,4 +1,4 @@
|
||||
name: SuperArmor
|
||||
version: '1.1'
|
||||
version: '1.2'
|
||||
main: com.kasetoatz.superArmor.SuperArmor
|
||||
api-version: '1.21'
|
||||
|
Reference in New Issue
Block a user