mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2025-01-25 00:51:20 +01:00
Created Sprint Artifact extension
This commit is contained in:
parent
ed16dde180
commit
f77532399d
14
Extensions/SprintArtifacts/build.gradle
Normal file
14
Extensions/SprintArtifacts/build.gradle
Normal file
@ -0,0 +1,14 @@
|
||||
dependencies {
|
||||
compileOnly 'org.spigotmc:spigot-api:1.15.2-R0.1-SNAPSHOT'
|
||||
compileOnly project(':plugin')
|
||||
}
|
||||
|
||||
jar{
|
||||
archiveFileName = project.name + " Extension" + ".jar"
|
||||
}
|
||||
|
||||
description = 'Sprint Artifacts'
|
||||
|
||||
tasks.withType(Jar) {
|
||||
destinationDirectory = file("$rootDir/bin/")
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package com.willfp.ecoenchants.sprintartifacts;
|
||||
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
|
||||
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
public class SprintArtifactsListener implements Listener {
|
||||
@EventHandler
|
||||
public void onPlayerMove(PlayerMoveEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if(!player.isSprinting()) return;
|
||||
if(!player.isOnGround()) return;
|
||||
|
||||
ItemStack boots = player.getInventory().getBoots();
|
||||
if(boots == null) return;
|
||||
ItemMeta bootsMeta = boots.getItemMeta();
|
||||
if(bootsMeta == null) return;
|
||||
|
||||
Optional<EcoEnchant> matching = bootsMeta.getEnchants().keySet().stream()
|
||||
.map(EcoEnchants::getFromEnchantment)
|
||||
.filter(Objects::nonNull)
|
||||
.filter(enchantment -> enchantment.getType().equals(EcoEnchant.EnchantmentType.ARTIFACT))
|
||||
.findFirst();
|
||||
if(!matching.isPresent()) return;
|
||||
Artifact artifact = (Artifact) matching.get();
|
||||
|
||||
if (!EnchantChecks.chestplate(player, artifact)) return;
|
||||
|
||||
player.getWorld().spawnParticle(artifact.getParticle(), player.getLocation().add(0, 0.1, 0), 1, 0, 0, 0, 0, artifact.getDustOptions(), true);
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.willfp.ecoenchants.sprintartifacts;
|
||||
|
||||
import com.willfp.ecoenchants.EcoEnchantsPlugin;
|
||||
import com.willfp.ecoenchants.extensions.Extension;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
public class SprintArtifactsMain extends Extension {
|
||||
@Override
|
||||
public void onEnable() {
|
||||
Bukkit.getPluginManager().registerEvents(new SprintArtifactsListener(), EcoEnchantsPlugin.getInstance());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
name: Sprint Artifacts
|
||||
main: com.willfp.ecoenchants.sprintartifacts.SprintArtifactsMain
|
||||
version: 1.0.0
|
@ -13,7 +13,7 @@ public class AshArtifact extends Artifact {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Particle getParticle() {
|
||||
public Particle getParticle() {
|
||||
return Particle.WHITE_ASH;
|
||||
}
|
||||
}
|
@ -11,12 +11,12 @@ public class CloudsArtifact extends Artifact {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Particle getParticle() {
|
||||
public Particle getParticle() {
|
||||
return Particle.REDSTONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Particle.DustOptions getDustOptions() {
|
||||
public Particle.DustOptions getDustOptions() {
|
||||
return new Particle.DustOptions(Color.AQUA, 1.0f);
|
||||
}
|
||||
}
|
@ -13,7 +13,7 @@ public class CrimsonArtifact extends Artifact {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Particle getParticle() {
|
||||
public Particle getParticle() {
|
||||
return Particle.CRIMSON_SPORE;
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@ public class DamageArtifact extends Artifact {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Particle getParticle() {
|
||||
public Particle getParticle() {
|
||||
return Particle.DAMAGE_INDICATOR;
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@ public class DragonArtifact extends Artifact {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Particle getParticle() {
|
||||
public Particle getParticle() {
|
||||
return Particle.DRAGON_BREATH;
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@ public class DustArtifact extends Artifact {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Particle getParticle() {
|
||||
public Particle getParticle() {
|
||||
return Particle.CRIT;
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@ public class EmeraldArtifact extends Artifact {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Particle getParticle() {
|
||||
public Particle getParticle() {
|
||||
return Particle.COMPOSTER;
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@ public class EnchantmentArtifact extends Artifact {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Particle getParticle() {
|
||||
public Particle getParticle() {
|
||||
return Particle.ENCHANTMENT_TABLE;
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@ public class EndArtifact extends Artifact {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Particle getParticle() {
|
||||
public Particle getParticle() {
|
||||
return Particle.END_ROD;
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@ public class FireArtifact extends Artifact {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Particle getParticle() {
|
||||
public Particle getParticle() {
|
||||
return Particle.FLAME;
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@ public class HeartArtifact extends Artifact {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Particle getParticle() {
|
||||
public Particle getParticle() {
|
||||
return Particle.HEART;
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@ public class HoneyArtifact extends Artifact {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Particle getParticle() {
|
||||
public Particle getParticle() {
|
||||
return Particle.FALLING_HONEY;
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@ public class InkArtifact extends Artifact {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Particle getParticle() {
|
||||
public Particle getParticle() {
|
||||
return Particle.SQUID_INK;
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@ public class LavaArtifact extends Artifact {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Particle getParticle() {
|
||||
public Particle getParticle() {
|
||||
return Particle.DRIP_LAVA;
|
||||
}
|
||||
}
|
@ -12,12 +12,12 @@ public class LimeArtifact extends Artifact {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Particle getParticle() {
|
||||
public Particle getParticle() {
|
||||
return Particle.REDSTONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Particle.DustOptions getDustOptions() {
|
||||
public Particle.DustOptions getDustOptions() {
|
||||
return new Particle.DustOptions(Color.fromRGB(3, 252, 140), 1.0f);
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@ public class MagicArtifact extends Artifact {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Particle getParticle() {
|
||||
public Particle getParticle() {
|
||||
return Particle.CRIT_MAGIC;
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@ public class MagmaArtifact extends Artifact {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Particle getParticle() {
|
||||
public Particle getParticle() {
|
||||
return Particle.LAVA;
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@ public class MusicArtifact extends Artifact {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Particle getParticle() {
|
||||
public Particle getParticle() {
|
||||
return Particle.NOTE;
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@ public class NetherArtifact extends Artifact {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Particle getParticle() {
|
||||
public Particle getParticle() {
|
||||
return Particle.PORTAL;
|
||||
}
|
||||
}
|
@ -11,12 +11,12 @@ public class RedstoneArtifact extends Artifact {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Particle getParticle() {
|
||||
public Particle getParticle() {
|
||||
return Particle.REDSTONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Particle.DustOptions getDustOptions() {
|
||||
public Particle.DustOptions getDustOptions() {
|
||||
return new Particle.DustOptions(Color.RED, 1.0f);
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@ public class SmokeArtifact extends Artifact {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Particle getParticle() {
|
||||
public Particle getParticle() {
|
||||
return Particle.CAMPFIRE_COSY_SMOKE;
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@ public class SnowArtifact extends Artifact {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Particle getParticle() {
|
||||
public Particle getParticle() {
|
||||
return Particle.SNOWBALL;
|
||||
}
|
||||
}
|
@ -13,7 +13,7 @@ public class SoulArtifact extends Artifact {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Particle getParticle() {
|
||||
public Particle getParticle() {
|
||||
return Particle.SOUL;
|
||||
}
|
||||
}
|
@ -13,7 +13,7 @@ public class SoulFireArtifact extends Artifact {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Particle getParticle() {
|
||||
public Particle getParticle() {
|
||||
return Particle.SOUL_FIRE_FLAME;
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@ public class SparkleArtifact extends Artifact {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Particle getParticle() {
|
||||
public Particle getParticle() {
|
||||
return Particle.FIREWORKS_SPARK;
|
||||
}
|
||||
}
|
@ -13,7 +13,7 @@ public class TearArtifact extends Artifact {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Particle getParticle() {
|
||||
public Particle getParticle() {
|
||||
return Particle.DRIPPING_OBSIDIAN_TEAR;
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@ public class TotemArtifact extends Artifact {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Particle getParticle() {
|
||||
public Particle getParticle() {
|
||||
return Particle.TOTEM;
|
||||
}
|
||||
}
|
@ -13,7 +13,7 @@ public class WarpedArtifact extends Artifact {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Particle getParticle() {
|
||||
public Particle getParticle() {
|
||||
return Particle.WARPED_SPORE;
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@ public class WaterArtifact extends Artifact {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Particle getParticle() {
|
||||
public Particle getParticle() {
|
||||
return Particle.DRIP_WATER;
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@ public class WitchArtifact extends Artifact {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Particle getParticle() {
|
||||
public Particle getParticle() {
|
||||
return Particle.SPELL_WITCH;
|
||||
}
|
||||
}
|
@ -11,12 +11,12 @@ public class ZapArtifact extends Artifact {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Particle getParticle() {
|
||||
public Particle getParticle() {
|
||||
return Particle.REDSTONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Particle.DustOptions getDustOptions() {
|
||||
public Particle.DustOptions getDustOptions() {
|
||||
return new Particle.DustOptions(Color.YELLOW, 1.0f);
|
||||
}
|
||||
}
|
@ -50,9 +50,9 @@ public abstract class Artifact extends EcoEnchant {
|
||||
|
||||
}
|
||||
|
||||
protected abstract Particle getParticle();
|
||||
public abstract Particle getParticle();
|
||||
|
||||
protected Particle.DustOptions getDustOptions() {
|
||||
public Particle.DustOptions getDustOptions() {
|
||||
return null;
|
||||
};
|
||||
|
||||
|
@ -30,4 +30,8 @@ include('Endershot')
|
||||
findProject(':Endershot').projectDir = file('Extensions/Endershot')
|
||||
|
||||
include('Biomes')
|
||||
findProject(':Biomes').projectDir = file('Extensions/Biomes')
|
||||
findProject(':Biomes').projectDir = file('Extensions/Biomes')
|
||||
|
||||
include('SprintArtifacts')
|
||||
findProject(':SprintArtifacts').projectDir = file('Extensions/SprintArtifacts')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user