Finished eco 5.0.0 rework

This commit is contained in:
Auxilor 2021-04-04 16:24:52 +01:00
parent b3c1ebe79c
commit fb6ee6b14d
36 changed files with 67 additions and 76 deletions

View File

@ -1,6 +1,5 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
import com.willfp.eco.util.optional.Prerequisite;
import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
import org.bukkit.Particle;
import org.jetbrains.annotations.NotNull;
@ -8,8 +7,7 @@ import org.jetbrains.annotations.NotNull;
public class TearArtifact extends Artifact {
public TearArtifact() {
super(
"tear_artifact",
Prerequisite.MINIMUM_1_16
"tear_artifact"
);
}

View File

@ -1,5 +1,6 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.eco.core.drops.DropQueue;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;

View File

@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.eco.core.integrations.anticheat.AnticheatManager;
import com.willfp.eco.core.integrations.antigrief.AntigriefManager;
import com.willfp.eco.core.scheduling.RunnableTask;
import com.willfp.eco.util.VectorUtils;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
@ -14,7 +15,6 @@ import org.bukkit.block.data.Levelled;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
@ -75,7 +75,7 @@ public class MagmaWalker extends EcoEnchant {
long afterTicks = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "remove-after-ticks");
BukkitRunnable replace = this.getPlugin().getRunnableFactory().create(bukkitRunnable -> {
RunnableTask replace = this.getPlugin().getRunnableFactory().create(bukkitRunnable -> {
if (block.getType().equals(Material.OBSIDIAN) && !player.getWorld().getBlockAt(player.getLocation().add(0, -1, 0)).equals(block)) {
block.setType(Material.LAVA);
block.removeMetadata("byMagmaWalker", this.getPlugin());
@ -89,7 +89,7 @@ public class MagmaWalker extends EcoEnchant {
block.setType(Material.LAVA);
block.removeMetadata("byMagmaWalker", this.getPlugin());
} else {
replace.runTaskTimer(this.getPlugin(), afterTicks, afterTicks);
replace.runTaskTimer(afterTicks, afterTicks);
}
}
}, afterTicks);

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
package com.willfp.ecoenchants.biomes;
import com.willfp.eco.util.optional.Prerequisite;
import com.willfp.eco.core.Prerequisite;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;

View File

@ -1,8 +1,7 @@
package com.willfp.ecoenchants.biomes;
import com.willfp.eco.util.extensions.Extension;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.eco.core.EcoPlugin;
import com.willfp.eco.core.extensions.Extension;
import com.willfp.ecoenchants.biomes.enchants.defensive.Elevation;
import com.willfp.ecoenchants.biomes.enchants.defensive.Glacial;
import com.willfp.ecoenchants.biomes.enchants.defensive.HeatTreated;
@ -28,7 +27,7 @@ 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) {
public BiomesMain(@NotNull final EcoPlugin plugin) {
super(plugin);
}

View File

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

View File

@ -1,8 +1,7 @@
package com.willfp.ecoenchants.effects;
import com.willfp.eco.util.events.armorequip.ArmorEquipEvent;
import com.willfp.eco.util.optional.Prerequisite;
import com.willfp.eco.core.Prerequisite;
import com.willfp.eco.core.events.ArmorEquipEvent;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;

View File

@ -1,8 +1,7 @@
package com.willfp.ecoenchants.effects;
import com.willfp.eco.util.extensions.Extension;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.eco.core.EcoPlugin;
import com.willfp.eco.core.extensions.Extension;
import com.willfp.ecoenchants.effects.enchants.JumpBoost;
import com.willfp.ecoenchants.effects.enchants.NightVision;
import com.willfp.ecoenchants.effects.enchants.Regeneration;
@ -18,7 +17,7 @@ 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) {
public EffectsMain(@NotNull final EcoPlugin plugin) {
super(plugin);
}

View File

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

View File

@ -1,6 +1,6 @@
package com.willfp.ecoenchants.endershot;
import com.willfp.eco.util.integrations.mcmmo.McmmoManager;
import com.willfp.eco.core.integrations.mcmmo.McmmoManager;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;

View File

@ -1,15 +1,14 @@
package com.willfp.ecoenchants.endershot;
import com.willfp.eco.util.extensions.Extension;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.eco.core.EcoPlugin;
import com.willfp.eco.core.extensions.Extension;
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) {
public EndershotMain(@NotNull final EcoPlugin plugin) {
super(plugin);
}

View File

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

View File

@ -18,7 +18,7 @@ public class Firewand extends Spell {
}
@Override
public void onUse(@NotNull final Player player,
public boolean onUse(@NotNull final Player player,
final int level,
@NotNull final PlayerInteractEvent event) {
SmallFireball fireball = player.launchProjectile(SmallFireball.class, player.getEyeLocation().getDirection().multiply(this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "velocity")));
@ -28,6 +28,8 @@ public class Firewand extends Spell {
fireball.setMetadata("nobreak", this.getPlugin().getMetadataValueFactory().create(true));
}
fireball.setShooter(player);
return true;
}
@EventHandler(priority = EventPriority.LOW)

View File

@ -1,14 +1,14 @@
package com.willfp.ecoenchants.firewand;
import com.willfp.eco.util.extensions.Extension;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.eco.core.EcoPlugin;
import com.willfp.eco.core.extensions.Extension;
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) {
public FirewandMain(@NotNull final EcoPlugin plugin) {
super(plugin);
}

View File

@ -1,5 +1,5 @@
group 'com.willfp'
version '4.0.1'
version '5.0.0'
description = 'MMO Extension'
repositories {

View File

@ -1,20 +1,12 @@
package com.willfp.ecoenchants.mmo;
import com.willfp.eco.util.extensions.Extension;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.eco.core.EcoPlugin;
import com.willfp.eco.core.extensions.Extension;
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;
@ -32,7 +24,7 @@ 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) {
public MMOMain(@NotNull final EcoPlugin plugin) {
super(plugin);
}

View File

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

View File

@ -1,6 +1,6 @@
package com.willfp.ecoenchants.mmo.enchants.mana;
import com.willfp.eco.util.events.armorequip.ArmorEquipEvent;
import com.willfp.eco.core.events.ArmorEquipEvent;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.mmo.structure.MMOEnchantment;

View File

@ -12,7 +12,7 @@ public class Drain extends MMOSpell {
}
@Override
public void onUse(Player player, int level, PlayerInteractEvent event) {
public boolean onUse(Player player, int level, PlayerInteractEvent event) {
double radius = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "radius-per-level") * level;
double amount = 1 - ((this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "percentage-per-level") / 100) * level);
@ -23,5 +23,7 @@ public class Drain extends MMOSpell {
Player victim = (Player) entity;
MMOManager.setMana(victim, MMOManager.getMana(player) * amount);
});
return true;
}
}

View File

@ -1,6 +1,6 @@
package com.willfp.ecoenchants.mmo.enchants.misc;
import com.willfp.eco.util.events.armorequip.ArmorEquipEvent;
import com.willfp.eco.core.events.ArmorEquipEvent;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.mmo.structure.MMOEnchantment;

View File

@ -1,6 +1,6 @@
package com.willfp.ecoenchants.mmo.enchants.stamina;
import com.willfp.eco.util.events.armorequip.ArmorEquipEvent;
import com.willfp.eco.core.events.ArmorEquipEvent;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.mmo.structure.MMOEnchantment;

View File

@ -1,7 +1,7 @@
package com.willfp.ecoenchants.mmo.integrations.mmo;
import com.willfp.eco.util.integrations.Integration;
import com.willfp.eco.core.integrations.Integration;
import org.bukkit.entity.Player;
public interface MMOIntegration extends Integration {

View File

@ -1,6 +1,5 @@
package com.willfp.ecoenchants.mmo.integrations.mmo;
import org.apache.commons.lang.Validate;
import org.bukkit.entity.Player;
import java.util.HashSet;
@ -14,7 +13,6 @@ public class MMOManager {
}
private static MMOIntegration getIntegration() {
Validate.notEmpty(integrations, "There must be an existing mmo integration!");
return integrations.stream().findFirst().get();
}

View File

@ -1,6 +1,6 @@
package com.willfp.ecoenchants.mmo.structure;
import com.willfp.eco.util.optional.Prerequisite;
import com.willfp.eco.core.Prerequisite;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.mmo.MMOPrerequisites;

View File

@ -1,6 +1,6 @@
package com.willfp.ecoenchants.mmo.structure;
import com.willfp.eco.util.optional.Prerequisite;
import com.willfp.eco.core.Prerequisite;
import com.willfp.ecoenchants.enchantments.itemtypes.Spell;
import com.willfp.ecoenchants.mmo.MMOPrerequisites;

View File

@ -1,14 +1,14 @@
package com.willfp.ecoenchants.precision;
import com.willfp.eco.util.extensions.Extension;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.eco.core.EcoPlugin;
import com.willfp.eco.core.extensions.Extension;
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) {
public PrecisionMain(@NotNull final EcoPlugin plugin) {
super(plugin);
}

View File

@ -1,6 +1,6 @@
package com.willfp.ecoenchants.rainbow;
import com.willfp.eco.util.drops.DropQueue;
import com.willfp.eco.core.drops.DropQueue;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;

View File

@ -1,14 +1,14 @@
package com.willfp.ecoenchants.rainbow;
import com.willfp.eco.util.extensions.Extension;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.eco.core.EcoPlugin;
import com.willfp.eco.core.extensions.Extension;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import org.jetbrains.annotations.NotNull;
public class RainbowMain extends Extension {
public static final EcoEnchant RAINBOW = new Rainbow();
public RainbowMain(@NotNull final AbstractEcoPlugin plugin) {
public RainbowMain(@NotNull final EcoPlugin plugin) {
super(plugin);
}

View File

@ -1,12 +1,12 @@
package com.willfp.ecoenchants.sprintartifacts;
import com.willfp.eco.util.extensions.Extension;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.eco.core.EcoPlugin;
import com.willfp.eco.core.extensions.Extension;
import org.bukkit.Bukkit;
import org.jetbrains.annotations.NotNull;
public class SprintArtifactsMain extends Extension {
public SprintArtifactsMain(@NotNull final AbstractEcoPlugin plugin) {
public SprintArtifactsMain(@NotNull final EcoPlugin plugin) {
super(plugin);
}

View File

@ -1,7 +1,7 @@
package com.willfp.ecoenchants.summoning;
import com.willfp.eco.core.Prerequisite;
import com.willfp.eco.util.NumberUtils;
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;

View File

@ -1,7 +1,7 @@
package com.willfp.ecoenchants.summoning;
import com.willfp.eco.util.extensions.Extension;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.eco.core.EcoPlugin;
import com.willfp.eco.core.extensions.Extension;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.summoning.enchants.Crawler;
import com.willfp.ecoenchants.summoning.enchants.Firestorm;
@ -17,7 +17,7 @@ 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) {
public SummoningMain(@NotNull final EcoPlugin plugin) {
super(plugin);
}

View File

@ -31,13 +31,13 @@ public class Xray extends Spell {
}
@Override
public void onUse(@NotNull final Player player,
public boolean onUse(@NotNull final Player player,
final int level,
@NotNull final PlayerInteractEvent event) {
Block block = event.getClickedBlock();
if (!event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
return;
return false;
}
Location location;
@ -99,6 +99,8 @@ public class Xray extends Spell {
block1.removeMetadata("xray-uuid", this.getPlugin());
}, ticks);
});
return true;
}
@EventHandler

View File

@ -1,14 +1,14 @@
package com.willfp.ecoenchants.xray;
import com.willfp.eco.util.extensions.Extension;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.eco.core.EcoPlugin;
import com.willfp.eco.core.extensions.Extension;
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) {
public XrayMain(@NotNull final EcoPlugin plugin) {
super(plugin);
}