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