Add cauldron interact logging

This commit is contained in:
Brokkonaut
2021-07-12 04:28:16 +02:00
parent 9c2caa6af8
commit 07924138ea
3 changed files with 31 additions and 0 deletions

View File

@ -161,6 +161,9 @@ public class LogBlock extends JavaPlugin {
if (isLogging(Logging.SCAFFOLDING)) { if (isLogging(Logging.SCAFFOLDING)) {
pm.registerEvents(scaffoldingLogging = new ScaffoldingLogging(this), this); pm.registerEvents(scaffoldingLogging = new ScaffoldingLogging(this), this);
} }
if (isLogging(Logging.CAULDRONINTERACT)) {
pm.registerEvents(new CauldronLogging(this), this);
}
if (isLogging(Logging.CREEPEREXPLOSION) || isLogging(Logging.TNTEXPLOSION) || isLogging(Logging.GHASTFIREBALLEXPLOSION) || isLogging(Logging.ENDERDRAGON) || isLogging(Logging.MISCEXPLOSION)) { if (isLogging(Logging.CREEPEREXPLOSION) || isLogging(Logging.TNTEXPLOSION) || isLogging(Logging.GHASTFIREBALLEXPLOSION) || isLogging(Logging.ENDERDRAGON) || isLogging(Logging.MISCEXPLOSION)) {
pm.registerEvents(new ExplosionLogging(this), this); pm.registerEvents(new ExplosionLogging(this), this);
} }

View File

@ -27,6 +27,7 @@ public enum Logging {
COMPARATORINTERACT, COMPARATORINTERACT,
PRESUREPLATEINTERACT, PRESUREPLATEINTERACT,
TRIPWIREINTERACT, TRIPWIREINTERACT,
CAULDRONINTERACT(true),
CREATURECROPTRAMPLE, CREATURECROPTRAMPLE,
CROPTRAMPLE, CROPTRAMPLE,
NATURALSTRUCTUREGROW, NATURALSTRUCTUREGROW,

View File

@ -0,0 +1,27 @@
package de.diddiz.LogBlock.listeners;
import de.diddiz.LogBlock.Actor;
import de.diddiz.LogBlock.LogBlock;
import de.diddiz.LogBlock.Logging;
import de.diddiz.LogBlock.config.Config;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.CauldronLevelChangeEvent;
public class CauldronLogging extends LoggingListener {
public CauldronLogging(LogBlock lb) {
super(lb);
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onCauldronLevelChange(CauldronLevelChangeEvent event) {
if (Config.isLogging(event.getBlock().getWorld(), Logging.CAULDRONINTERACT)) {
Entity causingEntity = event.getEntity();
if (causingEntity instanceof Player) {
consumer.queueBlockReplace(Actor.actorFromEntity(causingEntity), event.getBlock().getBlockData(), event.getNewState());
}
}
}
}