Added Diurnal
This commit is contained in:
@@ -190,6 +190,7 @@ public class EcoEnchants {
|
||||
public static final EcoEnchant LIME_ARTIFACT = new LimeArtifact();
|
||||
public static final EcoEnchant FORCE = new Force();
|
||||
public static final EcoEnchant END_INFUSION = new EndInfusion();
|
||||
public static final EcoEnchant DIURNAL = new Diurnal();
|
||||
|
||||
/**
|
||||
* Get all registered {@link EcoEnchant}s
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
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.nms.Target;
|
||||
import com.willfp.ecoenchants.util.HasEnchant;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
|
||||
public class Diurnal extends EcoEnchant {
|
||||
public Diurnal() {
|
||||
super(
|
||||
new EcoEnchantBuilder("diurnal", EnchantmentType.NORMAL, Target.Applicable.SWORD, 4.0)
|
||||
);
|
||||
}
|
||||
|
||||
// START OF LISTENERS
|
||||
|
||||
@EventHandler
|
||||
public void onHit(EntityDamageByEntityEvent event) {
|
||||
if (!(event.getDamager() instanceof Player))
|
||||
return;
|
||||
|
||||
Player player = (Player) event.getDamager();
|
||||
|
||||
if(!player.getWorld().getEnvironment().equals(World.Environment.NORMAL))
|
||||
return;
|
||||
|
||||
if(!(player.getWorld().getTime() < 12300 && player.getWorld().getTime() > 23850)) return;
|
||||
|
||||
if (!HasEnchant.playerHeld(player, this)) return;
|
||||
|
||||
int level = HasEnchant.getPlayerLevel(player, this);
|
||||
double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "per-level-multiplier");
|
||||
|
||||
event.setDamage(event.getDamage() * (1 + (level * multiplier)));
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
public class Nocturnal extends EcoEnchant {
|
||||
public Nocturnal() {
|
||||
super(
|
||||
new EcoEnchantBuilder("nocturnal", EnchantmentType.NORMAL, Target.Applicable.SWORD, 4.0)
|
||||
new EcoEnchantBuilder("nocturnal", EnchantmentType.NORMAL, Target.Applicable.SWORD, 4.01)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
24
Plugin/src/main/resources/enchants/normal/diurnal.yml
Normal file
24
Plugin/src/main/resources/enchants/normal/diurnal.yml
Normal file
@@ -0,0 +1,24 @@
|
||||
#
|
||||
# Diurnal EcoEnchant
|
||||
#
|
||||
|
||||
config-version: 4.0 # Don't edit this.
|
||||
|
||||
name: "Diurnal"
|
||||
|
||||
description: Increases damage dealt at daytime.
|
||||
|
||||
obtaining:
|
||||
table: true
|
||||
villager: true
|
||||
loot: true
|
||||
rarity: rare
|
||||
|
||||
general-config:
|
||||
grindstoneable: true
|
||||
conflicts:
|
||||
- nocturnal
|
||||
maximum-level: 5
|
||||
|
||||
config:
|
||||
per-level-multiplier: 0.05 # Multiplier per level for damage. Calculated as damage * (1 + level * multiplier)
|
||||
@@ -2,7 +2,7 @@
|
||||
# Nocturnal EcoEnchant
|
||||
#
|
||||
|
||||
config-version: 4.0 # Don't edit this.
|
||||
config-version: 4.01 # Don't edit this.
|
||||
|
||||
name: "Nocturnal"
|
||||
|
||||
@@ -16,7 +16,8 @@ obtaining:
|
||||
|
||||
general-config:
|
||||
grindstoneable: true
|
||||
conflicts: []
|
||||
conflicts:
|
||||
- diurnal
|
||||
maximum-level: 5
|
||||
|
||||
config:
|
||||
|
||||
@@ -209,6 +209,7 @@ permissions:
|
||||
ecoenchants.fromtable.limeartifact: true
|
||||
ecoenchants.fromtable.force: true
|
||||
ecoenchants.fromtable.endinfusion: true
|
||||
ecoenchants.fromtable.diurnal: true
|
||||
|
||||
ecoenchants.updateannounce:
|
||||
description: Informs admins of a new update
|
||||
@@ -708,4 +709,7 @@ permissions:
|
||||
default: true
|
||||
ecoenchants.fromtable.endinfusion:
|
||||
description: Allows getting end infusion from an enchanting table
|
||||
default: true
|
||||
ecoenchants.fromtable.diurnal:
|
||||
description: Allows getting diurnal from an enchanting table
|
||||
default: true
|
||||
Reference in New Issue
Block a user