mirror of
https://github.com/songoda/EpicBosses.git
synced 2025-01-18 13:11:19 +01:00
Added option to prevent bosses from exploding.
This commit is contained in:
parent
0aca79652f
commit
2a6a2f5118
@ -7,12 +7,16 @@ import com.songoda.epicbosses.events.BossDamageEvent;
|
||||
import com.songoda.epicbosses.holder.ActiveBossHolder;
|
||||
import com.songoda.epicbosses.managers.BossEntityManager;
|
||||
import com.songoda.epicbosses.managers.files.BossesFileManager;
|
||||
import com.songoda.epicbosses.settings.Settings;
|
||||
import com.songoda.epicbosses.utils.ServerUtils;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityCombustEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
@ -85,4 +89,13 @@ public class BossDamageListener implements Listener {
|
||||
activeBossHolder.getMapOfDamagingUsers().put(player.getUniqueId(), currentDamage + damage);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onBossExplode(ExplosionPrimeEvent event) {
|
||||
if (!(event.getEntity() instanceof LivingEntity)) return;
|
||||
LivingEntity livingEntity = (LivingEntity) event.getEntity();
|
||||
ActiveBossHolder activeBossHolder = this.bossEntityManager.getActiveBossHolder(livingEntity);
|
||||
|
||||
if (activeBossHolder != null && !Settings.BOSS_EXPLOSIONS.getBoolean())
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,9 @@ public class Settings {
|
||||
"Which economy plugin should be used?",
|
||||
"Supported plugins you have installed: \"" + EconomyManager.getManager().getRegisteredPlugins().stream().collect(Collectors.joining("\", \"")) + "\".");
|
||||
|
||||
public static final ConfigSetting BOSS_EXPLOSIONS = new ConfigSetting(config, "Toggles.bossExplosions", false,
|
||||
"Should bosses such as Creepers be allowed to explode?");
|
||||
|
||||
public static final ConfigSetting BOSS_SHOP = new ConfigSetting(config, "Toggles.bossShop", true);
|
||||
|
||||
public static final ConfigSetting ENDERMAN_TELEPORTING = new ConfigSetting(config, "Toggles.endermanTeleporting", true);
|
||||
|
Loading…
Reference in New Issue
Block a user