Updated to eco 3

This commit is contained in:
Auxilor 2021-01-17 16:22:04 +00:00
parent bb502e7d0d
commit 15d5afd74b
83 changed files with 417 additions and 211 deletions

View File

@ -49,7 +49,7 @@ allprojects {
}
dependencies {
compileOnly 'com.willfp:eco:2.0.0'
compileOnly 'com.willfp:eco:3.0.0'
compileOnly 'org.jetbrains:annotations:19.0.0'

View File

@ -1,6 +1,5 @@
package com.willfp.ecoenchants;
import com.willfp.eco.util.ProxyUtils;
import com.willfp.eco.util.command.AbstractCommand;
import com.willfp.eco.util.drops.telekinesis.TelekinesisUtils;
import com.willfp.eco.util.integrations.IntegrationLoader;
@ -37,6 +36,8 @@ import com.willfp.ecoenchants.integrations.mcmmo.plugins.McmmoIntegrationImpl;
import com.willfp.ecoenchants.integrations.worldguard.WorldguardManager;
import com.willfp.ecoenchants.integrations.worldguard.plugins.WorldguardIntegrationImpl;
import com.willfp.ecoenchants.proxy.proxies.FastGetEnchantsProxy;
import com.willfp.ecoenchants.util.ProxyUtils;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
@ -48,11 +49,18 @@ import java.util.List;
@SuppressWarnings("unused")
public class EcoEnchantsPlugin extends AbstractEcoPlugin {
/**
* Instance of the plugin.
*/
@Getter
private static EcoEnchantsPlugin instance;
/**
* Internal constructor called by bukkit on plugin load.
*/
public EcoEnchantsPlugin() {
super("EcoEnchants", 79573, 7666, "com.willfp.ecoenchants.proxy", "&a");
instance = this;
}
/**
@ -126,7 +134,7 @@ public class EcoEnchantsPlugin extends AbstractEcoPlugin {
@Override
public void postLoad() {
Bukkit.getServer().getWorlds().forEach(world -> {
world.getPopulators().add(new LootPopulator());
world.getPopulators().add(new LootPopulator(this));
});
EssentialsManager.registerEnchantments();
}
@ -189,7 +197,7 @@ public class EcoEnchantsPlugin extends AbstractEcoPlugin {
new GrindstoneListeners(this),
new AnvilListeners(this),
new WatcherTriggers(this),
new VillagerListeners(),
new VillagerListeners(this),
new HoldItemListener()
);
}

View File

@ -1,7 +1,6 @@
package com.willfp.ecoenchants.command.commands;
import com.willfp.eco.util.command.AbstractCommand;
import com.willfp.eco.util.config.Configs;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
@ -22,6 +21,6 @@ public class CommandEcoreload extends AbstractCommand {
public void onExecute(@NotNull final CommandSender sender,
@NotNull final List<String> args) {
this.getPlugin().reload();
sender.sendMessage(Configs.LANG.getMessage("reloaded"));
sender.sendMessage(this.getPlugin().getLangYml().getMessage("reloaded"));
}
}

View File

@ -3,7 +3,6 @@ package com.willfp.ecoenchants.command.commands;
import com.willfp.eco.util.StringUtils;
import com.willfp.eco.util.command.AbstractCommand;
import com.willfp.eco.util.command.AbstractTabCompleter;
import com.willfp.eco.util.config.Configs;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.ecoenchants.command.tabcompleters.TabCompleterEnchantinfo;
import com.willfp.ecoenchants.display.EnchantmentCache;
@ -39,7 +38,7 @@ public class CommandEnchantinfo extends AbstractCommand {
public void onExecute(@NotNull final CommandSender sender,
@NotNull final List<String> args) {
if (args.isEmpty()) {
sender.sendMessage(Configs.LANG.getMessage("missing-enchant"));
sender.sendMessage(this.getPlugin().getLangYml().getMessage("missing-enchant"));
return;
}
StringBuilder nameBuilder = new StringBuilder();
@ -51,7 +50,7 @@ public class CommandEnchantinfo extends AbstractCommand {
EcoEnchant enchantment = EcoEnchants.getByName(searchName);
if (enchantment == null || !enchantment.isEnabled()) {
String message = Configs.LANG.getMessage("not-found").replace("%name%", searchName);
String message = this.getPlugin().getLangYml().getMessage("not-found").replace("%name%", searchName);
sender.sendMessage(message);
return;
}
@ -71,7 +70,7 @@ public class CommandEnchantinfo extends AbstractCommand {
if (EcoEnchants.getFromEnchantment(enchantment1) != null) {
conflictNames.add(EcoEnchants.getFromEnchantment(enchantment1).getName());
} else {
conflictNames.add(Configs.LANG.getString("enchantments." + enchantment1.getKey().getKey() + ".name"));
conflictNames.add(this.getPlugin().getLangYml().getString("enchantments." + enchantment1.getKey().getKey() + ".name"));
}
}));
@ -81,14 +80,14 @@ public class CommandEnchantinfo extends AbstractCommand {
if (allConflicts.length() >= 2) {
allConflicts = allConflicts.substring(0, allConflicts.length() - 2);
} else {
allConflicts = StringUtils.translate(Configs.LANG.getString("no-conflicts"));
allConflicts = StringUtils.translate(this.getPlugin().getLangYml().getString("no-conflicts"));
}
Set<Material> targets = enchantment.getTargetMaterials();
Set<String> applicableItemsSet = new HashSet<>();
if (Configs.CONFIG.getBool("commands.enchantinfo.show-target-group")) {
if (this.getPlugin().getConfigYml().getBool("commands.enchantinfo.show-target-group")) {
enchantment.getTargets().forEach(target -> {
String targetName = target.getName();
targetName = targetName.toLowerCase();
@ -112,7 +111,7 @@ public class CommandEnchantinfo extends AbstractCommand {
if (allTargets.length() >= 2) {
allTargets = allTargets.substring(0, allTargets.length() - 2);
} else {
allTargets = StringUtils.translate(Configs.LANG.getString("no-targets"));
allTargets = StringUtils.translate(this.getPlugin().getLangYml().getString("no-targets"));
}
String maxLevel = String.valueOf(enchantment.getMaxLevel());
@ -122,7 +121,7 @@ public class CommandEnchantinfo extends AbstractCommand {
final String finalTargets = allTargets;
final String finalConflicts = allConflicts;
final String finalMaxLevel = maxLevel;
Arrays.asList(Configs.LANG.getMessage("enchantinfo").split("\\r?\\n")).forEach((string -> {
Arrays.asList(this.getPlugin().getLangYml().getMessage("enchantinfo").split("\\r?\\n")).forEach((string -> {
string = string.replace("%name%", finalName)
.replace("%description%", finalDescription)
.replace("%target%", finalTargets)

View File

@ -2,7 +2,7 @@ package com.willfp.ecoenchants.config;
import com.willfp.eco.util.config.ValueGetter;
import com.willfp.eco.util.internal.PluginDependent;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.ecoenchants.EcoEnchantsPlugin;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import lombok.AccessLevel;
import lombok.Getter;
@ -64,7 +64,7 @@ public abstract class EnchantmentYamlConfig extends PluginDependent implements V
protected EnchantmentYamlConfig(@NotNull final String name,
@NotNull final Class<?> source,
@NotNull final EnchantmentType type) {
super(AbstractEcoPlugin.getInstance());
super(EcoEnchantsPlugin.getInstance());
this.name = name;
this.source = source;
this.type = type;

View File

@ -1,6 +1,5 @@
package com.willfp.ecoenchants.config.configs;
import com.willfp.eco.util.config.Configs;
import com.willfp.ecoenchants.config.EnchantmentYamlConfig;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentRarity;
@ -86,12 +85,12 @@ public class EnchantmentConfig extends EnchantmentYamlConfig {
* Load config values from lang.yml.
*/
public void loadFromLang() {
if (!Configs.LANG.getConfig().contains("enchantments." + this.getName())) {
if (!this.getPlugin().getLangYml().getConfig().contains("enchantments." + this.getName())) {
return;
}
this.getConfig().set("name", Configs.LANG.getString("enchantments." + this.getName() + ".name"));
this.getConfig().set("description", Configs.LANG.getString("enchantments." + this.getName() + ".description"));
this.getConfig().set("name", this.getPlugin().getLangYml().getString("enchantments." + this.getName() + ".name"));
this.getConfig().set("description", this.getPlugin().getLangYml().getString("enchantments." + this.getName() + ".description"));
try {
this.getConfig().save(this.getConfigFile());
} catch (IOException e) {

View File

@ -1,6 +1,8 @@
package com.willfp.ecoenchants.config.configs;
import com.willfp.eco.util.config.BaseConfig;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.ecoenchants.EcoEnchantsPlugin;
import java.util.Set;
@ -9,7 +11,7 @@ public class Rarity extends BaseConfig {
* Instantiate rarity.yml.
*/
public Rarity() {
super("rarity", false);
super("rarity", false, EcoEnchantsPlugin.getInstance());
}
/**

View File

@ -1,6 +1,8 @@
package com.willfp.ecoenchants.config.configs;
import com.willfp.eco.util.config.BaseConfig;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.ecoenchants.EcoEnchantsPlugin;
import org.bukkit.Material;
import org.jetbrains.annotations.NotNull;
@ -12,7 +14,7 @@ public class Target extends BaseConfig {
* Instantiate target.yml.
*/
public Target() {
super("target", false);
super("target", false, EcoEnchantsPlugin.getInstance());
}
/**

View File

@ -4,6 +4,7 @@ import com.google.common.collect.Lists;
import com.willfp.eco.util.NumberUtils;
import com.willfp.eco.util.config.updating.annotations.ConfigUpdater;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.ecoenchants.EcoEnchantsPlugin;
import com.willfp.ecoenchants.display.options.DisplayOptions;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
@ -31,7 +32,7 @@ public class EnchantDisplay {
/**
* Instance of EcoEnchants.
*/
private static final AbstractEcoPlugin PLUGIN = AbstractEcoPlugin.getInstance();
private static final AbstractEcoPlugin PLUGIN = EcoEnchantsPlugin.getInstance();
/**
* The meta key to hide enchantments in lore.

View File

@ -1,8 +1,9 @@
package com.willfp.ecoenchants.display;
import com.google.common.collect.ImmutableMap;
import com.willfp.eco.util.config.Configs;
import com.willfp.eco.util.config.updating.annotations.ConfigUpdater;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.ecoenchants.EcoEnchantsPlugin;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentRarity;
@ -24,6 +25,11 @@ import java.util.Map;
@UtilityClass
@SuppressWarnings("deprecation")
public class EnchantmentCache {
/**
* Instance of EcoEnchants.
*/
public static final AbstractEcoPlugin PLUGIN = EcoEnchantsPlugin.getInstance();
/**
* The physical cache.
*/
@ -82,17 +88,17 @@ public class EnchantmentCache {
} else {
description = Arrays.asList(
WordUtils.wrap(
String.valueOf(Configs.LANG.getString("enchantments." + enchantment.getKey().getKey().toLowerCase() + ".description")),
Configs.CONFIG.getInt("lore.describe.wrap"),
String.valueOf(PLUGIN.getLangYml().getString("enchantments." + enchantment.getKey().getKey().toLowerCase() + ".description")),
PLUGIN.getConfigYml().getInt("lore.describe.wrap"),
"\n", false
).split("\\r?\\n")
);
name = String.valueOf(Configs.LANG.getString("enchantments." + enchantment.getKey().getKey().toLowerCase() + ".name"));
name = String.valueOf(PLUGIN.getLangYml().getString("enchantments." + enchantment.getKey().getKey().toLowerCase() + ".name"));
type = enchantment.isCursed() ? EnchantmentType.CURSE : EnchantmentType.NORMAL;
if (enchantment.isTreasure()) {
rarity = EnchantmentRarity.getByName(Configs.CONFIG.getString("rarity.vanilla-treasure-rarity"));
rarity = EnchantmentRarity.getByName(PLUGIN.getConfigYml().getString("rarity.vanilla-treasure-rarity"));
} else {
rarity = EnchantmentRarity.getByName(Configs.CONFIG.getString("rarity.vanilla-rarity"));
rarity = EnchantmentRarity.getByName(PLUGIN.getConfigYml().getString("rarity.vanilla-rarity"));
}
}
@ -103,7 +109,7 @@ public class EnchantmentCache {
}
if (rarity == null) {
rarity = EnchantmentRarity.getByName(Configs.CONFIG.getString("rarity.vanilla-rarity"));
rarity = EnchantmentRarity.getByName(PLUGIN.getConfigYml().getString("rarity.vanilla-rarity"));
}
String rawName = name;

View File

@ -1,10 +1,16 @@
package com.willfp.ecoenchants.display.options;
import com.willfp.eco.util.StringUtils;
import com.willfp.eco.util.config.Configs;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.ecoenchants.EcoEnchantsPlugin;
import lombok.Getter;
public class DescriptionOptions {
/**
* Instance of EcoEnchants.
*/
public static final AbstractEcoPlugin PLUGIN = EcoEnchantsPlugin.getInstance();
/**
* The threshold below which to describe enchantments.
*/
@ -27,8 +33,8 @@ public class DescriptionOptions {
* Update the options.
*/
public void update() {
threshold = Configs.CONFIG.getInt("lore.describe.before-lines");
enabled = Configs.CONFIG.getBool("lore.describe.enabled");
color = StringUtils.translate(Configs.LANG.getString("description-color"));
threshold = PLUGIN.getConfigYml().getInt("lore.describe.before-lines");
enabled = PLUGIN.getConfigYml().getBool("lore.describe.enabled");
color = StringUtils.translate(PLUGIN.getLangYml().getString("description-color"));
}
}

View File

@ -1,6 +1,7 @@
package com.willfp.ecoenchants.display.options;
import com.willfp.eco.util.config.Configs;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.ecoenchants.EcoEnchantsPlugin;
import com.willfp.ecoenchants.display.options.sorting.EnchantmentSorter;
import com.willfp.ecoenchants.display.options.sorting.SortParameters;
import com.willfp.ecoenchants.display.options.sorting.SorterManager;
@ -17,6 +18,11 @@ import java.util.Set;
import java.util.stream.Collectors;
public class DisplayOptions {
/**
* Instance of EcoEnchants.
*/
public static final AbstractEcoPlugin PLUGIN = EcoEnchantsPlugin.getInstance();
/**
* The enchantment sorter being used.
*/
@ -76,24 +82,24 @@ public class DisplayOptions {
shrinkOptions.update();
sortedTypes.clear();
sortedTypes.addAll(Configs.CONFIG.getStrings("lore.type-ordering").stream()
sortedTypes.addAll(PLUGIN.getConfigYml().getStrings("lore.type-ordering").stream()
.map(typeName -> EnchantmentType.values().stream().filter(type -> type.getName().equalsIgnoreCase(typeName)).findFirst().orElse(null))
.filter(Objects::nonNull)
.collect(Collectors.toList()));
sortedTypes.addAll(EnchantmentType.values().stream().filter(enchantmentType -> !sortedTypes.contains(enchantmentType)).collect(Collectors.toList()));
sortedRarities.clear();
sortedRarities.addAll(Configs.CONFIG.getStrings("lore.rarity-ordering").stream()
sortedRarities.addAll(PLUGIN.getConfigYml().getStrings("lore.rarity-ordering").stream()
.map(rarityName -> EnchantmentRarity.values().stream().filter(rarity -> rarity.getName().equalsIgnoreCase(rarityName)).findFirst().orElse(null))
.filter(Objects::nonNull)
.collect(Collectors.toList()));
sortedRarities.addAll(EnchantmentRarity.values().stream().filter(enchantmentRarity -> !sortedRarities.contains(enchantmentRarity)).collect(Collectors.toList()));
useLoreGetter = Configs.CONFIG.getBool("advanced.lore-getter");
useLoreGetter = PLUGIN.getConfigYml().getBool("advanced.lore-getter");
boolean byType = Configs.CONFIG.getBool("lore.sort-by-type");
boolean byLength = Configs.CONFIG.getBool("lore.sort-by-length");
boolean byRarity = Configs.CONFIG.getBool("lore.sort-by-rarity");
boolean byType = PLUGIN.getConfigYml().getBool("lore.sort-by-type");
boolean byLength = PLUGIN.getConfigYml().getBool("lore.sort-by-length");
boolean byRarity = PLUGIN.getConfigYml().getBool("lore.sort-by-rarity");
Set<SortParameters> params = new HashSet<>();
if (byType) {
params.add(SortParameters.TYPE);

View File

@ -1,9 +1,15 @@
package com.willfp.ecoenchants.display.options;
import com.willfp.eco.util.config.Configs;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.ecoenchants.EcoEnchantsPlugin;
import lombok.Getter;
public class NumbersOptions {
/**
* Instance of EcoEnchants.
*/
public static final AbstractEcoPlugin PLUGIN = EcoEnchantsPlugin.getInstance();
/**
* If numerals should be used.
* <p>
@ -22,7 +28,7 @@ public class NumbersOptions {
* Update the options.
*/
public void update() {
useNumerals = Configs.CONFIG.getBool("lore.use-numerals");
threshold = Configs.CONFIG.getInt("lore.use-numbers-above-threshold");
useNumerals = PLUGIN.getConfigYml().getBool("lore.use-numerals");
threshold = PLUGIN.getConfigYml().getInt("lore.use-numbers-above-threshold");
}
}

View File

@ -1,9 +1,15 @@
package com.willfp.ecoenchants.display.options;
import com.willfp.eco.util.config.Configs;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.ecoenchants.EcoEnchantsPlugin;
import lombok.Getter;
public class ShrinkOptions {
/**
* Instance of EcoEnchants.
*/
public static final AbstractEcoPlugin PLUGIN = EcoEnchantsPlugin.getInstance();
/**
* The threshold above which enchantments will be shrunk.
*/
@ -26,8 +32,8 @@ public class ShrinkOptions {
* Update the options.
*/
public void update() {
threshold = Configs.CONFIG.getInt("lore.shrink.after-lines");
enabled = Configs.CONFIG.getBool("lore.shrink.enabled");
shrinkPerLine = Configs.CONFIG.getInt("lore.shrink.maximum-per-line");
threshold = PLUGIN.getConfigYml().getInt("lore.shrink.after-lines");
enabled = PLUGIN.getConfigYml().getBool("lore.shrink.enabled");
shrinkPerLine = PLUGIN.getConfigYml().getInt("lore.shrink.maximum-per-line");
}
}

View File

@ -4,10 +4,10 @@ import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.events.ListenerPriority;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.wrappers.WrappedChatComponent;
import com.willfp.eco.util.ProxyUtils;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.eco.util.protocollib.AbstractPacketAdapter;
import com.willfp.ecoenchants.proxy.proxies.ChatComponentProxy;
import com.willfp.ecoenchants.util.ProxyUtils;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
@ -33,6 +33,7 @@ public class PacketChat extends AbstractPacketAdapter {
if (component.getHandle() == null) {
return;
}
WrappedChatComponent newComponent = WrappedChatComponent.fromHandle(ProxyUtils.getProxy(ChatComponentProxy.class).modifyComponent(component.getHandle()));
packet.getChatComponents().write(i, newComponent);
}

View File

@ -2,11 +2,11 @@ package com.willfp.ecoenchants.display.packets;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.events.PacketContainer;
import com.willfp.eco.util.ProxyUtils;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.eco.util.protocollib.AbstractPacketAdapter;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget;
import com.willfp.ecoenchants.proxy.proxies.VillagerTradeProxy;
import com.willfp.ecoenchants.util.ProxyUtils;
import org.bukkit.entity.Player;
import org.bukkit.inventory.MerchantRecipe;
import org.jetbrains.annotations.NotNull;

View File

@ -2,10 +2,10 @@ package com.willfp.ecoenchants.enchantments;
import com.willfp.eco.util.StringUtils;
import com.willfp.eco.util.config.Configs;
import com.willfp.eco.util.interfaces.Registerable;
import com.willfp.eco.util.optional.Prerequisite;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.ecoenchants.EcoEnchantsPlugin;
import com.willfp.ecoenchants.config.EcoEnchantsConfigs;
import com.willfp.ecoenchants.config.configs.EnchantmentConfig;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentRarity;
@ -44,7 +44,7 @@ public abstract class EcoEnchant extends Enchantment implements Listener, Regist
* Instance of EcoEnchants for enchantments to be able to access.
*/
@Getter(AccessLevel.PROTECTED)
private final AbstractEcoPlugin plugin = AbstractEcoPlugin.getInstance();
private final AbstractEcoPlugin plugin = EcoEnchantsPlugin.getInstance();
/**
* The display name of the enchantment.
@ -262,7 +262,7 @@ public abstract class EcoEnchant extends Enchantment implements Listener, Regist
* @return The description.
*/
public List<String> getWrappedDescription() {
return Arrays.asList(WordUtils.wrap(description, Configs.CONFIG.getInt("lore.describe.wrap"), "\n", false).split("\\r?\\n"));
return Arrays.asList(WordUtils.wrap(description, this.getPlugin().getConfigYml().getInt("lore.describe.wrap"), "\n", false).split("\\r?\\n"));
}
/**

View File

@ -1,11 +1,11 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.proxy.proxies.CooldownProxy;
import com.willfp.eco.util.DurabilityUtils;
import com.willfp.eco.util.ProxyUtils;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.proxy.proxies.CooldownProxy;
import com.willfp.ecoenchants.util.ProxyUtils;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;

View File

@ -1,12 +1,12 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.proxy.proxies.BlockBreakProxy;
import com.willfp.eco.util.ProxyUtils;
import com.willfp.eco.util.integrations.anticheat.AnticheatManager;
import com.willfp.eco.util.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.proxy.proxies.BlockBreakProxy;
import com.willfp.ecoenchants.util.ProxyUtils;
import org.bukkit.Particle;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;

View File

@ -1,11 +1,11 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.proxy.proxies.CooldownProxy;
import com.willfp.eco.util.ProxyUtils;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
import com.willfp.ecoenchants.proxy.proxies.CooldownProxy;
import com.willfp.ecoenchants.util.ProxyUtils;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;

View File

@ -1,10 +1,10 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.proxy.proxies.CooldownProxy;
import com.willfp.eco.util.ProxyUtils;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.proxy.proxies.CooldownProxy;
import com.willfp.ecoenchants.util.ProxyUtils;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;

View File

@ -1,11 +1,11 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.proxy.proxies.CooldownProxy;
import com.willfp.eco.util.ProxyUtils;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
import com.willfp.ecoenchants.proxy.proxies.CooldownProxy;
import com.willfp.ecoenchants.util.ProxyUtils;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;

View File

@ -1,13 +1,13 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.proxy.proxies.BlockBreakProxy;
import com.willfp.eco.util.ProxyUtils;
import com.willfp.eco.util.VectorUtils;
import com.willfp.eco.util.integrations.anticheat.AnticheatManager;
import com.willfp.eco.util.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.proxy.proxies.BlockBreakProxy;
import com.willfp.ecoenchants.util.ProxyUtils;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockBreakEvent;

View File

@ -1,11 +1,11 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.proxy.proxies.CooldownProxy;
import com.willfp.eco.util.ProxyUtils;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
import com.willfp.ecoenchants.proxy.proxies.CooldownProxy;
import com.willfp.ecoenchants.util.ProxyUtils;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;

View File

@ -1,11 +1,11 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.proxy.proxies.CooldownProxy;
import com.willfp.eco.util.ProxyUtils;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
import com.willfp.ecoenchants.proxy.proxies.CooldownProxy;
import com.willfp.ecoenchants.util.ProxyUtils;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;

View File

@ -1,12 +1,12 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.proxy.proxies.CooldownProxy;
import com.willfp.eco.util.ProxyUtils;
import com.willfp.eco.util.VectorUtils;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
import com.willfp.ecoenchants.proxy.proxies.CooldownProxy;
import com.willfp.ecoenchants.util.ProxyUtils;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Monster;

View File

@ -1,11 +1,11 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.proxy.proxies.CooldownProxy;
import com.willfp.eco.util.ProxyUtils;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
import com.willfp.ecoenchants.proxy.proxies.CooldownProxy;
import com.willfp.ecoenchants.util.ProxyUtils;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;

View File

@ -1,13 +1,13 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.proxy.proxies.BlockBreakProxy;
import com.willfp.eco.util.BlockUtils;
import com.willfp.eco.util.ProxyUtils;
import com.willfp.eco.util.integrations.anticheat.AnticheatManager;
import com.willfp.eco.util.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.proxy.proxies.BlockBreakProxy;
import com.willfp.ecoenchants.util.ProxyUtils;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;

View File

@ -1,11 +1,11 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.proxy.proxies.TridentStackProxy;
import com.willfp.eco.util.ProxyUtils;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
import com.willfp.ecoenchants.proxy.proxies.TridentStackProxy;
import com.willfp.ecoenchants.util.ProxyUtils;
import org.bukkit.entity.AbstractArrow;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;

View File

@ -1,14 +1,14 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.proxy.proxies.TridentStackProxy;
import com.willfp.eco.util.NumberUtils;
import com.willfp.eco.util.ProxyUtils;
import com.willfp.eco.util.drops.DropQueue;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
import com.willfp.ecoenchants.proxy.proxies.TridentStackProxy;
import com.willfp.ecoenchants.util.ProxyUtils;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
@ -22,6 +22,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;
public class Spearfishing extends EcoEnchant {
public Spearfishing() {
super(

View File

@ -1,12 +1,12 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.proxy.proxies.TridentStackProxy;
import com.willfp.eco.util.ProxyUtils;
import com.willfp.eco.util.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
import com.willfp.ecoenchants.proxy.proxies.TridentStackProxy;
import com.willfp.ecoenchants.util.ProxyUtils;
import org.bukkit.Bukkit;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;

View File

@ -1,11 +1,11 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.proxy.proxies.CooldownProxy;
import com.willfp.eco.util.ProxyUtils;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
import com.willfp.ecoenchants.proxy.proxies.CooldownProxy;
import com.willfp.ecoenchants.util.ProxyUtils;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;

View File

@ -1,11 +1,11 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.proxy.proxies.CooldownProxy;
import com.willfp.eco.util.ProxyUtils;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
import com.willfp.ecoenchants.proxy.proxies.CooldownProxy;
import com.willfp.ecoenchants.util.ProxyUtils;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;

View File

@ -1,7 +1,5 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.eco.util.ProxyUtils;
import com.willfp.eco.util.config.Configs;
import com.willfp.eco.util.drops.DropQueue;
import com.willfp.eco.util.events.entitydeathbyentity.EntityDeathByEntityEvent;
import com.willfp.eco.util.integrations.antigrief.AntigriefManager;
@ -10,6 +8,7 @@ import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
import com.willfp.ecoenchants.proxy.proxies.TridentStackProxy;
import com.willfp.ecoenchants.util.ProxyUtils;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.block.Block;
@ -38,9 +37,10 @@ public class Telekinesis extends EcoEnchant {
"telekinesis", EnchantmentType.NORMAL
);
}
@Override
protected void postUpdate() {
always = Configs.CONFIG.getBool("drops.force-dropqueue");
always = this.getPlugin().getConfigYml().getBool("drops.force-dropqueue");
}
// For block drops
@ -149,7 +149,7 @@ public class Telekinesis extends EcoEnchant {
} else if (event.getKiller() instanceof Trident) {
if (((Trident) event.getKiller()).getShooter() instanceof Player) {
player = (Player) ((Trident) event.getKiller()).getShooter();
item = ProxyUtils.getProxy(TridentStackProxy.class).getTridentStack((Trident) event.getKiller());
item = ProxyUtils.getProxy(TridentStackProxy.class).getTridentStack((Trident) event.getKiller());
}
}

View File

@ -1,12 +1,12 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.proxy.proxies.CooldownProxy;
import com.willfp.eco.util.LightningUtils;
import com.willfp.eco.util.ProxyUtils;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
import com.willfp.ecoenchants.proxy.proxies.CooldownProxy;
import com.willfp.ecoenchants.util.ProxyUtils;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;

View File

@ -1,11 +1,11 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.proxy.proxies.CooldownProxy;
import com.willfp.eco.util.ProxyUtils;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
import com.willfp.ecoenchants.proxy.proxies.CooldownProxy;
import com.willfp.ecoenchants.util.ProxyUtils;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;

View File

@ -1,11 +1,11 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.proxy.proxies.CooldownProxy;
import com.willfp.eco.util.ProxyUtils;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
import com.willfp.ecoenchants.proxy.proxies.CooldownProxy;
import com.willfp.ecoenchants.util.ProxyUtils;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;

View File

@ -1,13 +1,13 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.proxy.proxies.BlockBreakProxy;
import com.willfp.eco.util.BlockUtils;
import com.willfp.eco.util.ProxyUtils;
import com.willfp.eco.util.integrations.anticheat.AnticheatManager;
import com.willfp.eco.util.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.proxy.proxies.BlockBreakProxy;
import com.willfp.ecoenchants.util.ProxyUtils;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;

View File

@ -1,12 +1,12 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.special;
import com.willfp.ecoenchants.proxy.proxies.CooldownProxy;
import com.willfp.eco.util.LightningUtils;
import com.willfp.eco.util.ProxyUtils;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
import com.willfp.ecoenchants.proxy.proxies.CooldownProxy;
import com.willfp.ecoenchants.util.ProxyUtils;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;

View File

@ -1,10 +1,10 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.special;
import com.willfp.ecoenchants.proxy.proxies.CooldownProxy;
import com.willfp.eco.util.ProxyUtils;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.proxy.proxies.CooldownProxy;
import com.willfp.ecoenchants.util.ProxyUtils;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;

View File

@ -1,11 +1,11 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.special;
import com.willfp.ecoenchants.proxy.proxies.CooldownProxy;
import com.willfp.eco.util.ProxyUtils;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
import com.willfp.ecoenchants.proxy.proxies.CooldownProxy;
import com.willfp.ecoenchants.util.ProxyUtils;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;

View File

@ -1,10 +1,10 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.special;
import com.willfp.ecoenchants.proxy.proxies.CooldownProxy;
import com.willfp.eco.util.ProxyUtils;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.proxy.proxies.CooldownProxy;
import com.willfp.ecoenchants.util.ProxyUtils;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;

View File

@ -1,12 +1,12 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.special;
import com.willfp.ecoenchants.proxy.proxies.CooldownProxy;
import com.willfp.eco.util.ProxyUtils;
import com.willfp.eco.util.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
import com.willfp.ecoenchants.proxy.proxies.CooldownProxy;
import com.willfp.ecoenchants.util.ProxyUtils;
import org.bukkit.Location;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;

View File

@ -1,11 +1,11 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.spell;
import com.willfp.ecoenchants.proxy.proxies.BlockBreakProxy;
import com.willfp.eco.util.ProxyUtils;
import com.willfp.eco.util.integrations.anticheat.AnticheatManager;
import com.willfp.eco.util.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.itemtypes.Spell;
import com.willfp.ecoenchants.proxy.proxies.BlockBreakProxy;
import com.willfp.ecoenchants.util.ProxyUtils;
import org.bukkit.Particle;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;

View File

@ -1,14 +1,14 @@
package com.willfp.ecoenchants.enchantments.itemtypes;
import com.google.common.util.concurrent.AtomicDouble;
import com.willfp.ecoenchants.proxy.proxies.TridentStackProxy;
import com.willfp.eco.util.NumberUtils;
import com.willfp.eco.util.ProxyUtils;
import com.willfp.eco.util.optional.Prerequisite;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
import com.willfp.ecoenchants.proxy.proxies.TridentStackProxy;
import com.willfp.ecoenchants.util.ProxyUtils;
import org.bukkit.Location;
import org.bukkit.Particle;
import org.bukkit.block.Block;

View File

@ -1,6 +1,5 @@
package com.willfp.ecoenchants.enchantments.itemtypes;
import com.willfp.eco.util.config.Configs;
import com.willfp.eco.util.optional.Prerequisite;
import com.willfp.ecoenchants.display.EnchantmentCache;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
@ -129,13 +128,13 @@ public abstract class Spell extends EcoEnchant {
}
if (cooldown > 0) {
String message = Configs.LANG.getMessage("on-cooldown").replace("%seconds%", String.valueOf(cooldown)).replace("%name%", EnchantmentCache.getEntry(this).getRawName());
String message = this.getPlugin().getLangYml().getMessage("on-cooldown").replace("%seconds%", String.valueOf(cooldown)).replace("%name%", EnchantmentCache.getEntry(this).getRawName());
player.sendMessage(message);
player.playSound(player.getLocation(), Sound.BLOCK_NOTE_BLOCK_BASS, 1, 0.5f);
return;
}
String message = Configs.LANG.getMessage("used-spell").replace("%name%", EnchantmentCache.getEntry(this).getRawName());
String message = this.getPlugin().getLangYml().getMessage("used-spell").replace("%name%", EnchantmentCache.getEntry(this).getRawName());
player.sendMessage(message);
player.playSound(player.getLocation(), this.getActivationSound(), SoundCategory.PLAYERS, 1, 1);
runnable.run();

View File

@ -1,8 +1,9 @@
package com.willfp.ecoenchants.enchantments.meta;
import com.google.common.collect.ImmutableList;
import com.willfp.eco.util.config.Configs;
import com.willfp.eco.util.config.updating.annotations.ConfigUpdater;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.ecoenchants.EcoEnchantsPlugin;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
import com.willfp.ecoenchants.enchantments.itemtypes.Spell;
@ -16,6 +17,11 @@ import java.util.Objects;
import java.util.function.Supplier;
public class EnchantmentType {
/**
* Instance of EcoEnchants.
*/
private static final EcoEnchantsPlugin PLUGIN = EcoEnchantsPlugin.getInstance();
/**
* All registered types.
*/
@ -29,7 +35,7 @@ public class EnchantmentType {
public static final EnchantmentType NORMAL = new EnchantmentType(
"normal",
false,
() -> Configs.LANG.getString("not-curse-color")
() -> PLUGIN.getLangYml().getString("not-curse-color")
);
/**
@ -40,7 +46,7 @@ public class EnchantmentType {
public static final EnchantmentType CURSE = new EnchantmentType(
"curse",
false,
() -> Configs.LANG.getString("curse-color")
() -> PLUGIN.getLangYml().getString("curse-color")
);
/**
@ -50,8 +56,8 @@ public class EnchantmentType {
*/
public static final EnchantmentType SPECIAL = new EnchantmentType(
"special",
() -> !Configs.CONFIG.getBool("types.special.allow-multiple"),
() -> Configs.LANG.getString("special-color")
() -> !PLUGIN.getConfigYml().getBool("types.special.allow-multiple"),
() -> PLUGIN.getLangYml().getString("special-color")
);
/**
@ -61,8 +67,8 @@ public class EnchantmentType {
*/
public static final EnchantmentType ARTIFACT = new EnchantmentType(
"artifact",
() -> !Configs.CONFIG.getBool("types.artifact.allow-multiple"),
() -> Configs.LANG.getString("artifact-color"),
() -> !PLUGIN.getConfigYml().getBool("types.artifact.allow-multiple"),
() -> PLUGIN.getLangYml().getString("artifact-color"),
Artifact.class
);
@ -74,7 +80,7 @@ public class EnchantmentType {
public static final EnchantmentType SPELL = new EnchantmentType(
"spell",
true,
() -> Configs.LANG.getString("spell-color"),
() -> PLUGIN.getLangYml().getString("spell-color"),
Spell.class
);

View File

@ -1,14 +1,13 @@
package com.willfp.ecoenchants.enchantments.support.merging.anvil;
import com.willfp.eco.util.NumberUtils;
import com.willfp.eco.util.ProxyUtils;
import com.willfp.eco.util.config.Configs;
import com.willfp.eco.util.internal.PluginDependent;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.eco.util.proxy.ProxyConstants;
import com.willfp.eco.util.tuplets.Pair;
import com.willfp.ecoenchants.proxy.proxies.OpenInventoryProxy;
import com.willfp.ecoenchants.proxy.proxies.RepairCostProxy;
import com.willfp.ecoenchants.util.ProxyUtils;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -110,7 +109,7 @@ public class AnvilListeners extends PluginDependent implements Listener {
return;
}
if (Configs.CONFIG.getBool("anvil.rework-cost")) {
if (this.getPlugin().getConfigYml().getBool("anvil.rework-cost")) {
int repairCost = ProxyUtils.getProxy(RepairCostProxy.class).getRepairCost(item);
int reworkCount = NumberUtils.log2(repairCost + 1);
if (repairCost == 0) {

View File

@ -1,7 +1,8 @@
package com.willfp.ecoenchants.enchantments.support.merging.anvil;
import com.willfp.eco.util.config.Configs;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.eco.util.tuplets.Pair;
import com.willfp.ecoenchants.EcoEnchantsPlugin;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget;
@ -23,6 +24,11 @@ import java.util.concurrent.atomic.AtomicInteger;
@UtilityClass
public class AnvilMerge {
/**
* Instance of EcoEnchants.
*/
private static final EcoEnchantsPlugin PLUGIN = EcoEnchantsPlugin.getInstance();
/**
* Config key for allowing unsafe levels.
*/
@ -126,8 +132,8 @@ public class AnvilMerge {
if (rightLevel > level) {
level = rightLevel;
} else if (rightLevel == level
&& ((rightLevel > enchantment.getMaxLevel() && Configs.CONFIG.getBool("anvil.allow-combining-unsafe"))
|| ((rightLevel + 1) <= enchantment.getMaxLevel() || Configs.CONFIG.getBool(ALLOW_UNSAFE_KEY)))) {
&& ((rightLevel > enchantment.getMaxLevel() && PLUGIN.getConfigYml().getBool("anvil.allow-combining-unsafe"))
|| ((rightLevel + 1) <= enchantment.getMaxLevel() || PLUGIN.getConfigYml().getBool(ALLOW_UNSAFE_KEY)))) {
level++;
}
rightEnchants.remove(enchantment);
@ -164,7 +170,7 @@ public class AnvilMerge {
}
if (canEnchantItem && !doesConflict.get()) {
if (Configs.CONFIG.getBool("anvil.hard-cap.enabled") && !player.hasPermission("ecoenchants.anvil.bypasshardcap") && outEnchants.size() >= Configs.CONFIG.getInt("anvil.hard-cap.cap")) {
if (PLUGIN.getConfigYml().getBool("anvil.hard-cap.enabled") && !player.hasPermission("ecoenchants.anvil.bypasshardcap") && outEnchants.size() >= PLUGIN.getConfigYml().getInt("anvil.hard-cap.cap")) {
return;
}
outEnchants.put(enchantment, integer);
@ -189,7 +195,7 @@ public class AnvilMerge {
}));
outEnchants.forEach(((enchantment, integer) -> {
meta.addStoredEnchant(enchantment, integer, Configs.CONFIG.getBool("anvil.allow-existing-unsafe-levels") || Configs.CONFIG.getBool(ALLOW_UNSAFE_KEY));
meta.addStoredEnchant(enchantment, integer, PLUGIN.getConfigYml().getBool("anvil.allow-existing-unsafe-levels") || PLUGIN.getConfigYml().getBool(ALLOW_UNSAFE_KEY));
}));
meta.setDisplayName(name);
@ -202,7 +208,7 @@ public class AnvilMerge {
}));
outEnchants.forEach(((enchantment, integer) -> {
meta.addEnchant(enchantment, integer, Configs.CONFIG.getBool("anvil.allow-existing-unsafe-levels") || Configs.CONFIG.getBool(ALLOW_UNSAFE_KEY));
meta.addEnchant(enchantment, integer, PLUGIN.getConfigYml().getBool("anvil.allow-existing-unsafe-levels") || PLUGIN.getConfigYml().getBool(ALLOW_UNSAFE_KEY));
}));
if (output.getItemMeta() instanceof Damageable) {
@ -237,8 +243,8 @@ public class AnvilMerge {
return new Pair<>(null, null);
}
if (Configs.CONFIG.getBool("anvil.cost-exponent.enabled")) {
double exponent = Configs.CONFIG.getDouble("anvil.cost-exponent.exponent");
if (PLUGIN.getConfigYml().getBool("anvil.cost-exponent.enabled")) {
double exponent = PLUGIN.getConfigYml().getDouble("anvil.cost-exponent.exponent");
int prevDelta = totalEnchantLevelDelta;
double costMultiplier = Math.pow(exponent, totalEnchantLevelDelta);

View File

@ -2,7 +2,6 @@ package com.willfp.ecoenchants.enchantments.support.obtaining;
import com.google.common.collect.ImmutableSet;
import com.willfp.eco.util.NumberUtils;
import com.willfp.eco.util.config.Configs;
import com.willfp.eco.util.internal.PluginDependent;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
@ -76,7 +75,7 @@ public class EnchantingListeners extends PluginDependent implements Listener {
int cost = event.getExpLevelCost();
Map<Enchantment, Integer> toAdd = event.getEnchantsToAdd();
if (!Configs.CONFIG.getBool("enchanting-table.enabled")) {
if (!this.getPlugin().getConfigYml().getBool("enchanting-table.enabled")) {
this.getPlugin().getScheduler().runLater(() -> {
ItemStack item0 = event.getInventory().getItem(0);
event.getInventory().setItem(0, item0);
@ -105,11 +104,11 @@ public class EnchantingListeners extends PluginDependent implements Listener {
double multiplier = 0.01;
if (item.getType().equals(Material.BOOK) || item.getType().equals(Material.ENCHANTED_BOOK)) {
multiplier /= Configs.CONFIG.getInt("enchanting-table.book-times-less-likely");
multiplier /= this.getPlugin().getConfigYml().getInt("enchanting-table.book-times-less-likely");
}
if (Configs.CONFIG.getBool("enchanting-table.reduce-probability.enabled")) {
multiplier /= Configs.CONFIG.getDouble("enchanting-table.reduce-probability.factor");
if (this.getPlugin().getConfigYml().getBool("enchanting-table.reduce-probability.enabled")) {
multiplier /= this.getPlugin().getConfigYml().getDouble("enchanting-table.reduce-probability.factor");
}
ArrayList<EcoEnchant> enchantments = new ArrayList<>(EcoEnchants.values());
@ -164,11 +163,11 @@ public class EnchantingListeners extends PluginDependent implements Listener {
if (enchantment.getType().equals(EnchantmentType.SPECIAL)) {
double enchantlevel1 = NumberUtils.randFloat(0, 1);
double enchantlevel2 = NumberUtils.bias(enchantlevel1, Configs.CONFIG.getDouble("enchanting-table.special-bias"));
double enchantlevel2 = NumberUtils.bias(enchantlevel1, this.getPlugin().getConfigYml().getDouble("enchanting-table.special-bias"));
double enchantlevel3 = 1 / maxLevelDouble;
level = (int) Math.ceil(enchantlevel2 / enchantlevel3);
} else {
int maxLevel = Configs.CONFIG.getInt("enchanting-table.maximum-obtainable-level");
int maxLevel = this.getPlugin().getConfigYml().getInt("enchanting-table.maximum-obtainable-level");
double enchantlevel1 = (cost / (double) enchantment.getRarity().getMinimumLevel()) / (maxLevel / (double) enchantment.getRarity().getMinimumLevel());
double enchantlevel2 = NumberUtils.triangularDistribution(0, 1, enchantlevel1);
double enchantlevel3 = 1 / maxLevelDouble;
@ -178,7 +177,7 @@ public class EnchantingListeners extends PluginDependent implements Listener {
level = NumberUtils.equalIfOver(level, enchantment.getMaxLevel());
toAdd.put(enchantment, level);
if (Configs.CONFIG.getBool("enchanting-table.cap-amount.enabled") && toAdd.size() >= Configs.CONFIG.getInt("enchanting-table.cap-amount.limit")) {
if (this.getPlugin().getConfigYml().getBool("enchanting-table.cap-amount.enabled") && toAdd.size() >= this.getPlugin().getConfigYml().getInt("enchanting-table.cap-amount.limit")) {
break;
}
@ -186,8 +185,8 @@ public class EnchantingListeners extends PluginDependent implements Listener {
gotSpecial = true;
}
if (Configs.CONFIG.getBool("enchanting-table.reduce-probability.enabled")) {
multiplier /= Configs.CONFIG.getDouble("enchanting-table.reduce-probability.factor");
if (this.getPlugin().getConfigYml().getBool("enchanting-table.reduce-probability.enabled")) {
multiplier /= this.getPlugin().getConfigYml().getDouble("enchanting-table.reduce-probability.factor");
}
}
toAdd.forEach(event.getEnchantsToAdd()::putIfAbsent);
@ -197,8 +196,8 @@ public class EnchantingListeners extends PluginDependent implements Listener {
CURRENTLY_ENCHANTING_SECONDARY.remove(player);
}
if (gotSpecial && Configs.CONFIG.getBool("enchanting-table.notify-on-special")) {
player.sendMessage(Configs.LANG.getMessage("got-special"));
if (gotSpecial && this.getPlugin().getConfigYml().getBool("enchanting-table.notify-on-special")) {
player.sendMessage(this.getPlugin().getLangYml().getMessage("got-special"));
}
// Ew
@ -227,7 +226,7 @@ public class EnchantingListeners extends PluginDependent implements Listener {
*/
@EventHandler
public void secondaryEnchant(@NotNull final PrepareItemEnchantEvent event) {
int maxLevel = Configs.CONFIG.getInt("enchanting-table.maximum-obtainable-level");
int maxLevel = this.getPlugin().getConfigYml().getInt("enchanting-table.maximum-obtainable-level");
try {
event.getOffers()[2].setCost(NumberUtils.equalIfOver(event.getOffers()[2].getCost(), maxLevel));

View File

@ -1,8 +1,7 @@
package com.willfp.ecoenchants.enchantments.support.obtaining;
import com.willfp.eco.util.NumberUtils;
import com.willfp.eco.util.config.Configs;
import com.willfp.ecoenchants.EcoEnchantsPlugin;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget;
@ -28,6 +27,20 @@ import java.util.Random;
import java.util.concurrent.atomic.AtomicBoolean;
public class LootPopulator extends BlockPopulator {
/**
* Instance of ecoenchants.
*/
private final EcoEnchantsPlugin plugin;
/**
* Create a new loot populator.
*
* @param plugin The plugin.
*/
public LootPopulator(@NotNull final EcoEnchantsPlugin plugin) {
this.plugin = plugin;
}
/**
* Populate a chunk's loot chests.
*
@ -38,7 +51,7 @@ public class LootPopulator extends BlockPopulator {
public void populate(@NotNull final World world,
@NotNull final Random random,
@NotNull final Chunk chunk) {
if (!Configs.CONFIG.getBool("loot.enabled")) {
if (!plugin.getConfigYml().getBool("loot.enabled")) {
return;
}
@ -69,11 +82,11 @@ public class LootPopulator extends BlockPopulator {
double multiplier = 0.01;
if (item.getType().equals(Material.BOOK) || item.getType().equals(Material.ENCHANTED_BOOK)) {
multiplier /= Configs.CONFIG.getInt("loot.book-times-less-likely");
multiplier /= plugin.getConfigYml().getInt("loot.book-times-less-likely");
}
if (Configs.CONFIG.getBool("loot.reduce-probability.enabled")) {
multiplier /= Configs.CONFIG.getDouble("loot.reduce-probability.factor");
if (plugin.getConfigYml().getBool("loot.reduce-probability.enabled")) {
multiplier /= plugin.getConfigYml().getDouble("loot.reduce-probability.factor");
}
for (EcoEnchant enchantment : enchantments) {
@ -119,7 +132,7 @@ public class LootPopulator extends BlockPopulator {
if (enchantment.getType().equals(EnchantmentType.SPECIAL)) {
double enchantlevel1 = NumberUtils.randFloat(0, 1);
double enchantlevel2 = NumberUtils.bias(enchantlevel1, Configs.CONFIG.getDouble("enchanting-table.special-bias"));
double enchantlevel2 = NumberUtils.bias(enchantlevel1, plugin.getConfigYml().getDouble("enchanting-table.special-bias"));
double enchantlevel3 = 1 / (double) enchantment.getMaxLevel();
level = (int) Math.ceil(enchantlevel2 / enchantlevel3);
} else {
@ -130,8 +143,8 @@ public class LootPopulator extends BlockPopulator {
toAdd.put(enchantment, level);
if (Configs.CONFIG.getBool("loot.reduce-probability.enabled")) {
multiplier /= Configs.CONFIG.getDouble("loot.reduce-probability.factor");
if (plugin.getConfigYml().getBool("loot.reduce-probability.enabled")) {
multiplier /= plugin.getConfigYml().getDouble("loot.reduce-probability.factor");
}
}

View File

@ -2,7 +2,8 @@ package com.willfp.ecoenchants.enchantments.support.obtaining;
import com.willfp.eco.util.NumberUtils;
import com.willfp.eco.util.config.Configs;
import com.willfp.eco.util.internal.PluginDependent;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget;
@ -24,7 +25,16 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
public class VillagerListeners implements Listener {
public class VillagerListeners extends PluginDependent implements Listener {
/**
* Create new villager listeners.
*
* @param plugin The plugin.
*/
public VillagerListeners(@NotNull final AbstractEcoPlugin plugin) {
super(plugin);
}
/**
* Called on villager gain trade.
*
@ -36,7 +46,7 @@ public class VillagerListeners implements Listener {
return;
}
if (!Configs.CONFIG.getBool("villager.enabled")) {
if (!this.getPlugin().getConfigYml().getBool("villager.enabled")) {
return;
}
@ -57,7 +67,7 @@ public class VillagerListeners implements Listener {
ArrayList<EcoEnchant> enchantments = new ArrayList<>(EcoEnchants.values());
Collections.shuffle(enchantments); // Prevent list bias towards early enchantments like telekinesis
double multiplier = 0.01 / Configs.CONFIG.getDouble("villager.book-times-less-likely");
double multiplier = 0.01 / this.getPlugin().getConfigYml().getDouble("villager.book-times-less-likely");
for (EcoEnchant enchantment : enchantments) {
if (NumberUtils.randFloat(0, 1) > enchantment.getRarity().getVillagerProbability() * multiplier) {
@ -76,7 +86,7 @@ public class VillagerListeners implements Listener {
if (enchantment.getType().equals(EnchantmentType.SPECIAL)) {
double enchantlevel1 = NumberUtils.randFloat(0, 1);
double enchantlevel2 = NumberUtils.bias(enchantlevel1, Configs.CONFIG.getDouble("enchanting-table.special-bias"));
double enchantlevel2 = NumberUtils.bias(enchantlevel1, this.getPlugin().getConfigYml().getDouble("enchanting-table.special-bias"));
double enchantlevel3 = 1 / (double) enchantment.getMaxLevel();
level = (int) Math.ceil(enchantlevel2 / enchantlevel3);
} else {
@ -116,7 +126,7 @@ public class VillagerListeners implements Listener {
return;
}
if (!Configs.CONFIG.getBool("villager.enabled")) {
if (!this.getPlugin().getConfigYml().getBool("villager.enabled")) {
return;
}
@ -183,7 +193,7 @@ public class VillagerListeners implements Listener {
if (enchantment.getType().equals(EnchantmentType.SPECIAL)) {
double enchantlevel1 = NumberUtils.randFloat(0, 1);
double enchantlevel2 = NumberUtils.bias(enchantlevel1, Configs.CONFIG.getDouble("enchanting-table.special-bias"));
double enchantlevel2 = NumberUtils.bias(enchantlevel1, this.getPlugin().getConfigYml().getDouble("enchanting-table.special-bias"));
double enchantlevel3 = 1 / (double) enchantment.getMaxLevel();
level = (int) Math.ceil(enchantlevel2 / enchantlevel3);
} else {
@ -196,8 +206,8 @@ public class VillagerListeners implements Listener {
toAdd.put(enchantment, level);
if (Configs.CONFIG.getBool("villager.reduce-probability.enabled")) {
multiplier /= Configs.CONFIG.getDouble("villager.reduce-probability.factor");
if (this.getPlugin().getConfigYml().getBool("villager.reduce-probability.enabled")) {
multiplier /= this.getPlugin().getConfigYml().getDouble("villager.reduce-probability.factor");
}
}

View File

@ -1,11 +1,12 @@
package com.willfp.ecoenchants.enchantments.util;
import com.willfp.ecoenchants.proxy.proxies.FastGetEnchantsProxy;
import com.willfp.eco.util.DurabilityUtils;
import com.willfp.eco.util.ProxyUtils;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.proxy.proxies.FastGetEnchantsProxy;
import com.willfp.ecoenchants.proxy.proxies.RepairCostProxy;
import com.willfp.ecoenchants.util.ProxyUtils;
import lombok.experimental.UtilityClass;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;

View File

@ -1,14 +1,14 @@
package com.willfp.ecoenchants.enchantments.util;
import com.google.common.collect.Sets;
import com.willfp.ecoenchants.proxy.proxies.TridentStackProxy;
import com.willfp.eco.util.ProxyUtils;
import com.willfp.eco.util.events.armorequip.ArmorEquipEvent;
import com.willfp.eco.util.internal.PluginDependent;
import com.willfp.eco.util.integrations.antigrief.AntigriefManager;
import com.willfp.eco.util.internal.PluginDependent;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.integrations.mcmmo.McmmoManager;
import com.willfp.ecoenchants.proxy.proxies.TridentStackProxy;
import com.willfp.ecoenchants.util.ProxyUtils;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Arrow;

View File

@ -0,0 +1,21 @@
package com.willfp.ecoenchants.util;
import com.willfp.eco.util.proxy.AbstractProxy;
import com.willfp.ecoenchants.EcoEnchantsPlugin;
import com.willfp.ecoenchants.proxy.util.ProxyFactory;
import lombok.experimental.UtilityClass;
import org.jetbrains.annotations.NotNull;
@UtilityClass
public class ProxyUtils {
/**
* Get the implementation of a specified proxy.
*
* @param proxyClass The proxy interface.
* @param <T> The type of the proxy.
* @return The proxy implementation.
*/
public @NotNull <T extends AbstractProxy> T getProxy(@NotNull final Class<T> proxyClass) {
return new ProxyFactory<>(EcoEnchantsPlugin.getInstance(), proxyClass).getProxy();
}
}

View File

@ -0,0 +1,75 @@
package com.willfp.ecoenchants.proxy.util;
import com.willfp.eco.util.internal.PluginDependent;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.eco.util.proxy.AbstractProxy;
import com.willfp.eco.util.proxy.ProxyConstants;
import com.willfp.eco.util.proxy.UnsupportedVersionException;
import org.jetbrains.annotations.NotNull;
import java.util.IdentityHashMap;
import java.util.Map;
public class ProxyFactory<T extends AbstractProxy> extends PluginDependent {
/**
* Cached proxy implementations in order to not perform expensive reflective class-finding.
*/
private static final Map<Class<? extends AbstractProxy>, AbstractProxy> CACHE = new IdentityHashMap<>();
/**
* The class of the proxy interface.
*/
private final Class<T> proxyClass;
/**
* Create a new Proxy Factory for a specific type.
*
* @param plugin The plugin to create proxies for.
* @param proxyClass The class of the proxy interface.
*/
public ProxyFactory(@NotNull final AbstractEcoPlugin plugin,
@NotNull final Class<T> proxyClass) {
super(plugin);
this.proxyClass = proxyClass;
}
/**
* Get the implementation of a proxy.
*
* @return The proxy implementation.
*/
public @NotNull T getProxy() {
try {
T cachedProxy = attemptCache();
if (cachedProxy != null) {
return cachedProxy;
}
String className = this.getPlugin().getProxyPackage() + "." + ProxyConstants.NMS_VERSION + "." + proxyClass.getSimpleName().replace("Proxy", "");
final Class<?> class2 = Class.forName(className);
Object instance = class2.getConstructor().newInstance();
if (proxyClass.isAssignableFrom(class2) && proxyClass.isInstance(instance)) {
T proxy = proxyClass.cast(instance);
CACHE.put(proxyClass, proxy);
return proxy;
}
} catch (Exception e) {
// If not returned, then throw error
}
throw new UnsupportedVersionException("You're running an unsupported server version: " + ProxyConstants.NMS_VERSION);
}
private T attemptCache() {
Object proxy = CACHE.get(proxyClass);
if (proxy == null) {
return null;
}
if (proxyClass.isInstance(proxy)) {
return proxyClass.cast(proxy);
}
return null;
}
}

View File

@ -1,5 +1,5 @@
group 'com.willfp'
version '3.0.1'
version '4.0.0'
description = 'Alchemy Extension'
shadowJar {

View File

@ -1,7 +1,9 @@
package com.willfp.ecoenchants.alchemy;
import com.willfp.eco.util.extensions.Extension;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import org.jetbrains.annotations.NotNull;
public class AlchemyMain extends Extension {
/**
@ -9,6 +11,10 @@ public class AlchemyMain extends Extension {
*/
public static final EcoEnchant ALCHEMY = new Alchemy();
public AlchemyMain(@NotNull final AbstractEcoPlugin plugin) {
super(plugin);
}
@Override
public void onEnable() {
// Handled by super

View File

@ -1,5 +1,5 @@
group 'com.willfp'
version '3.0.1'
version '4.0.0'
description = 'Biomes Extension'
shadowJar {

View File

@ -2,6 +2,7 @@ package com.willfp.ecoenchants.biomes;
import com.willfp.eco.util.extensions.Extension;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.ecoenchants.biomes.enchants.defensive.Elevation;
import com.willfp.ecoenchants.biomes.enchants.defensive.Glacial;
import com.willfp.ecoenchants.biomes.enchants.defensive.HeatTreated;
@ -13,6 +14,7 @@ import com.willfp.ecoenchants.biomes.enchants.offensive.Dehydration;
import com.willfp.ecoenchants.biomes.enchants.offensive.Icelord;
import com.willfp.ecoenchants.biomes.enchants.offensive.Rainforest;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import org.jetbrains.annotations.NotNull;
public class BiomesMain extends Extension {
public static final EcoEnchant ELEVATION = new Elevation();
@ -26,6 +28,10 @@ public class BiomesMain extends Extension {
public static final EcoEnchant ICELORD = new Icelord();
public static final EcoEnchant RAINFOREST = new Rainforest();
public BiomesMain(@NotNull final AbstractEcoPlugin plugin) {
super(plugin);
}
@Override
public void onEnable() {
// Handled by super

View File

@ -1,5 +1,5 @@
group 'com.willfp'
version '3.0.1'
version '4.0.0'
description = 'Effects Extension'
shadowJar {

View File

@ -2,12 +2,14 @@ package com.willfp.ecoenchants.effects;
import com.willfp.eco.util.extensions.Extension;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.ecoenchants.effects.enchants.JumpBoost;
import com.willfp.ecoenchants.effects.enchants.NightVision;
import com.willfp.ecoenchants.effects.enchants.Regeneration;
import com.willfp.ecoenchants.effects.enchants.Speed;
import com.willfp.ecoenchants.effects.enchants.WaterBreathing;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import org.jetbrains.annotations.NotNull;
public class EffectsMain extends Extension {
public static final EcoEnchant JUMP_BOOST = new JumpBoost();
@ -16,6 +18,10 @@ public class EffectsMain extends Extension {
public static final EcoEnchant SPEED = new Speed();
public static final EcoEnchant WATER_BREATHING = new WaterBreathing();
public EffectsMain(@NotNull final AbstractEcoPlugin plugin) {
super(plugin);
}
@Override
public void onEnable() {
// Handled by super

View File

@ -1,5 +1,5 @@
group 'com.willfp'
version '3.0.1'
version '4.0.0'
description = 'Endershot Extension'
shadowJar {

View File

@ -2,11 +2,17 @@ package com.willfp.ecoenchants.endershot;
import com.willfp.eco.util.extensions.Extension;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import org.jetbrains.annotations.NotNull;
public class EndershotMain extends Extension {
public static final EcoEnchant ENDERSHOT = new Endershot();
public EndershotMain(@NotNull final AbstractEcoPlugin plugin) {
super(plugin);
}
@Override
public void onEnable() {
// Handled by super

View File

@ -1,5 +1,5 @@
group 'com.willfp'
version '3.0.1'
version '4.0.0'
description = 'Firewand Extension'
shadowJar {

View File

@ -1,11 +1,17 @@
package com.willfp.ecoenchants.firewand;
import com.willfp.eco.util.extensions.Extension;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import org.jetbrains.annotations.NotNull;
public class FirewandMain extends Extension {
public static final EcoEnchant FIREWAND = new Firewand();
public FirewandMain(@NotNull final AbstractEcoPlugin plugin) {
super(plugin);
}
@Override
public void onEnable() {
// Handled by super

View File

@ -1,5 +1,5 @@
group 'com.willfp'
version '3.0.1'
version '4.0.0'
description = 'MMO Extension'
repositories {
@ -9,7 +9,7 @@ repositories {
}
dependencies {
compileOnly 'net.Indyuce:MMOCore:1.6'
compileOnly 'net.Indyuce:MMOCore:1.6.2'
compileOnly 'net.Indyuce:MMOItems:6.5'
compileOnly 'net.Indyuce:MMOLib:1.7.3'
}
@ -18,6 +18,6 @@ configurations.all {
exclude group: 'com.mojang', module: 'authlib'
}
jar {
shadowJar {
archiveFileName = project.getDescription() + " v" + project.version + ".jar"
}

View File

@ -1,20 +1,10 @@
package com.willfp.ecoenchants.mmo;
import com.willfp.eco.util.extensions.Extension;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.mmo.enchants.abilities.Discounted;
import com.willfp.ecoenchants.mmo.enchants.abilities.Recover;
import com.willfp.ecoenchants.mmo.enchants.mana.Augment;
import com.willfp.ecoenchants.mmo.enchants.mana.Drain;
import com.willfp.ecoenchants.mmo.enchants.mana.Elixir;
import com.willfp.ecoenchants.mmo.enchants.mana.Siphon;
import com.willfp.ecoenchants.mmo.enchants.mana.Spirituality;
import com.willfp.ecoenchants.mmo.enchants.misc.Strengthening;
import com.willfp.ecoenchants.mmo.enchants.stamina.Athletic;
import com.willfp.ecoenchants.mmo.enchants.stamina.Endurance;
import com.willfp.ecoenchants.mmo.enchants.stamina.Fortitude;
import com.willfp.ecoenchants.mmo.enchants.stamina.Motivate;
import org.bukkit.Bukkit;
import org.jetbrains.annotations.NotNull;
public class MMOMain extends Extension {
public static final EcoEnchant ELIXIR = new Elixir();
@ -30,9 +20,13 @@ public class MMOMain extends Extension {
public static final EcoEnchant ATHLETIC = new Athletic();
public static final EcoEnchant STRENGTHENING = new Strengthening();
public MMOMain(@NotNull final AbstractEcoPlugin plugin) {
super(plugin);
}
@Override
protected void onEnable() {
if(!MMOPrerequisites.HAS_MMOCORE.isMet()) {
if (!MMOPrerequisites.HAS_MMOCORE.isMet()) {
Bukkit.getLogger().severe("MMO Extension requires MMOCore to be installed!");
Bukkit.getLogger().severe("Disabling...");
this.disable();

View File

@ -1,6 +1,5 @@
package com.willfp.ecoenchants.mmo;
import com.willfp.eco.util.optional.Prerequisite;
import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin;

View File

@ -1,7 +1,5 @@
package com.willfp.ecoenchants.mmo.enchants.mana;
import com.willfp.eco.util.ProxyUtils;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.mmo.integrations.mmo.MMOManager;

View File

@ -1,14 +1,8 @@
package com.willfp.ecoenchants.mmo.enchants.misc;
import com.willfp.eco.util.events.armorequip.ArmorEquipEvent;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.mmo.structure.MMOEnchantment;
import net.mmogroup.mmolib.MMOLib;
import net.mmogroup.mmolib.api.player.MMOPlayerData;
import net.mmogroup.mmolib.api.stat.SharedStat;
import net.mmogroup.mmolib.api.stat.modifier.StatModifier;
import org.bukkit.entity.Player;
public class Strengthening extends MMOEnchantment {

View File

@ -1,7 +1,5 @@
package com.willfp.ecoenchants.mmo.enchants.stamina;
import com.willfp.eco.util.ProxyUtils;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.mmo.integrations.mmo.MMOManager;

View File

@ -1,10 +1,8 @@
package com.willfp.ecoenchants.mmo.structure;
import com.willfp.eco.util.optional.Prerequisite;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.mmo.MMOPrerequisites;
public abstract class MMOEnchantment extends EcoEnchant implements MMOEnchant {
protected MMOEnchantment(String key, EnchantmentType type, Prerequisite... prerequisites) {

View File

@ -1,5 +1,5 @@
group 'com.willfp'
version '3.0.1'
version '4.0.0'
description = 'Precision Extension'
shadowJar {

View File

@ -1,12 +1,12 @@
package com.willfp.ecoenchants.precision;
import com.willfp.ecoenchants.proxy.proxies.TridentStackProxy;
import com.willfp.eco.util.ProxyUtils;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
import com.willfp.ecoenchants.proxy.proxies.TridentStackProxy;
import com.willfp.ecoenchants.util.ProxyUtils;
import org.bukkit.GameMode;
import org.bukkit.entity.Enderman;
import org.bukkit.entity.LivingEntity;

View File

@ -1,11 +1,17 @@
package com.willfp.ecoenchants.precision;
import com.willfp.eco.util.extensions.Extension;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import org.jetbrains.annotations.NotNull;
public class PrecisionMain extends Extension {
public static final EcoEnchant PRECISION = new Precision();
public PrecisionMain(@NotNull final AbstractEcoPlugin plugin) {
super(plugin);
}
@Override
public void onEnable() {
// Handled by super

View File

@ -1,5 +1,5 @@
group 'com.willfp'
version '3.0.1'
version '4.0.0'
description = 'Sprint Artifacts Extension'
shadowJar {

View File

@ -1,9 +1,15 @@
package com.willfp.ecoenchants.sprintartifacts;
import com.willfp.eco.util.extensions.Extension;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import org.bukkit.Bukkit;
import org.jetbrains.annotations.NotNull;
public class SprintArtifactsMain extends Extension {
public SprintArtifactsMain(@NotNull final AbstractEcoPlugin plugin) {
super(plugin);
}
@Override
public void onEnable() {
Bukkit.getPluginManager().registerEvents(new SprintArtifactsListener(), this.getPlugin());

View File

@ -1,5 +1,5 @@
group 'com.willfp'
version '3.0.1'
version '4.0.0'
description = 'Summoning Extension'
shadowJar {

View File

@ -1,13 +1,13 @@
package com.willfp.ecoenchants.summoning;
import com.willfp.ecoenchants.proxy.proxies.CooldownProxy;
import com.willfp.eco.util.NumberUtils;
import com.willfp.eco.util.ProxyUtils;
import com.willfp.eco.util.optional.Prerequisite;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
import com.willfp.ecoenchants.proxy.proxies.CooldownProxy;
import com.willfp.ecoenchants.util.ProxyUtils;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.attribute.Attribute;

View File

@ -1,12 +1,14 @@
package com.willfp.ecoenchants.summoning;
import com.willfp.eco.util.extensions.Extension;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.summoning.enchants.Crawler;
import com.willfp.ecoenchants.summoning.enchants.Firestorm;
import com.willfp.ecoenchants.summoning.enchants.Ghoul;
import com.willfp.ecoenchants.summoning.enchants.Metallic;
import com.willfp.ecoenchants.summoning.enchants.Mortality;
import org.jetbrains.annotations.NotNull;
public class SummoningMain extends Extension {
public static final EcoEnchant METALLIC = new Metallic();
@ -15,6 +17,10 @@ public class SummoningMain extends Extension {
public static final EcoEnchant GHOUL = new Ghoul();
public static final EcoEnchant CRAWLER = new Crawler();
public SummoningMain(@NotNull final AbstractEcoPlugin plugin) {
super(plugin);
}
@Override
public void onEnable() {
// Handled by super

View File

@ -1,5 +1,5 @@
group 'com.willfp'
version '1.0.2'
version '2.0.0'
description = 'Xray Extension'
shadowJar {

View File

@ -1,11 +1,17 @@
package com.willfp.ecoenchants.xray;
import com.willfp.eco.util.extensions.Extension;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import org.jetbrains.annotations.NotNull;
public class XrayMain extends Extension {
public static final EcoEnchant XRAY = new Xray();
public XrayMain(@NotNull final AbstractEcoPlugin plugin) {
super(plugin);
}
@Override
public void onEnable() {
// Handled by super