QoL/src/main/java/xyz/etztech/qol/listeners/BlockIgniteListener.java

28 lines
880 B
Java

package xyz.etztech.qol.listeners;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockIgniteEvent;
import xyz.etztech.qol.QoL;
public class BlockIgniteListener implements Listener {
QoL plugin;
public BlockIgniteListener(QoL plugin) {
this.plugin = plugin;
}
@EventHandler
public void onBlockIgnite(BlockIgniteEvent event) {
BlockIgniteEvent.IgniteCause cause = event.getCause();
if (plugin.getConfig().getBoolean("disable-fire." + cause.name().toLowerCase())) {
event.setCancelled(true);
}
if (event.getPlayer() != null && (cause == BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL || cause == BlockIgniteEvent.IgniteCause.FIREBALL)) {
plugin.getGriefAlert().addAlert(event.getPlayer().getName() + " started a fire.");
}
}
}