Skip to content

Commit

Permalink
Updated to eco 5.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
WillFP committed Apr 4, 2021
1 parent 0ee1c96 commit 6f754d9
Show file tree
Hide file tree
Showing 21 changed files with 89 additions and 81 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ allprojects {
}

dependencies {
compileOnly 'com.willfp:eco:4.3.1'
compileOnly 'com.willfp:eco:5.0.0'

compileOnly 'org.jetbrains:annotations:19.0.0'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.willfp.ecoarmor;

import com.willfp.eco.util.command.AbstractCommand;
import com.willfp.eco.util.display.DisplayModule;
import com.willfp.eco.util.integrations.IntegrationLoader;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.eco.util.protocollib.AbstractPacketAdapter;
import com.willfp.eco.core.AbstractPacketAdapter;
import com.willfp.eco.core.EcoPlugin;
import com.willfp.eco.core.command.AbstractCommand;
import com.willfp.eco.core.display.DisplayModule;
import com.willfp.eco.core.integrations.IntegrationLoader;
import com.willfp.ecoarmor.commands.CommandEagive;
import com.willfp.ecoarmor.commands.CommandEareload;
import com.willfp.ecoarmor.commands.TabcompleterEagive;
Expand All @@ -29,7 +29,7 @@
import java.util.List;

@SuppressWarnings("unused")
public class EcoArmorPlugin extends AbstractEcoPlugin {
public class EcoArmorPlugin extends EcoPlugin {
/**
* Instance of EcoArmor.
*/
Expand All @@ -52,10 +52,10 @@ public void enable() {
this.getExtensionLoader().loadExtensions();

if (this.getExtensionLoader().getLoadedExtensions().isEmpty()) {
this.getLog().info("&cNo extensions found");
this.getLogger().info("&cNo extensions found");
} else {
this.getLog().info("Extensions Loaded:");
this.getExtensionLoader().getLoadedExtensions().forEach(extension -> this.getLog().info("- " + extension.getName() + " v" + extension.getVersion()));
this.getLogger().info("Extensions Loaded:");
this.getExtensionLoader().getLoadedExtensions().forEach(extension -> this.getLogger().info("- " + extension.getName() + " v" + extension.getVersion()));
}

Effects.values().stream().filter(Effect::isEnabled).forEach(effect -> this.getEventManager().registerListener(effect));
Expand Down Expand Up @@ -85,7 +85,7 @@ public void load() {
public void onReload() {
Effects.values().forEach(effect -> this.getEventManager().unregisterListener(effect));
Effects.values().stream().filter(Effect::isEnabled).forEach(effect -> this.getEventManager().registerListener(effect));
this.getLog().info(ArmorSets.values().size() + " Sets Loaded");
this.getLogger().info(ArmorSets.values().size() + " Sets Loaded");
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.willfp.ecoarmor.commands;

import com.willfp.eco.util.command.AbstractCommand;
import com.willfp.eco.util.command.AbstractTabCompleter;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.eco.core.EcoPlugin;
import com.willfp.eco.core.command.AbstractCommand;
import com.willfp.eco.core.command.AbstractTabCompleter;
import com.willfp.ecoarmor.sets.ArmorSet;
import com.willfp.ecoarmor.sets.ArmorSets;
import com.willfp.ecoarmor.sets.meta.ArmorSlot;
Expand All @@ -26,7 +26,7 @@ public class CommandEagive extends AbstractCommand {
*
* @param plugin The plugin for the commands to listen for.
*/
public CommandEagive(@NotNull final AbstractEcoPlugin plugin) {
public CommandEagive(@NotNull final EcoPlugin plugin) {
super(plugin, "eagive", "ecoarmor.give", false);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package com.willfp.ecoarmor.commands;

import com.willfp.eco.util.command.AbstractCommand;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;

import com.willfp.eco.core.EcoPlugin;
import com.willfp.eco.core.command.AbstractCommand;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;

Expand All @@ -13,7 +14,7 @@ public class CommandEareload extends AbstractCommand {
*
* @param plugin The plugin for the commands to listen for.
*/
public CommandEareload(@NotNull final AbstractEcoPlugin plugin) {
public CommandEareload(@NotNull final EcoPlugin plugin) {
super(plugin, "eareload", "ecoarmor.reload", false);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.willfp.ecoarmor.commands;

import com.willfp.eco.util.command.AbstractTabCompleter;
import com.willfp.eco.util.config.updating.annotations.ConfigUpdater;
import com.willfp.eco.core.command.AbstractTabCompleter;
import com.willfp.eco.core.config.ConfigUpdater;
import com.willfp.ecoarmor.sets.ArmorSets;
import com.willfp.ecoarmor.sets.meta.ArmorSlot;
import com.willfp.ecoarmor.upgrades.Tier;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.willfp.ecoarmor.config;

import com.willfp.eco.util.config.ExtendableConfig;
import com.willfp.eco.core.config.ExtendableConfig;
import com.willfp.ecoarmor.EcoArmorPlugin;
import org.jetbrains.annotations.NotNull;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.willfp.ecoarmor.config;

import com.willfp.eco.util.config.ExtendableConfig;
import com.willfp.eco.core.config.ExtendableConfig;
import com.willfp.ecoarmor.EcoArmorPlugin;
import org.jetbrains.annotations.NotNull;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
package com.willfp.ecoarmor.config;

import com.willfp.eco.util.config.StaticOptionalConfig;
import com.willfp.eco.core.config.YamlConfig;
import org.bukkit.configuration.file.YamlConfiguration;
import org.jetbrains.annotations.NotNull;

public class CustomConfig extends StaticOptionalConfig {
public class CustomConfig extends YamlConfig {
/**
* The config name.
*/
private final String configName;

/**
* Create new custom config.
*
Expand All @@ -13,6 +18,7 @@ public class CustomConfig extends StaticOptionalConfig {
*/
public CustomConfig(@NotNull final String configName,
@NotNull final YamlConfiguration config) {
super(configName, config);
super(config);
this.configName = configName;
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.willfp.ecoarmor.display;

import com.willfp.eco.core.EcoPlugin;
import com.willfp.eco.core.display.DisplayModule;
import com.willfp.eco.core.display.DisplayPriority;
import com.willfp.eco.util.SkullUtils;
import com.willfp.eco.util.display.DisplayModule;
import com.willfp.eco.util.display.DisplayPriority;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.ecoarmor.sets.ArmorSet;
import com.willfp.ecoarmor.sets.meta.ArmorSlot;
import com.willfp.ecoarmor.sets.util.ArmorUtils;
Expand All @@ -23,7 +23,7 @@ public class ArmorDisplay extends DisplayModule {
*
* @param plugin Instance of EcoArmor.
*/
public ArmorDisplay(@NotNull final AbstractEcoPlugin plugin) {
public ArmorDisplay(@NotNull final EcoPlugin plugin) {
super(plugin, DisplayPriority.LOWEST);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.willfp.ecoarmor.effects.effects;

import com.willfp.eco.util.events.naturalexpgainevent.NaturalExpGainEvent;
import com.willfp.eco.core.events.NaturalExpGainEvent;
import com.willfp.ecoarmor.effects.Effect;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.willfp.ecoarmor.effects.util;

import com.willfp.eco.util.events.armorequip.ArmorEquipEvent;
import com.willfp.eco.util.internal.PluginDependent;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.eco.core.EcoPlugin;
import com.willfp.eco.core.PluginDependent;
import com.willfp.eco.core.events.ArmorEquipEvent;
import com.willfp.ecoarmor.effects.Effect;
import com.willfp.ecoarmor.effects.Effects;
import com.willfp.ecoarmor.sets.ArmorSet;
Expand All @@ -15,11 +15,11 @@

public class EffectWatcher extends PluginDependent implements Listener {
/**
* Pass an {@link AbstractEcoPlugin} in order to interface with it.
* Pass an {@link EcoPlugin} in order to interface with it.
*
* @param plugin The plugin to manage.
*/
public EffectWatcher(@NotNull final AbstractEcoPlugin plugin) {
public EffectWatcher(@NotNull final EcoPlugin plugin) {
super(plugin);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.willfp.ecoarmor.sets;

import com.willfp.eco.core.config.Config;
import com.willfp.eco.core.display.Display;
import com.willfp.eco.core.items.CustomItem;
import com.willfp.eco.core.items.Items;
import com.willfp.eco.core.recipe.recipes.ShapedCraftingRecipe;
import com.willfp.eco.util.SkullUtils;
import com.willfp.eco.util.StringUtils;
import com.willfp.eco.util.config.Config;
import com.willfp.eco.util.display.Display;
import com.willfp.eco.util.recipe.RecipeParts;
import com.willfp.eco.util.recipe.parts.ComplexRecipePart;
import com.willfp.eco.util.recipe.recipes.EcoShapedRecipe;
import com.willfp.ecoarmor.EcoArmorPlugin;
import com.willfp.ecoarmor.conditions.Condition;
import com.willfp.ecoarmor.conditions.Conditions;
Expand Down Expand Up @@ -221,15 +221,15 @@ private ItemStack constructShard() {
shardItem.setItemMeta(shardMeta);

if (this.getConfig().getBool("shard-craftable")) {
EcoShapedRecipe.Builder builder = EcoShapedRecipe.builder(PLUGIN, this.getName() + "_shard").setOutput(shardItem);
ShapedCraftingRecipe.Builder builder = ShapedCraftingRecipe.builder(PLUGIN, this.getName() + "_shard").setOutput(shardItem);

List<String> recipeStrings = this.getConfig().getStrings("shard-recipe");

for (int i = 0; i < 9; i++) {
builder.setRecipePart(i, RecipeParts.lookup(recipeStrings.get(i)));
builder.setRecipePart(i, Items.lookup(recipeStrings.get(i)));
}

EcoShapedRecipe recipe = builder.build();
ShapedCraftingRecipe recipe = builder.build();
recipe.register();
}

Expand Down Expand Up @@ -328,25 +328,25 @@ private ItemStack construct(@NotNull final ArmorSlot slot,
}

if (advanced) {
RecipeParts.registerRecipePart(PLUGIN.getNamespacedKeyFactory().create("set_" + name.toLowerCase() + "_" + slot.name().toLowerCase() + "_advanced"), new ComplexRecipePart(test -> {
new CustomItem(PLUGIN.getNamespacedKeyFactory().create("set_" + name.toLowerCase() + "_" + slot.name().toLowerCase() + "_advanced"), test -> {
if (ArmorSlot.getSlot(test) != ArmorSlot.getSlot(itemStack)) {
return false;
}
if (!ArmorUtils.isAdvanced(itemStack)) {
return false;
}
return Objects.equals(this, ArmorUtils.getSetOnItem(test));
}, itemStack));
}, itemStack).register();
} else {
RecipeParts.registerRecipePart(PLUGIN.getNamespacedKeyFactory().create("set_" + name.toLowerCase() + "_" + slot.name().toLowerCase()), new ComplexRecipePart(test -> {
new CustomItem(PLUGIN.getNamespacedKeyFactory().create("set_" + name.toLowerCase() + "_" + slot.name().toLowerCase()), test -> {
if (ArmorSlot.getSlot(test) != ArmorSlot.getSlot(itemStack)) {
return false;
}
if (ArmorUtils.isAdvanced(itemStack)) {
return false;
}
return Objects.equals(this, ArmorUtils.getSetOnItem(test));
}, itemStack));
}, itemStack).register();
}

return itemStack;
Expand All @@ -356,15 +356,15 @@ private void constructRecipe(@NotNull final ArmorSlot slot,
@NotNull final Config slotConfig,
@NotNull final ItemStack out) {
if (slotConfig.getBool("craftable")) {
EcoShapedRecipe.Builder builder = EcoShapedRecipe.builder(PLUGIN, this.getName() + "_" + slot.name().toLowerCase()).setOutput(out);
ShapedCraftingRecipe.Builder builder = ShapedCraftingRecipe.builder(PLUGIN, this.getName() + "_" + slot.name().toLowerCase()).setOutput(out);

List<String> recipeStrings = slotConfig.getStrings("recipe");

for (int i = 0; i < 9; i++) {
builder.setRecipePart(i, RecipeParts.lookup(recipeStrings.get(i)));
builder.setRecipePart(i, Items.lookup(recipeStrings.get(i)));
}

EcoShapedRecipe recipe = builder.build();
ShapedCraftingRecipe recipe = builder.build();
recipe.register();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import com.google.common.collect.ImmutableList;
import com.willfp.eco.util.config.updating.annotations.ConfigUpdater;
import com.willfp.eco.core.config.ConfigUpdater;
import com.willfp.ecoarmor.EcoArmorPlugin;
import com.willfp.ecoarmor.config.BaseEcoArmorConfig;
import com.willfp.ecoarmor.config.CustomConfig;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.willfp.ecoarmor.sets.util;

import com.willfp.eco.core.EcoPlugin;
import com.willfp.eco.core.PluginDependent;
import com.willfp.eco.util.NumberUtils;
import com.willfp.eco.util.internal.PluginDependent;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerItemDamageEvent;
Expand All @@ -18,7 +18,7 @@ public class EffectiveDurabilityListener extends PluginDependent implements List
*
* @param plugin The plugin.
*/
public EffectiveDurabilityListener(@NotNull final AbstractEcoPlugin plugin) {
public EffectiveDurabilityListener(@NotNull final EcoPlugin plugin) {
super(plugin);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package com.willfp.ecoarmor.upgrades;

import com.willfp.eco.core.EcoPlugin;
import com.willfp.eco.core.PluginDependent;
import com.willfp.eco.core.config.Config;
import com.willfp.eco.core.display.Display;
import com.willfp.eco.core.items.CustomItem;
import com.willfp.eco.core.items.Items;
import com.willfp.eco.core.recipe.recipes.ShapedCraftingRecipe;
import com.willfp.eco.util.StringUtils;
import com.willfp.eco.util.config.Config;
import com.willfp.eco.util.display.Display;
import com.willfp.eco.util.internal.PluginDependent;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.eco.util.recipe.RecipeParts;
import com.willfp.eco.util.recipe.parts.ComplexRecipePart;
import com.willfp.eco.util.recipe.recipes.EcoShapedRecipe;
import com.willfp.ecoarmor.sets.meta.ArmorSlot;
import com.willfp.ecoarmor.sets.util.ArmorUtils;
import lombok.AccessLevel;
Expand Down Expand Up @@ -68,7 +68,7 @@ public class Tier extends PluginDependent {
* The crafting recipe to make the crystal.
*/
@Getter
private EcoShapedRecipe crystalRecipe;
private ShapedCraftingRecipe crystalRecipe;

/**
* Item properties.
Expand All @@ -85,7 +85,7 @@ public class Tier extends PluginDependent {
*/
public Tier(@NotNull final String tierName,
@NotNull final Config config,
@NotNull final AbstractEcoPlugin plugin) {
@NotNull final EcoPlugin plugin) {
super(plugin);
this.name = tierName;
this.config = config;
Expand Down Expand Up @@ -139,23 +139,23 @@ public void update() {
if (this.isEnabled()) {
ItemStack recipeOut = out.clone();
recipeOut.setAmount(this.getConfig().getInt("recipe-give-amount"));
EcoShapedRecipe.Builder builder = EcoShapedRecipe.builder(this.getPlugin(), "upgrade_crystal_" + name)
ShapedCraftingRecipe.Builder builder = ShapedCraftingRecipe.builder(this.getPlugin(), "upgrade_crystal_" + name)
.setOutput(recipeOut);

List<String> recipeStrings = this.getConfig().getStrings("crystal-recipe");

RecipeParts.registerRecipePart(this.getPlugin().getNamespacedKeyFactory().create("upgrade_crystal_" + name), new ComplexRecipePart(test -> {
new CustomItem(this.getPlugin().getNamespacedKeyFactory().create("upgrade_crystal_" + name), test -> {
if (test == null) {
return false;
}
if (ArmorUtils.getCrystalTier(test) == null) {
return false;
}
return this.equals(ArmorUtils.getCrystalTier(test));
}, out));
}, out).register();

for (int i = 0; i < 9; i++) {
builder.setRecipePart(i, RecipeParts.lookup(recipeStrings.get(i)));
builder.setRecipePart(i, Items.lookup(recipeStrings.get(i)));
}

this.crystalRecipe = builder.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import com.google.common.collect.ImmutableList;
import com.willfp.eco.util.config.updating.annotations.ConfigUpdater;
import com.willfp.eco.core.config.ConfigUpdater;
import com.willfp.ecoarmor.EcoArmorPlugin;
import com.willfp.ecoarmor.config.BaseTierConfig;
import com.willfp.ecoarmor.config.CustomConfig;
Expand Down
Loading

0 comments on commit 6f754d9

Please sign in to comment.