mirror of
https://github.com/Auxilor/EcoArmor.git
synced 2025-12-28 03:19:25 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -26,6 +26,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class Tier extends PluginDependent {
|
||||
/**
|
||||
@@ -47,9 +48,9 @@ public class Tier extends PluginDependent {
|
||||
private String displayName;
|
||||
|
||||
/**
|
||||
* The name of the tier required for application.
|
||||
* The names of the tiers required for application.
|
||||
*/
|
||||
private String requiredTierForApplication;
|
||||
private List<String> requiredTiersForApplication;
|
||||
|
||||
/**
|
||||
* If the crafting recipe is enabled.
|
||||
@@ -102,7 +103,7 @@ public class Tier extends PluginDependent {
|
||||
public void update() {
|
||||
this.enabled = this.getConfig().getBool("crystal-craftable");
|
||||
this.displayName = this.getConfig().getString("display");
|
||||
this.requiredTierForApplication = this.getConfig().getString("requires-tier");
|
||||
this.requiredTiersForApplication = this.getConfig().getStrings("requires-tiers");
|
||||
NamespacedKey key = this.getPlugin().getNamespacedKeyFactory().create("upgrade_crystal");
|
||||
|
||||
ItemStack out = new ItemStack(Objects.requireNonNull(Material.getMaterial(this.getPlugin().getConfigYml().getString("upgrade-crystal-material").toUpperCase())));
|
||||
@@ -163,13 +164,12 @@ public class Tier extends PluginDependent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the required tier for application.
|
||||
* Get the required tiers for application.
|
||||
*
|
||||
* @return The tier, or null if 'none' or invalid.
|
||||
* @return The tiers, or a blank list if always available.
|
||||
*/
|
||||
@Nullable
|
||||
public Tier getRequiredTierForApplication() {
|
||||
return Tiers.getByName(requiredTierForApplication);
|
||||
public List<Tier> getRequiredTiersForApplication() {
|
||||
return requiredTiersForApplication.stream().map(Tiers::getByName).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,6 +12,8 @@ import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CrystalListener extends PluginDependent implements Listener {
|
||||
/**
|
||||
* Create new listeners for dragging crystals onto items.
|
||||
@@ -48,11 +50,11 @@ public class CrystalListener extends PluginDependent implements Listener {
|
||||
|
||||
Tier previousTier = ArmorUtils.getTier(current);
|
||||
boolean allowed = false;
|
||||
Tier prereq = crystalTier.getRequiredTierForApplication();
|
||||
List<Tier> prereq = crystalTier.getRequiredTiersForApplication();
|
||||
|
||||
if (prereq == null) {
|
||||
if (prereq.isEmpty()) {
|
||||
allowed = true;
|
||||
} else if (prereq.equals(previousTier)) {
|
||||
} else if (prereq.contains(previousTier)) {
|
||||
allowed = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
enabled: true
|
||||
display: "/ab&lCOBALT"
|
||||
requires-tier: iron # Set to 'none' to always allow application
|
||||
requires-tiers: # Leave empty to always allow application
|
||||
- iron
|
||||
crystal-craftable: true
|
||||
crystal-name: "/abCobalt Upgrade Crystal"
|
||||
crystal-recipe:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
display: "&8&lDEFAULT"
|
||||
requires-tier: none # Set to 'none' to always allow application
|
||||
requires-tiers: [] # Leave empty to always allow application
|
||||
crystal-craftable: false
|
||||
crystal-name: "&8Default Upgrade Crystal"
|
||||
crystal-recipe:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
enabled: true
|
||||
display: "&b&lDIAMOND"
|
||||
requires-tier: iron # Set to 'none' to always allow application
|
||||
requires-tiers: # Leave empty to always allow application
|
||||
- iron
|
||||
crystal-craftable: true
|
||||
crystal-name: "&bDiamond Upgrade Crystal"
|
||||
crystal-recipe:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
enabled: true
|
||||
display: "&6&k!!&r <GRADIENT:f79d00>&lEXOTIC</GRADIENT:64f38c>&r &6&k!!&r"
|
||||
requires-tier: netherite # Set to 'none' to always allow application
|
||||
requires-tiers: # Leave empty to always allow application
|
||||
- netherite
|
||||
crystal-craftable: true
|
||||
crystal-name: "<GRADIENT:f79d00>Exotic Upgrade Crystal</GRADIENT:64f38c>"
|
||||
crystal-recipe:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
enabled: true
|
||||
display: "&7&lIRON"
|
||||
requires-tier: default # Set to 'none' to always allow application
|
||||
requires-tiers: # Leave empty to always allow application
|
||||
- default
|
||||
crystal-craftable: true
|
||||
crystal-name: "&7Iron Upgrade Crystal"
|
||||
crystal-recipe:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
enabled: true
|
||||
display: "&d&k!!&r <GRADIENT:f953c6>&lMANYULLYN</GRADIENT:b91d73>&r &d&k!!&r"
|
||||
requires-tier: netherite # Set to 'none' to always allow application
|
||||
requires-tiers: # Leave empty to always allow application
|
||||
- netherite
|
||||
crystal-craftable: true
|
||||
crystal-name: "<GRADIENT:f953c6>Manyullyn Upgrade Crystal</GRADIENT:b91d73>"
|
||||
crystal-recipe:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
enabled: true
|
||||
display: "&c&lNETHERITE"
|
||||
requires-tier: diamond # Set to 'none' to always allow application
|
||||
requires-tiers: # Leave empty to always allow application
|
||||
- diamond
|
||||
crystal-craftable: true
|
||||
crystal-name: "&cNetherite Upgrade Crystal"
|
||||
crystal-recipe:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
enabled: true
|
||||
display: "&b&k!!&r <GRADIENT:c7f1ff>&lOSMIUM</GRADIENT:5c92ff>&r &b&k!!"
|
||||
requires-tier: cobalt # Set to 'none' to always allow application
|
||||
requires-tiers: # Leave empty to always allow application
|
||||
- cobalt
|
||||
crystal-craftable: true
|
||||
crystal-name: "<GRADIENT:c7f1ff>Osmium upgrade crystal</GRADIENT:5c92ff>"
|
||||
crystal-recipe:
|
||||
|
||||
Reference in New Issue
Block a user