Added chance options to drill, pentashot, and tripleshot

This commit is contained in:
Auxilor
2021-12-26 15:56:34 +00:00
parent 04d560e01e
commit 2a88bb2298
6 changed files with 19 additions and 0 deletions

View File

@@ -7,6 +7,7 @@ import com.willfp.eco.util.VectorUtils;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockBreakEvent;
@@ -29,6 +30,10 @@ public class Drill extends EcoEnchant {
return;
}
if (!EnchantmentUtils.passedChance(this, level)) {
return;
}
if (player.isSneaking() && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "disable-on-sneak")) {
return;
}

View File

@@ -4,6 +4,7 @@ import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.AbstractArrow;
import org.bukkit.entity.Arrow;
@@ -24,6 +25,10 @@ public class Tripleshot extends EcoEnchant {
@NotNull final Arrow arrow,
final int level,
@NotNull final EntityShootBowEvent event) {
if (!EnchantmentUtils.passedChance(this, level)) {
return;
}
for (int i = -1; i < 2; i += 2) {
Vector velocity = event.getProjectile().getVelocity();

View File

@@ -4,6 +4,7 @@ import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.AbstractArrow;
import org.bukkit.entity.Arrow;
@@ -24,6 +25,10 @@ public class Pentashot extends EcoEnchant {
@NotNull final Arrow arrow,
final int level,
@NotNull final EntityShootBowEvent event) {
if (!EnchantmentUtils.passedChance(this, level)) {
return;
}
int bonusPerSide = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "side-arrows-per-level") * level;
for (int i = -bonusPerSide; i <= bonusPerSide; i += 1) {

View File

@@ -30,6 +30,7 @@ general-config:
maximum-level: 5
config:
chance-per-level: 100 # Not chance-based by default
blocks-per-level: 1
disable-on-sneak: true
hardness-check: true # Only break blocks with hardness less than or equal to first block

View File

@@ -25,6 +25,8 @@ general-config:
- succession
- pentashot
- buckshot
maximum-level: 1
config:
chance-per-level: 100 # Not chance-based by default
angle: 11

View File

@@ -28,5 +28,6 @@ general-config:
maximum-level: 1
config:
chance-per-level: 100 # Not chance-based by default
side-arrows-per-level: 2 # If you want to have more levels
angle: 11