mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-11-22 15:05:18 +01:00
Created citizen extension
This commit is contained in:
parent
0637bdf1c1
commit
9540d8fbb1
7
eco-extensions/citizen/build.gradle
Normal file
7
eco-extensions/citizen/build.gradle
Normal file
@ -0,0 +1,7 @@
|
||||
group 'com.willfp'
|
||||
version '1.0.0'
|
||||
description = 'Citizen Extension'
|
||||
|
||||
shadowJar {
|
||||
archiveFileName = project.getDescription() + " v" + project.version + ".jar"
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package com.willfp.ecoenchants.citizen;
|
||||
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Trident;
|
||||
import org.bukkit.entity.Villager;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class Citizen extends EcoEnchant {
|
||||
public Citizen() {
|
||||
super(
|
||||
"citizen", EnchantmentType.NORMAL
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMeleeAttack(@NotNull final LivingEntity attacker,
|
||||
@NotNull final LivingEntity uncastVictim,
|
||||
final int level,
|
||||
@NotNull final EntityDamageByEntityEvent event) {
|
||||
if (!(uncastVictim instanceof Villager)) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArrowDamage(@NotNull final LivingEntity attacker,
|
||||
@NotNull final LivingEntity victim,
|
||||
@NotNull final Arrow arrow,
|
||||
final int level,
|
||||
@NotNull final EntityDamageByEntityEvent event) {
|
||||
if (!(victim instanceof Villager)) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTridentDamage(@NotNull final LivingEntity attacker,
|
||||
@NotNull final LivingEntity victim,
|
||||
@NotNull final Trident trident,
|
||||
final int level,
|
||||
@NotNull final EntityDamageByEntityEvent event) {
|
||||
if (!(victim instanceof Villager)) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.willfp.ecoenchants.citizen;
|
||||
|
||||
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 CitizenMain extends Extension {
|
||||
public static final EcoEnchant CITIZEN = new Citizen();
|
||||
|
||||
public CitizenMain(@NotNull final EcoPlugin plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
// Handled by super
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
// Handled by super
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
#
|
||||
# Citizen EcoEnchant
|
||||
#
|
||||
|
||||
name: "Citizen"
|
||||
description: Prevent you from injuring villagers.
|
||||
enabled: true
|
||||
|
||||
obtaining:
|
||||
table: true
|
||||
villager: true
|
||||
loot: true
|
||||
rarity: uncommon
|
||||
|
||||
general-config:
|
||||
flags: []
|
||||
targets:
|
||||
- sword
|
||||
- axe
|
||||
- bow
|
||||
- trident
|
||||
grindstoneable: true
|
||||
disabled-in-worlds: [ ]
|
||||
conflicts: []
|
||||
maximum-level: 1
|
||||
|
||||
config:
|
||||
# No config is available for this enchantment
|
4
eco-extensions/citizen/src/main/resources/extension.yml
Normal file
4
eco-extensions/citizen/src/main/resources/extension.yml
Normal file
@ -0,0 +1,4 @@
|
||||
name: Citizen
|
||||
main: com.willfp.ecoenchants.citizen.CitizenMain
|
||||
version: ${projectVersion}
|
||||
author: Auxilor
|
@ -12,6 +12,7 @@ include ':eco-core:core-plugin'
|
||||
include ':eco-extensions'
|
||||
include ':eco-extensions:alchemy'
|
||||
include ':eco-extensions:biomes'
|
||||
include ':eco-extensions:citizen'
|
||||
include ':eco-extensions:effects'
|
||||
include ':eco-extensions:endershot'
|
||||
include ':eco-extensions:firewand'
|
||||
|
Loading…
Reference in New Issue
Block a user