Added Wither and WitherSkull to logging types

This commit is contained in:
Ben Woodford
2012-10-30 13:36:42 +00:00
committed by md_5
parent 1f031ca489
commit 9b23043139
5 changed files with 37 additions and 1 deletions

View File

@@ -45,7 +45,7 @@
<dependency> <dependency>
<groupId>org.bukkit</groupId> <groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId> <artifactId>bukkit</artifactId>
<version>1.3.2-R0.2-SNAPSHOT</version> <version>1.4.2-R0.1-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>${project.groupId}</groupId> <groupId>${project.groupId}</groupId>

View File

@@ -49,6 +49,7 @@ import de.diddiz.LogBlock.listeners.SnowFadeLogging;
import de.diddiz.LogBlock.listeners.SnowFormLogging; import de.diddiz.LogBlock.listeners.SnowFormLogging;
import de.diddiz.LogBlock.listeners.StructureGrowLogging; import de.diddiz.LogBlock.listeners.StructureGrowLogging;
import de.diddiz.LogBlock.listeners.ToolListener; import de.diddiz.LogBlock.listeners.ToolListener;
import de.diddiz.LogBlock.listeners.WitherLogging;
import de.diddiz.util.MySQLConnectionPool; import de.diddiz.util.MySQLConnectionPool;
public class LogBlock extends JavaPlugin public class LogBlock extends JavaPlugin
@@ -184,6 +185,8 @@ public class LogBlock extends JavaPlugin
pm.registerEvents(new ChatLogging(this), this); pm.registerEvents(new ChatLogging(this), this);
if (isLogging(Logging.ENDERMEN)) if (isLogging(Logging.ENDERMEN))
pm.registerEvents(new EndermenLogging(this), this); pm.registerEvents(new EndermenLogging(this), this);
if (isLogging(Logging.WITHER))
pm.registerEvents(new WitherLogging(this), this);
if (isLogging(Logging.NATURALSTRUCTUREGROW) || isLogging(Logging.BONEMEALSTRUCTUREGROW)) if (isLogging(Logging.NATURALSTRUCTUREGROW) || isLogging(Logging.BONEMEALSTRUCTUREGROW))
pm.registerEvents(new StructureGrowLogging(this), this); pm.registerEvents(new StructureGrowLogging(this), this);
if (logPlayerInfo) if (logPlayerInfo)

View File

@@ -6,6 +6,7 @@ public enum Logging
GHASTFIREBALLEXPLOSION(true), ENDERDRAGON(true), MISCEXPLOSION, FIRE(true), LEAVESDECAY, GHASTFIREBALLEXPLOSION(true), ENDERDRAGON(true), MISCEXPLOSION, FIRE(true), LEAVESDECAY,
LAVAFLOW, WATERFLOW, CHESTACCESS, KILL, CHAT, SNOWFORM, SNOWFADE, DOORINTERACT, LAVAFLOW, WATERFLOW, CHESTACCESS, KILL, CHAT, SNOWFORM, SNOWFADE, DOORINTERACT,
SWITCHINTERACT, CAKEEAT, ENDERMEN, NOTEBLOCKINTERACT, DIODEINTERACT, NATURALSTRUCTUREGROW, SWITCHINTERACT, CAKEEAT, ENDERMEN, NOTEBLOCKINTERACT, DIODEINTERACT, NATURALSTRUCTUREGROW,
WITHER(true), WITHER_SKULL(true),
BONEMEALSTRUCTUREGROW; BONEMEALSTRUCTUREGROW;
public static final int length = Logging.values().length; public static final int length = Logging.values().length;
private final boolean defaultEnabled; private final boolean defaultEnabled;

View File

@@ -10,6 +10,8 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.Fireball; import org.bukkit.entity.Fireball;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.TNTPrimed; import org.bukkit.entity.TNTPrimed;
import org.bukkit.entity.Wither;
import org.bukkit.entity.WitherSkull;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityExplodeEvent;
@@ -52,6 +54,14 @@ public class ExplosionLogging extends LoggingListener
if (!wcfg.isLogging(Logging.ENDERDRAGON)) if (!wcfg.isLogging(Logging.ENDERDRAGON))
return; return;
name = "EnderDragon"; name = "EnderDragon";
} else if (event.getEntity() instanceof Wither) {
if(!wcfg.isLogging(Logging.WITHER))
return;
name = "Wither";
} else if (event.getEntity() instanceof WitherSkull) {
if(!wcfg.isLogging(Logging.WITHER_SKULL))
return;
name = "WitherSkull";
} else { } else {
if (!wcfg.isLogging(Logging.MISCEXPLOSION)) if (!wcfg.isLogging(Logging.MISCEXPLOSION))
return; return;

View File

@@ -0,0 +1,22 @@
package de.diddiz.LogBlock.listeners;
import static de.diddiz.LogBlock.config.Config.isLogging;
import org.bukkit.entity.Wither;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import de.diddiz.LogBlock.LogBlock;
import de.diddiz.LogBlock.Logging;
public class WitherLogging extends LoggingListener
{
public WitherLogging(LogBlock lb) {
super(lb);
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEntityChangeBlock(EntityChangeBlockEvent event) {
if (event.getEntity() instanceof Wither && isLogging(event.getBlock().getWorld(), Logging.WITHER))
consumer.queueBlockReplace("Wither", event.getBlock().getState(), event.getTo().getId(), (byte)0); // Wither walked through a block.
}
}