Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
7e828a42b0 | ||
0f2c4a81db |
@@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -15,26 +15,13 @@ 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;
|
||||
|
||||
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,8 +128,12 @@ 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 (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.0'
|
||||
version: '1.2'
|
||||
main: com.kasetoatz.superArmor.SuperArmor
|
||||
api-version: '1.21'
|
||||
|
Reference in New Issue
Block a user