9
0
mirror of https://github.com/Auxilor/EcoArmor.git synced 2025-12-27 10:59:22 +00:00

Added miner armor

This commit is contained in:
Auxilor
2021-01-20 10:39:18 +00:00
parent e6c7c77eaa
commit c296b339c7
4 changed files with 256 additions and 1 deletions

View File

@@ -15,6 +15,7 @@ import com.willfp.ecoarmor.effects.Effect;
import com.willfp.ecoarmor.effects.Effects;
import com.willfp.ecoarmor.sets.ArmorSets;
import com.willfp.ecoarmor.sets.util.EffectiveDurabilityListener;
import com.willfp.ecoarmor.sets.util.PotionEffectListener;
import com.willfp.ecoarmor.upgrades.advanced.AdvancementShardListener;
import com.willfp.ecoarmor.upgrades.crystal.CrystalListener;
import com.willfp.ecoarmor.upgrades.crystal.UpgradeCrystal;
@@ -130,6 +131,7 @@ public class EcoArmorPlugin extends AbstractEcoPlugin {
return Arrays.asList(
new CrystalListener(this),
new AdvancementShardListener(this),
new PotionEffectListener(this),
new EffectiveDurabilityListener(this)
);
}

View File

@@ -65,6 +65,12 @@ public class ArmorSet {
@Getter
private final Map<PotionEffectType, Integer> potionEffects = new HashMap<>();
/**
* Potion effects to be applied on equipping advanced.
*/
@Getter
private final Map<PotionEffectType, Integer> advancedPotionEffects = new HashMap<>();
/**
* Items in set.
*/
@@ -101,6 +107,22 @@ public class ArmorSet {
advancedEffects.put(effect, value);
}
if (EcoArmorConfigs.SETS.getConfig().getConfigurationSection(name + ".potion-effects") != null) {
for (String effectName : EcoArmorConfigs.SETS.getConfig().getConfigurationSection(name + ".potion-effects").getKeys(false)) {
PotionEffectType type = PotionEffectType.getByName(effectName.toUpperCase());
int strength = EcoArmorConfigs.SETS.getInt(name + ".potion-effects." + effectName);
potionEffects.put(type, strength);
}
}
if (EcoArmorConfigs.SETS.getConfig().getConfigurationSection(name + ".advanced-potion-effects") != null) {
for (String effectName : EcoArmorConfigs.SETS.getConfig().getConfigurationSection(name + ".advanced-potion-effects").getKeys(false)) {
PotionEffectType type = PotionEffectType.getByName(effectName.toUpperCase());
int strength = EcoArmorConfigs.SETS.getInt(name + ".advanced-potion-effects." + effectName);
advancedPotionEffects.put(type, strength);
}
}
for (ArmorSlot slot : ArmorSlot.values()) {
ItemStack item = construct(slot.name().toLowerCase(), false);
items.put(slot, item);

View File

@@ -0,0 +1,55 @@
package com.willfp.ecoarmor.sets.util;
import com.willfp.eco.util.events.armorequip.ArmorEquipEvent;
import com.willfp.eco.util.internal.PluginDependent;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.ecoarmor.sets.ArmorSet;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.potion.PotionEffect;
import org.jetbrains.annotations.NotNull;
public class PotionEffectListener extends PluginDependent implements Listener {
/**
* Create new potion effect listener for set effects.
*
* @param plugin EcoArmor.
*/
public PotionEffectListener(@NotNull final AbstractEcoPlugin plugin) {
super(plugin);
}
/**
* Apply set potion effects.
*
* @param event The event to listen for.
*/
@EventHandler
public void onEquip(@NotNull final ArmorEquipEvent event) {
final Player player = event.getPlayer();
this.getPlugin().getScheduler().runLater(() -> {
for (PotionEffect effect : player.getActivePotionEffects()) {
if (effect.getDuration() >= 500000000) {
player.removePotionEffect(effect.getType());
}
}
ArmorSet set = ArmorUtils.getSetOnPlayer(player);
if (set == null) {
return;
}
set.getPotionEffects().forEach((potionEffectType, integer) -> {
player.addPotionEffect(new PotionEffect(potionEffectType, 0x6fffffff, integer - 1, false, false, true));
});
if (ArmorUtils.isAdvanced(player)) {
set.getAdvancedPotionEffects().forEach((potionEffectType, integer) -> {
player.addPotionEffect(new PotionEffect(potionEffectType, 0x6fffffff, integer - 1, false, false, true));
});
}
}, 1);
}
}

View File

@@ -1,4 +1,180 @@
Reaper:
miner:
set-bonus:
experience-multiplier: 1.25
advanced-set-bonus:
hunger-loss-multiplier: 0.5
potion-effects:
haste: 2
advanced-potion-effects:
haste: 3
advanced-lore:
- ""
- "<\$#f12711>&lADVANCED BONUS<\$#f5af19>"
- "&8» &6Lose 50% less hunger"
- "&8» &6Permanent Haste III"
- "&8&oRequires full set to be worn"
advancement-shard-name: "<\$#f12711>Advancement Shard:<\$#f5af19> &9Miner"
advancement-shard-lore:
- "&8Drop this onto &9Miner Armor"
- "&8to make it <\$#f12711>Advanced<\$#f5af19>."
shard-craftable: true
shard-recipe:
- prismarine_shard
- ecoarmor:set_miner_helmet
- prismarine_shard
- ecoarmor:set_miner_chestplate
- nether_star
- ecoarmor:set_miner_leggings
- prismarine_shard
- ecoarmor:set_miner_boots
- prismarine_shard
helmet:
enchants:
fire_protection: 4
unbreaking: 1
material: leather_helmet
leather-color: "#6699cc"
name: "&9Miner Helmet"
advanced-name: "<\$#f12711>Advanced<\$#f5af19>&9 Miner Helmet"
effective-durability: 1024
lore:
- "&9&lMINER SET BONUS"
- "&8» &9Gain 50% more experience"
- "&8» &9Permanent Haste II"
- "&8&oRequires full set to be worn"
- ""
- "&fTier: %tier%"
- "&8&oUpgrade with an Upgrade Crystal"
recipe:
- air
- diamond_pickaxe
- air
- diamond_pickaxe
- diamond_helmet
- diamond_pickaxe
- air
- diamond_pickaxe
- air
chestplate:
enchants:
fire_protection: 4
unbreaking: 1
material: leather_chestplate
leather-color: "#6699cc"
name: "&9Miner Chestplate"
advanced-name: "<\$#f12711>Advanced<\$#f5af19>&9 Miner Chestplate"
effective-durability: 1024
lore:
- "&9&lMINER SET BONUS"
- "&8» &9Gain 50% more experience"
- "&8» &9Permanent Haste II"
- "&8&oRequires full set to be worn"
- ""
- "&fTier: %tier%"
- "&8&oUpgrade with an Upgrade Crystal"
recipe:
- air
- diamond_pickaxe
- air
- diamond_pickaxe
- diamond_chestplate
- diamond_pickaxe
- air
- diamond_pickaxe
- air
elytra:
enchants:
unbreaking: 1
material: elytra
name: "&9Miner Elytra"
advanced-name: "<\$#f12711>Advanced<\$#f5af19>&9 Miner Elytra"
effective-durability: 1024
lore:
- "&9&lMINER SET BONUS"
- "&8» &9Gain 50% more experience"
- "&8» &9Permanent Haste II"
- "&8&oRequires full set to be worn"
- ""
- "&fTier: %tier%"
- "&8&oUpgrade with an Upgrade Crystal"
recipe:
- air
- diamond_pickaxe
- air
- diamond_pickaxe
- elytra
- diamond_pickaxe
- air
- diamond_pickaxe
- air
leggings:
enchants:
fire_protection: 4
unbreaking: 1
material: leather_leggings
leather-color: "#6699cc"
name: "&9Miner Leggings"
advanced-name: "<\$#f12711>Advanced<\$#f5af19>&9 Miner Leggings"
effective-durability: 1024
lore:
- "&9&lMINER SET BONUS"
- "&8» &9Gain 50% more experience"
- "&8» &9Permanent Haste II"
- "&8&oRequires full set to be worn"
- ""
- "&fTier: %tier%"
- "&8&oUpgrade with an Upgrade Crystal"
recipe:
- air
- diamond_pickaxe
- air
- diamond_pickaxe
- diamond_leggings
- diamond_pickaxe
- air
- diamond_pickaxe
- air
boots:
enchants:
fire_protection: 4
unbreaking: 1
material: leather_boots
leather-color: "#6699cc"
name: "&9Miner Boots"
advanced-name: "<\$#f12711>Advanced<\$#f5af19>&9 Miner Boots"
effective-durability: 1024
lore:
- "&9&lMINER SET BONUS"
- "&8» &9Gain 50% more experience"
- "&8» &9Permanent Haste II"
- "&8&oRequires full set to be worn"
- ""
- "&fTier: %tier%"
- "&8&oUpgrade with an Upgrade Crystal"
recipe:
- air
- diamond_pickaxe
- air
- diamond_pickaxe
- diamond_boots
- diamond_pickaxe
- air
- diamond_pickaxe
- air
reaper:
set-bonus:
damage-multiplier: 1.25
advanced-set-bonus: