1 Commits
V1.0 ... V1.1

Author SHA1 Message Date
0f2c4a81db V1.1 2025-08-11 02:03:40 +02:00
3 changed files with 50 additions and 19 deletions

View File

@@ -1,10 +1,56 @@
package com.kasetoatz.superArmor;
import org.bukkit.enchantments.Enchantment;
import java.util.Map;
public class Multiplier
{
public int item;
public int book;
public static final Map<Enchantment, Multiplier> multipliers = Map.ofEntries(
Map.entry(Enchantment.PROTECTION, new Multiplier(1, 1)),
Map.entry(Enchantment.FIRE_PROTECTION, new Multiplier(2, 1)),
Map.entry(Enchantment.FEATHER_FALLING, new Multiplier(2, 1)),
Map.entry(Enchantment.BLAST_PROTECTION, new Multiplier(4, 2)),
Map.entry(Enchantment.PROJECTILE_PROTECTION, new Multiplier(2, 1)),
Map.entry(Enchantment.THORNS, new Multiplier(8, 4)),
Map.entry(Enchantment.RESPIRATION, new Multiplier(4, 2)),
Map.entry(Enchantment.DEPTH_STRIDER, new Multiplier(4, 2)),
Map.entry(Enchantment.AQUA_AFFINITY, new Multiplier(4, 2)),
Map.entry(Enchantment.SHARPNESS, new Multiplier(1, 1)),
Map.entry(Enchantment.SMITE, new Multiplier(2, 1)),
Map.entry(Enchantment.BANE_OF_ARTHROPODS, new Multiplier(2, 1)),
Map.entry(Enchantment.KNOCKBACK, new Multiplier(2, 1)),
Map.entry(Enchantment.FIRE_ASPECT, new Multiplier(4, 2)),
Map.entry(Enchantment.LOOTING, new Multiplier(4, 2)),
Map.entry(Enchantment.EFFICIENCY, new Multiplier(1, 1)),
Map.entry(Enchantment.SILK_TOUCH, new Multiplier(8, 4)),
Map.entry(Enchantment.UNBREAKING, new Multiplier(2, 1)),
Map.entry(Enchantment.FORTUNE, new Multiplier(4, 2)),
Map.entry(Enchantment.POWER, new Multiplier(1, 1)),
Map.entry(Enchantment.PUNCH, new Multiplier(4, 2)),
Map.entry(Enchantment.FLAME, new Multiplier(4, 2)),
Map.entry(Enchantment.INFINITY, new Multiplier(8, 4)),
Map.entry(Enchantment.LUCK_OF_THE_SEA, new Multiplier(4, 2)),
Map.entry(Enchantment.LURE, new Multiplier(4, 2)),
Map.entry(Enchantment.FROST_WALKER, new Multiplier(4, 2)),
Map.entry(Enchantment.MENDING, new Multiplier(4, 2)),
Map.entry(Enchantment.IMPALING, new Multiplier(2, 1)),
Map.entry(Enchantment.RIPTIDE, new Multiplier(4, 2)),
Map.entry(Enchantment.LOYALTY, new Multiplier(1, 1)),
Map.entry(Enchantment.CHANNELING, new Multiplier(8, 4)),
Map.entry(Enchantment.MULTISHOT, new Multiplier(4, 2)),
Map.entry(Enchantment.PIERCING, new Multiplier(1, 1)),
Map.entry(Enchantment.QUICK_CHARGE, new Multiplier(2, 1)),
Map.entry(Enchantment.SWEEPING_EDGE, new Multiplier(4, 2)),
Map.entry(Enchantment.SWIFT_SNEAK, new Multiplier(8, 4)),
Map.entry(Enchantment.SOUL_SPEED, new Multiplier(8, 4)),
Map.entry(Enchantment.BINDING_CURSE, new Multiplier(8, 4)),
Map.entry(Enchantment.VANISHING_CURSE, new Multiplier(8, 4))
);
public Multiplier(int item, int book)
{
this.item = item;

View File

@@ -17,24 +17,9 @@ import org.bukkit.plugin.java.JavaPlugin;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
public final class SuperArmor extends JavaPlugin implements Listener {
private final Map<Enchantment, Multiplier> multipliers = Map.ofEntries(
Map.entry(Enchantment.MENDING, new Multiplier(4, 2)),
Map.entry(Enchantment.UNBREAKING, new Multiplier(2, 1)),
Map.entry(Enchantment.THORNS, new Multiplier(8, 4)),
Map.entry(Enchantment.RESPIRATION, new Multiplier(4, 2)),
Map.entry(Enchantment.AQUA_AFFINITY, new Multiplier(4, 2)),
Map.entry(Enchantment.SWIFT_SNEAK, new Multiplier(8, 4)),
Map.entry(Enchantment.FEATHER_FALLING, new Multiplier(2, 1)),
Map.entry(Enchantment.SOUL_SPEED, new Multiplier(8, 4)),
Map.entry(Enchantment.PROTECTION, new Multiplier(1, 1)),
Map.entry(Enchantment.PROJECTILE_PROTECTION, new Multiplier(2, 1)),
Map.entry(Enchantment.FIRE_PROTECTION, new Multiplier(2, 1)),
Map.entry(Enchantment.BLAST_PROTECTION, new Multiplier(4, 2)),
Map.entry(Enchantment.DEPTH_STRIDER, new Multiplier(4, 2)),
Map.entry(Enchantment.FROST_WALKER, new Multiplier(4, 2))
);
import static com.kasetoatz.superArmor.Multiplier.multipliers;
public final class SuperArmor extends JavaPlugin implements Listener {
@Override
public void onEnable()
{
@@ -141,7 +126,7 @@ public final class SuperArmor extends JavaPlugin implements Listener {
ItemStack result = left.clone();
boolean repair = false;
getEnchants(right).forEach((enchant, level) -> {
if (isProtection(enchant))
if (isValidEnchant(left, enchant))
{
if (result.getItemMeta() instanceof EnchantmentStorageMeta meta)
{

View File

@@ -1,4 +1,4 @@
name: SuperArmor
version: '1.0'
version: '1.1'
main: com.kasetoatz.superArmor.SuperArmor
api-version: '1.21'