mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2025-01-27 01:11:21 +01:00
Added Graceful
This commit is contained in:
parent
02299669e2
commit
f152845c73
@ -221,6 +221,7 @@ public class EcoEnchants {
|
||||
public static final EcoEnchant QUADRILATERALISM = new Quadrilateralism();
|
||||
public static final EcoEnchant LESION = new Lesion();
|
||||
public static final EcoEnchant CONCLUDE = new Conclude();
|
||||
public static final EcoEnchant GRACEFUL = new Graceful();
|
||||
|
||||
/**
|
||||
* Get all registered {@link EcoEnchant}s
|
||||
|
@ -0,0 +1,43 @@
|
||||
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
||||
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.util.checks.EnchantChecks;
|
||||
import com.willfp.ecoenchants.nms.Target;
|
||||
import com.willfp.ecoenchants.util.Rand;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
public class Graceful extends EcoEnchant {
|
||||
public Graceful() {
|
||||
super(
|
||||
new EcoEnchantBuilder("graceful", EnchantmentType.NORMAL, Target.Applicable.BOOTS, 4.0)
|
||||
);
|
||||
}
|
||||
|
||||
// START OF LISTENERS
|
||||
|
||||
@EventHandler
|
||||
public void onFall(PlayerMoveEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (player.isOnGround())
|
||||
return;
|
||||
|
||||
if(player.getLocation().clone().add(0, -1, 0).getBlock().getType().equals(Material.AIR))
|
||||
return;
|
||||
|
||||
if(!EnchantChecks.boots(player, this)) return;
|
||||
int level = EnchantChecks.getBootsLevel(player, this);
|
||||
|
||||
if (Rand.randFloat(0, 1) > level * 0.01 * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "chance-per-level"))
|
||||
return;
|
||||
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, 20, 1, false, false, false));
|
||||
}
|
||||
}
|
23
Plugin/src/main/resources/enchants/normal/graceful.yml
Normal file
23
Plugin/src/main/resources/enchants/normal/graceful.yml
Normal file
@ -0,0 +1,23 @@
|
||||
#
|
||||
# Graceful EcoEnchant
|
||||
#
|
||||
|
||||
config-version: 4.0 # Don't edit this.
|
||||
|
||||
name: "Graceful"
|
||||
|
||||
description: Chance of getting slow falling just above hitting the ground.
|
||||
|
||||
obtaining:
|
||||
table: true
|
||||
villager: true
|
||||
loot: true
|
||||
rarity: legendary
|
||||
|
||||
general-config:
|
||||
grindstoneable: true
|
||||
conflicts: []
|
||||
maximum-level: 4
|
||||
|
||||
config:
|
||||
chance-per-level: 5 #chance of slow falling per level
|
@ -240,6 +240,7 @@ permissions:
|
||||
ecoenchants.fromtable.quadrilateralism: true
|
||||
ecoenchants.fromtable.lesion: true
|
||||
ecoenchants.fromtable.conclude: true
|
||||
ecoenchants.fromtable.graceful: true
|
||||
|
||||
ecoenchants.updateannounce:
|
||||
description: Informs admins of a new update
|
||||
@ -832,4 +833,7 @@ permissions:
|
||||
default: true
|
||||
ecoenchants.fromtable.conclude:
|
||||
description: Allows getting conclude from an enchanting table
|
||||
default: true
|
||||
ecoenchants.fromtable.graceful:
|
||||
description: Allows getting graceful from an enchanting table
|
||||
default: true
|
Loading…
Reference in New Issue
Block a user