This commit is contained in:
Minecon724 2022-01-29 16:03:13 +01:00
parent d2e0f4ef33
commit f4daa14bd5
2 changed files with 10 additions and 4 deletions

View File

@ -37,6 +37,8 @@ public class Main extends JavaPlugin implements Listener {
boolean headRotations; boolean headRotations;
double chance; double chance;
double attackDamage; double attackDamage;
double attackReach;
double expandUp;
long refreshDelay; long refreshDelay;
Map<PotionEffectType, Integer> effects = new HashMap<PotionEffectType, Integer>(); Map<PotionEffectType, Integer> effects = new HashMap<PotionEffectType, Integer>();
@ -50,6 +52,8 @@ public class Main extends JavaPlugin implements Listener {
ai = config.getBoolean("ai"); ai = config.getBoolean("ai");
chance = config.getDouble("chance"); chance = config.getDouble("chance");
attackDamage = config.getDouble("attackDamage"); attackDamage = config.getDouble("attackDamage");
attackReach = config.getDouble("attackReach");
expandUp = config.getDouble("expandUp");
for (Object s : config.getList("effects")) { for (Object s : config.getList("effects")) {
try { try {
String[] parts = ((String) s).split(":"); String[] parts = ((String) s).split(":");
@ -73,8 +77,8 @@ public class Main extends JavaPlugin implements Listener {
new BukkitRunnable() { new BukkitRunnable() {
@Override @Override
public void run() { public void run() {
for (Entity e : giants) { for (Entity e : giants) {
Collection<Entity> nearby = e.getWorld().getNearbyEntities(e.getBoundingBox(), n -> (n instanceof Player)); Collection<Entity> nearby = e.getWorld().getNearbyEntities(e.getBoundingBox().expand(attackReach, expandUp, attackReach), n -> (n instanceof Player));
for (Entity p : nearby) { for (Entity p : nearby) {
((LivingEntity) p).damage(attackDamage, e); ((LivingEntity) p).damage(attackDamage, e);
} }

View File

@ -4,7 +4,8 @@ attackDamage: 1.0
chance: 0.02 chance: 0.02
# Attack delay in ticks, smaller values will lag the server more # Attack delay in ticks, smaller values will lag the server more
hitDelay: 20 hitDelay: 20
# if too high the entity will hit through walls # 0 - attack only entities touching the giant, if too high the entity will hit through walls
# fun fact: you can use negative values
attackReach: 2 attackReach: 2
# Additional potion effects # Additional potion effects
# type:amplifier # type:amplifier
@ -15,4 +16,5 @@ effects:
# No need to change this # No need to change this
headRotations: true headRotations: true
refreshDelay: 40 refreshDelay: 20
expandUp: 0