mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-12-25 20:17:38 +01:00
Added Force
This commit is contained in:
parent
49e0f087c8
commit
7115699973
@ -188,6 +188,7 @@ public class EcoEnchants {
|
||||
public static final EcoEnchant DIVERSE = new Diverse();
|
||||
public static final EcoEnchant LIFE_STEAL = new LifeSteal();
|
||||
public static final EcoEnchant LIME_ARTIFACT = new LimeArtifact();
|
||||
public static final EcoEnchant FORCE = new Force();
|
||||
|
||||
/**
|
||||
* Get all registered {@link EcoEnchant}s
|
||||
|
@ -0,0 +1,47 @@
|
||||
package com.willfp.ecoenchants.enchantments.ecoenchants.special;
|
||||
|
||||
import com.comphenix.protocol.PacketType;
|
||||
import com.willfp.ecoenchants.EcoEnchantsPlugin;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.nms.Target;
|
||||
import com.willfp.ecoenchants.util.HasEnchant;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
|
||||
public class Force extends EcoEnchant {
|
||||
public Force() {
|
||||
super(
|
||||
new EcoEnchantBuilder("force", EnchantmentType.SPECIAL, Target.Applicable.BOW, 4.0)
|
||||
);
|
||||
}
|
||||
|
||||
// START OF LISTENERS
|
||||
|
||||
@EventHandler
|
||||
public void onDamage(EntityDamageByEntityEvent event) {
|
||||
if (!(event.getDamager() instanceof Arrow))
|
||||
return;
|
||||
|
||||
if(!(((Arrow) event.getDamager()).getShooter() instanceof Player))
|
||||
return;
|
||||
|
||||
Player player = (Player) ((Arrow) event.getDamager()).getShooter();
|
||||
|
||||
if(!HasEnchant.playerHeld(player, this))
|
||||
return;
|
||||
|
||||
int level = HasEnchant.getPlayerLevel(player, this);
|
||||
|
||||
double damage = event.getDamage();
|
||||
double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
|
||||
double bonus = (multiplier * (level + 6)) + 1;
|
||||
event.setDamage(damage * bonus);
|
||||
}
|
||||
}
|
24
Plugin/src/main/resources/enchants/special/force.yml
Normal file
24
Plugin/src/main/resources/enchants/special/force.yml
Normal file
@ -0,0 +1,24 @@
|
||||
#
|
||||
# Force EcoEnchant
|
||||
#
|
||||
|
||||
config-version: 4.0 # Don't edit this.
|
||||
|
||||
name: "Force"
|
||||
|
||||
description: Massively increases arrow damage.
|
||||
|
||||
obtaining:
|
||||
table: true
|
||||
villager: true
|
||||
loot: true
|
||||
rarity: rare
|
||||
|
||||
general-config:
|
||||
grindstoneable: true
|
||||
conflicts:
|
||||
- power
|
||||
maximum-level: 5
|
||||
|
||||
config:
|
||||
multiplier: 0.25 # Formula is (multiplier * (level + 6) + 1)*damage | Default functions as power 5 + level, eg force 2 = power 7
|
@ -207,6 +207,7 @@ permissions:
|
||||
ecoenchants.fromtable.diverse: true
|
||||
ecoenchants.fromtable.lifesteal: true
|
||||
ecoenchants.fromtable.limeartifact: true
|
||||
ecoenchants.fromtable.force: true
|
||||
|
||||
ecoenchants.updateannounce:
|
||||
description: Informs admins of a new update
|
||||
@ -701,3 +702,6 @@ permissions:
|
||||
ecoenchants.fromtable.limeartifact:
|
||||
description: Allows getting lime artifact from an enchanting table
|
||||
default: true
|
||||
ecoenchants.fromtable.force:
|
||||
description: Allows getting force from an enchanting table
|
||||
default: true
|
Loading…
Reference in New Issue
Block a user