mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-12-24 20:07:34 +01:00
Made intimidation enchantment
This commit is contained in:
parent
02477778f4
commit
0637bdf1c1
7
eco-extensions/intimidation/build.gradle
Normal file
7
eco-extensions/intimidation/build.gradle
Normal file
@ -0,0 +1,7 @@
|
||||
group 'com.willfp'
|
||||
version '1.0.0'
|
||||
description = 'Intimidation Extension'
|
||||
|
||||
shadowJar {
|
||||
archiveFileName = project.getDescription() + " v" + project.version + ".jar"
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package com.willfp.ecoenchants.intimidation;
|
||||
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
||||
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
||||
import org.bukkit.entity.Monster;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityTargetLivingEntityEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class Intimidation extends EcoEnchant {
|
||||
public Intimidation() {
|
||||
super(
|
||||
"intimidation", EnchantmentType.NORMAL
|
||||
);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onSwitchTarget(@NotNull final EntityTargetLivingEntityEvent event) {
|
||||
if (!(event.getEntity() instanceof Monster attacker)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getTarget() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!EnchantChecks.mainhand(event.getTarget(), this)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.getDisabledWorlds().contains(event.getTarget().getWorld())) {
|
||||
return;
|
||||
}
|
||||
|
||||
int level = EnchantChecks.getArmorPoints(event.getTarget(), this);
|
||||
|
||||
if (EnchantmentUtils.passedChance(this, level)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.willfp.ecoenchants.intimidation;
|
||||
|
||||
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 IntimidationMain extends Extension {
|
||||
public static final EcoEnchant INTIMIDATION = new Intimidation();
|
||||
|
||||
public IntimidationMain(@NotNull final EcoPlugin plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
// Handled by super
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
// Handled by super
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
#
|
||||
# Intimidation EcoEnchant
|
||||
#
|
||||
|
||||
name: "Intimidation"
|
||||
description: Decrease the chance of hostile mobs being aggravated at you.
|
||||
enabled: true
|
||||
|
||||
obtaining:
|
||||
table: true
|
||||
villager: true
|
||||
loot: true
|
||||
rarity: legendary
|
||||
|
||||
general-config:
|
||||
flags: []
|
||||
targets:
|
||||
- helmet
|
||||
grindstoneable: true
|
||||
disabled-in-worlds: [ ]
|
||||
conflicts: []
|
||||
maximum-level: 4
|
||||
|
||||
config:
|
||||
chance-per-level: 20
|
@ -0,0 +1,4 @@
|
||||
name: Intimidation
|
||||
main: com.willfp.ecoenchants.intimidation.IntimidationMain
|
||||
version: ${projectVersion}
|
||||
author: Auxilor
|
@ -15,6 +15,7 @@ include ':eco-extensions:biomes'
|
||||
include ':eco-extensions:effects'
|
||||
include ':eco-extensions:endershot'
|
||||
include ':eco-extensions:firewand'
|
||||
include ':eco-extensions:intimidation'
|
||||
//include ':eco-extensions:mmo'
|
||||
include ':eco-extensions:precision'
|
||||
include ':eco-extensions:rainbow'
|
||||
|
Loading…
Reference in New Issue
Block a user