forked from LogBlock/LogBlock
Normalize actor for crop trampling mobs
This commit is contained in:
@ -95,6 +95,7 @@ public class Actor {
|
|||||||
return new Actor(entityName(entity));
|
return new Actor(entityName(entity));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public static Actor actorFromEntity(EntityType entity) {
|
public static Actor actorFromEntity(EntityType entity) {
|
||||||
return new Actor(entity.name());
|
return new Actor(entity.name());
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,6 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.data.type.TurtleEgg;
|
import org.bukkit.block.data.type.TurtleEgg;
|
||||||
import org.bukkit.entity.EntityType;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@ -27,10 +26,8 @@ public class CreatureInteractLogging extends LoggingListener {
|
|||||||
public void onEntityInteract(EntityInteractEvent event) {
|
public void onEntityInteract(EntityInteractEvent event) {
|
||||||
final WorldConfig wcfg = getWorldConfig(event.getEntity().getWorld());
|
final WorldConfig wcfg = getWorldConfig(event.getEntity().getWorld());
|
||||||
|
|
||||||
final EntityType entityType = event.getEntityType();
|
|
||||||
|
|
||||||
// Mobs only
|
// Mobs only
|
||||||
if (event.getEntity() instanceof Player || entityType == null) {
|
if (event.getEntity() instanceof Player) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,7 +39,7 @@ public class CreatureInteractLogging extends LoggingListener {
|
|||||||
if (type == Material.FARMLAND) {
|
if (type == Material.FARMLAND) {
|
||||||
if (wcfg.isLogging(Logging.CREATURECROPTRAMPLE)) {
|
if (wcfg.isLogging(Logging.CREATURECROPTRAMPLE)) {
|
||||||
// 3 = Dirt ID
|
// 3 = Dirt ID
|
||||||
consumer.queueBlock(Actor.actorFromEntity(entityType), loc, type.createBlockData(), Material.DIRT.createBlockData());
|
consumer.queueBlock(new Actor("CreatureTrample"), loc, type.createBlockData(), Material.DIRT.createBlockData());
|
||||||
// Log the crop on top as being broken
|
// Log the crop on top as being broken
|
||||||
Block trampledCrop = clicked.getRelative(BlockFace.UP);
|
Block trampledCrop = clicked.getRelative(BlockFace.UP);
|
||||||
if (BukkitUtils.getCropBlocks().contains(trampledCrop.getType())) {
|
if (BukkitUtils.getCropBlocks().contains(trampledCrop.getType())) {
|
||||||
|
Reference in New Issue
Block a user