mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-11-25 15:35:11 +01:00
Updated to eco 6.19.0
This commit is contained in:
parent
71483fbca0
commit
cf41a467da
@ -55,7 +55,7 @@ allprojects {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly 'com.willfp:eco:6.17.1'
|
||||
compileOnly 'com.willfp:eco:6.19.0'
|
||||
implementation 'com.willfp:libreforge:3.0.0'
|
||||
|
||||
compileOnly 'org.jetbrains:annotations:19.0.0'
|
||||
|
@ -255,7 +255,7 @@ public abstract class EcoEnchant extends Enchantment implements Listener, Watche
|
||||
availableFromLoot = config.getBool(EcoEnchants.OBTAINING_LOCATION + "loot");
|
||||
maxLevel = config.getInt(EcoEnchants.GENERAL_LOCATION + "maximum-level", 1);
|
||||
displayName = config.getFormattedString("name");
|
||||
description = config.getString("description", false);
|
||||
description = config.getString("description");
|
||||
disabledWorldNames.clear();
|
||||
disabledWorldNames.addAll(config.getStrings(EcoEnchants.GENERAL_LOCATION + "disabled-in-worlds"));
|
||||
disabledWorlds.clear();
|
||||
@ -273,7 +273,7 @@ public abstract class EcoEnchant extends Enchantment implements Listener, Watche
|
||||
flags.clear();
|
||||
flags.addAll(config.getStrings(EcoEnchants.GENERAL_LOCATION + "flags"));
|
||||
EnchantmentUtils.registerPlaceholders(this);
|
||||
for (String req : config.getStrings(EcoEnchants.GENERAL_LOCATION + "requirements.list", false)) {
|
||||
for (String req : config.getStrings(EcoEnchants.GENERAL_LOCATION + "requirements.list")) {
|
||||
List<String> split = Arrays.asList(req.split(":"));
|
||||
if (split.size() < 2) {
|
||||
continue;
|
||||
@ -284,7 +284,7 @@ public abstract class EcoEnchant extends Enchantment implements Listener, Watche
|
||||
this.requirements.put(requirement, split.subList(1, split.size()));
|
||||
}
|
||||
requirementLore.clear();
|
||||
requirementLore.addAll(config.getStrings(EcoEnchants.GENERAL_LOCATION + "requirements.not-met-lore", false));
|
||||
requirementLore.addAll(config.getStrings(EcoEnchants.GENERAL_LOCATION + "requirements.not-met-lore"));
|
||||
|
||||
postUpdate();
|
||||
this.register();
|
||||
|
@ -53,7 +53,7 @@ public class Arborist extends EcoEnchant {
|
||||
|
||||
List<Material> materials = new ArrayList<>();
|
||||
|
||||
for (String materialName : this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "items", false)) {
|
||||
for (String materialName : this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "items")) {
|
||||
Material material = Material.getMaterial(materialName.toUpperCase());
|
||||
if (material != null) {
|
||||
materials.add(material);
|
||||
|
@ -60,7 +60,7 @@ public class BlastMining extends EcoEnchant {
|
||||
}
|
||||
Block block1 = block.getWorld().getBlockAt(block.getLocation().clone().add(x, y, z));
|
||||
|
||||
if (this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blacklisted-blocks", false).contains(block1.getType().name().toLowerCase())) {
|
||||
if (this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blacklisted-blocks").contains(block1.getType().name().toLowerCase())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ public class Drill extends EcoEnchant {
|
||||
Block block1 = block.getWorld().getBlockAt(block.getLocation().clone().add(simplified));
|
||||
block1.setMetadata("block-ignore", this.getPlugin().getMetadataValueFactory().create(true));
|
||||
|
||||
if (this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blacklisted-blocks", false).contains(block1.getType().name().toLowerCase())) {
|
||||
if (this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blacklisted-blocks").contains(block1.getType().name().toLowerCase())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ public class Instantaneous extends EcoEnchant {
|
||||
|
||||
List<Material> blacklist = new ArrayList<>();
|
||||
|
||||
for (String s : this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blacklisted-blocks", false)) {
|
||||
for (String s : this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blacklisted-blocks")) {
|
||||
blacklist.add(Material.getMaterial(s));
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ public class Lumberjack extends EcoEnchant {
|
||||
@Override
|
||||
protected void postUpdate() {
|
||||
materials = new ArrayList<>();
|
||||
for (String string : this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "whitelisted-blocks", false)) {
|
||||
for (String string : this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "whitelisted-blocks")) {
|
||||
Material match = Material.getMaterial(string.toUpperCase());
|
||||
if (match != null) {
|
||||
materials.add(match);
|
||||
|
@ -72,7 +72,7 @@ public class Spearfishing extends EcoEnchant {
|
||||
}
|
||||
|
||||
List<Material> potentialDrops = new ArrayList<>();
|
||||
this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "drops", false).forEach(material -> {
|
||||
this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "drops").forEach(material -> {
|
||||
potentialDrops.add(Material.getMaterial(material.toUpperCase()));
|
||||
});
|
||||
|
||||
|
@ -39,7 +39,7 @@ public class Transfuse extends EcoEnchant {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "works-on", false).contains(block.getType().toString().toLowerCase())) {
|
||||
if (!this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "works-on").contains(block.getType().toString().toLowerCase())) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -47,10 +47,10 @@ public class Transfuse extends EcoEnchant {
|
||||
|
||||
Material material;
|
||||
double random = NumberUtils.randFloat(0, 1);
|
||||
double band = 1 / (double) this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks", false).size();
|
||||
double band = 1 / (double) this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks").size();
|
||||
int selectedIndex = (int) Math.floor(random / band);
|
||||
selectedIndex = NumberUtils.equalIfOver(selectedIndex, this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks", false).size() - 1);
|
||||
String materialName = this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks", false).get(selectedIndex);
|
||||
selectedIndex = Math.min(selectedIndex, this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks").size() - 1);
|
||||
String materialName = this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks").get(selectedIndex);
|
||||
material = Material.getMaterial(materialName.toUpperCase());
|
||||
if (material == null) {
|
||||
material = Material.COBBLESTONE;
|
||||
|
@ -40,7 +40,7 @@ public class Vein extends EcoEnchant {
|
||||
List<Material> materials = Collections.singletonList(block.getType());
|
||||
|
||||
if (!this.getConfig()
|
||||
.getStrings(EcoEnchants.CONFIG_LOCATION + "whitelisted-blocks", false)
|
||||
.getStrings(EcoEnchants.CONFIG_LOCATION + "whitelisted-blocks")
|
||||
.contains(block.getType().toString().toLowerCase())) {
|
||||
return;
|
||||
}
|
||||
|
@ -48,10 +48,10 @@ public class WoodSwitcher extends EcoEnchant {
|
||||
|
||||
Material material;
|
||||
double random = NumberUtils.randFloat(0, 1);
|
||||
double band = 1 / (double) this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks", false).size();
|
||||
double band = 1 / (double) this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks").size();
|
||||
int selectedIndex = (int) Math.floor(random / band);
|
||||
selectedIndex = NumberUtils.equalIfOver(selectedIndex, this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks", false).size() - 1);
|
||||
String materialName = this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks", false).get(selectedIndex);
|
||||
selectedIndex = Math.min(selectedIndex, this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks").size() - 1);
|
||||
String materialName = this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks").get(selectedIndex);
|
||||
material = Material.getMaterial(materialName.toUpperCase());
|
||||
|
||||
if (material == null) {
|
||||
|
@ -55,7 +55,7 @@ public class Dynamite extends Spell {
|
||||
}
|
||||
Block block1 = block.getWorld().getBlockAt(block.getLocation().clone().add(x, y, z));
|
||||
|
||||
if (this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blacklisted-blocks", false).contains(block1.getType().name().toLowerCase())) {
|
||||
if (this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blacklisted-blocks").contains(block1.getType().name().toLowerCase())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ public abstract class Artifact extends EcoEnchant {
|
||||
@NotNull final Block block,
|
||||
final int level,
|
||||
@NotNull final BlockBreakEvent event) {
|
||||
if (!this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "on-blocks", false).contains(block.getType().name().toLowerCase())) {
|
||||
if (!this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "on-blocks").contains(block.getType().name().toLowerCase())) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ public class EnchantmentRarity {
|
||||
double lootProbability = rarityYml.getDouble("rarities." + rarity + ".loot-probability");
|
||||
String customColor = null;
|
||||
if (rarityYml.getBool("rarities." + rarity + ".custom-color.enabled")) {
|
||||
customColor = rarityYml.getString("rarities." + rarity + ".custom-color.color", false);
|
||||
customColor = rarityYml.getString("rarities." + rarity + ".custom-color.color");
|
||||
}
|
||||
|
||||
new EnchantmentRarity(rarity, probability, minimumLevel, villagerProbability, lootProbability, customColor).register();
|
||||
|
@ -35,7 +35,7 @@ public class EnchantmentType {
|
||||
public static final EnchantmentType NORMAL = new EnchantmentType(
|
||||
"normal",
|
||||
false,
|
||||
() -> PLUGIN.getLangYml().getString("normal-color", false)
|
||||
() -> PLUGIN.getLangYml().getString("normal-color")
|
||||
);
|
||||
|
||||
/**
|
||||
@ -46,7 +46,7 @@ public class EnchantmentType {
|
||||
public static final EnchantmentType CURSE = new EnchantmentType(
|
||||
"curse",
|
||||
false,
|
||||
() -> PLUGIN.getLangYml().getString("curse-color", false)
|
||||
() -> PLUGIN.getLangYml().getString("curse-color")
|
||||
);
|
||||
|
||||
/**
|
||||
@ -57,7 +57,7 @@ public class EnchantmentType {
|
||||
public static final EnchantmentType SPECIAL = new EnchantmentType(
|
||||
"special",
|
||||
() -> !PLUGIN.getConfigYml().getBool("types.special.allow-multiple"),
|
||||
() -> PLUGIN.getLangYml().getString("special-color", false)
|
||||
() -> PLUGIN.getLangYml().getString("special-color")
|
||||
);
|
||||
|
||||
/**
|
||||
@ -68,7 +68,7 @@ public class EnchantmentType {
|
||||
public static final EnchantmentType ARTIFACT = new EnchantmentType(
|
||||
"artifact",
|
||||
() -> !PLUGIN.getConfigYml().getBool("types.artifact.allow-multiple"),
|
||||
() -> PLUGIN.getLangYml().getString("artifact-color", false),
|
||||
() -> PLUGIN.getLangYml().getString("artifact-color"),
|
||||
Artifact.class
|
||||
);
|
||||
|
||||
@ -80,7 +80,7 @@ public class EnchantmentType {
|
||||
public static final EnchantmentType SPELL = new EnchantmentType(
|
||||
"spell",
|
||||
true,
|
||||
() -> PLUGIN.getLangYml().getString("spell-color", false),
|
||||
() -> PLUGIN.getLangYml().getString("spell-color"),
|
||||
Spell.class
|
||||
);
|
||||
|
||||
|
@ -63,7 +63,7 @@ public class EnchantingListeners extends PluginDependent<EcoPlugin> implements L
|
||||
@ConfigUpdater
|
||||
public static void update(@NotNull final EcoEnchantsPlugin plugin) {
|
||||
SECONDARY_ENCHANTABLE.clear();
|
||||
for (String string : plugin.getTargetYml().getStrings("extra-enchantable-items", false)) {
|
||||
for (String string : plugin.getTargetYml().getStrings("extra-enchantable-items")) {
|
||||
SECONDARY_ENCHANTABLE.add(Material.matchMaterial(string.toUpperCase()));
|
||||
}
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ public class Rainbow extends EcoEnchant {
|
||||
|
||||
List<Material> materials = new ArrayList<>();
|
||||
|
||||
for (String materialName : this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "items", false)) {
|
||||
for (String materialName : this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "items")) {
|
||||
Material material = Material.getMaterial(materialName.toUpperCase());
|
||||
if (material != null) {
|
||||
materials.add(material);
|
||||
|
@ -67,7 +67,7 @@ public class SoftTouch extends EcoEnchant {
|
||||
name = name.replace("[", "").replace("]", "");
|
||||
meta.setDisplayName(name);
|
||||
|
||||
List<String> lore = this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "lore", false);
|
||||
List<String> lore = this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "lore");
|
||||
lore.replaceAll(s -> s.replace("%type%", entityName));
|
||||
meta.setLore(lore);
|
||||
|
||||
|
@ -56,7 +56,7 @@ public class Xray extends Spell {
|
||||
|
||||
List<Material> materials = new ArrayList<>();
|
||||
|
||||
for (String materialName : this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks", false)) {
|
||||
for (String materialName : this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks")) {
|
||||
Material material = Material.getMaterial(materialName.toUpperCase());
|
||||
if (material != null) {
|
||||
materials.add(material);
|
||||
|
Loading…
Reference in New Issue
Block a user