mirror of
https://github.com/Auxilor/EcoMobs.git
synced 2025-12-21 16:09:24 +00:00
Added no-boats option
This commit is contained in:
@@ -7,6 +7,7 @@ import com.willfp.eco.core.integrations.IntegrationLoader;
|
||||
import com.willfp.ecobosses.bosses.EcoBosses;
|
||||
import com.willfp.ecobosses.bosses.listeners.AttackListeners;
|
||||
import com.willfp.ecobosses.bosses.listeners.DeathListeners;
|
||||
import com.willfp.ecobosses.bosses.listeners.PassiveListeners;
|
||||
import com.willfp.ecobosses.bosses.listeners.SpawnListeners;
|
||||
import com.willfp.ecobosses.commands.CommandEbdrop;
|
||||
import com.willfp.ecobosses.commands.CommandEbkillall;
|
||||
@@ -121,7 +122,8 @@ public class EcoBossesPlugin extends EcoPlugin {
|
||||
return Arrays.asList(
|
||||
new AttackListeners(this),
|
||||
new DeathListeners(this),
|
||||
new SpawnListeners(this)
|
||||
new SpawnListeners(this),
|
||||
new PassiveListeners(this)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -228,6 +228,12 @@ public class EcoBoss extends PluginDependent {
|
||||
@Getter
|
||||
private final TargetMode targetMode;
|
||||
|
||||
/**
|
||||
* If the boss shouldn't get into boats and minecarts.
|
||||
*/
|
||||
@Getter
|
||||
private final boolean disableBoats;
|
||||
|
||||
/**
|
||||
* Create a new Boss.
|
||||
*
|
||||
@@ -416,6 +422,9 @@ public class EcoBoss extends PluginDependent {
|
||||
this.targetDistance = this.getConfig().getDouble("attacks.target.range");
|
||||
this.targetMode = TargetMode.getByName(this.getConfig().getString("attacks.target.mode"));
|
||||
|
||||
// Boat + Minecarts
|
||||
this.disableBoats = this.getConfig().getBool("defence.no-boats");
|
||||
|
||||
if (this.getConfig().getBool("enabled")) {
|
||||
EcoBosses.addBoss(this);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.willfp.ecobosses.bosses.listeners;
|
||||
|
||||
import com.willfp.eco.core.EcoPlugin;
|
||||
import com.willfp.eco.core.PluginDependent;
|
||||
import com.willfp.ecobosses.bosses.EcoBoss;
|
||||
import com.willfp.ecobosses.bosses.util.BossUtils;
|
||||
import org.bukkit.entity.Boat;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Minecart;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.spigotmc.event.entity.EntityMountEvent;
|
||||
|
||||
public class PassiveListeners extends PluginDependent implements Listener {
|
||||
/**
|
||||
* Create new attack listeners.
|
||||
*
|
||||
* @param plugin Instance of EcoBosses.
|
||||
*/
|
||||
public PassiveListeners(@NotNull final EcoPlugin plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a player attacks a boss.
|
||||
*
|
||||
* @param event The event to listen for.
|
||||
*/
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onAttackBoss(@NotNull final EntityMountEvent event) {
|
||||
if (!(event.getEntity() instanceof LivingEntity)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(event.getMount() instanceof Boat || event.getMount() instanceof Minecart)) {
|
||||
return;
|
||||
}
|
||||
|
||||
LivingEntity entity = (LivingEntity) event.getEntity();
|
||||
|
||||
EcoBoss boss = BossUtils.getBoss(entity);
|
||||
|
||||
if (boss == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (boss.isDisableBoats()) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -68,6 +68,8 @@ defence:
|
||||
projectiles: true
|
||||
suffocation: true
|
||||
|
||||
no-boats: true
|
||||
|
||||
incoming-multipliers:
|
||||
melee: 1.1
|
||||
projectile: 0.3
|
||||
|
||||
@@ -71,6 +71,8 @@ defence:
|
||||
projectiles: false
|
||||
suffocation: true
|
||||
|
||||
no-boats: true
|
||||
|
||||
incoming-multipliers:
|
||||
melee: 1
|
||||
projectile: 0.6
|
||||
|
||||
@@ -72,6 +72,8 @@ defence:
|
||||
projectiles: true
|
||||
suffocation: true
|
||||
|
||||
no-boats: true
|
||||
|
||||
incoming-multipliers:
|
||||
melee: 0.8
|
||||
projectile: 0.2
|
||||
|
||||
@@ -72,6 +72,8 @@ defence:
|
||||
projectiles: false
|
||||
suffocation: true
|
||||
|
||||
no-boats: true
|
||||
|
||||
incoming-multipliers:
|
||||
melee: 0.6
|
||||
projectile: 0.3
|
||||
|
||||
Reference in New Issue
Block a user