forked from LogBlock/LogBlock
Added Wither and WitherSkull to logging types
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -45,7 +45,7 @@
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.3.2-R0.2-SNAPSHOT</version>
|
||||
<version>1.4.2-R0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
|
@@ -49,6 +49,7 @@ import de.diddiz.LogBlock.listeners.SnowFadeLogging;
|
||||
import de.diddiz.LogBlock.listeners.SnowFormLogging;
|
||||
import de.diddiz.LogBlock.listeners.StructureGrowLogging;
|
||||
import de.diddiz.LogBlock.listeners.ToolListener;
|
||||
import de.diddiz.LogBlock.listeners.WitherLogging;
|
||||
import de.diddiz.util.MySQLConnectionPool;
|
||||
|
||||
public class LogBlock extends JavaPlugin
|
||||
@@ -184,6 +185,8 @@ public class LogBlock extends JavaPlugin
|
||||
pm.registerEvents(new ChatLogging(this), this);
|
||||
if (isLogging(Logging.ENDERMEN))
|
||||
pm.registerEvents(new EndermenLogging(this), this);
|
||||
if (isLogging(Logging.WITHER))
|
||||
pm.registerEvents(new WitherLogging(this), this);
|
||||
if (isLogging(Logging.NATURALSTRUCTUREGROW) || isLogging(Logging.BONEMEALSTRUCTUREGROW))
|
||||
pm.registerEvents(new StructureGrowLogging(this), this);
|
||||
if (logPlayerInfo)
|
||||
|
@@ -6,6 +6,7 @@ public enum Logging
|
||||
GHASTFIREBALLEXPLOSION(true), ENDERDRAGON(true), MISCEXPLOSION, FIRE(true), LEAVESDECAY,
|
||||
LAVAFLOW, WATERFLOW, CHESTACCESS, KILL, CHAT, SNOWFORM, SNOWFADE, DOORINTERACT,
|
||||
SWITCHINTERACT, CAKEEAT, ENDERMEN, NOTEBLOCKINTERACT, DIODEINTERACT, NATURALSTRUCTUREGROW,
|
||||
WITHER(true), WITHER_SKULL(true),
|
||||
BONEMEALSTRUCTUREGROW;
|
||||
public static final int length = Logging.values().length;
|
||||
private final boolean defaultEnabled;
|
||||
|
@@ -10,6 +10,8 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Fireball;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
import org.bukkit.entity.Wither;
|
||||
import org.bukkit.entity.WitherSkull;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
@@ -52,6 +54,14 @@ public class ExplosionLogging extends LoggingListener
|
||||
if (!wcfg.isLogging(Logging.ENDERDRAGON))
|
||||
return;
|
||||
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 {
|
||||
if (!wcfg.isLogging(Logging.MISCEXPLOSION))
|
||||
return;
|
||||
|
@@ -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.
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user