forked from LogBlock/LogBlock
Fix logging bonemealing moss
This commit is contained in:
@ -189,9 +189,12 @@ public class LogBlock extends JavaPlugin {
|
|||||||
if (isLogging(Logging.WITHER)) {
|
if (isLogging(Logging.WITHER)) {
|
||||||
pm.registerEvents(new WitherLogging(this), this);
|
pm.registerEvents(new WitherLogging(this), this);
|
||||||
}
|
}
|
||||||
if (isLogging(Logging.NATURALSTRUCTUREGROW) || isLogging(Logging.BONEMEALSTRUCTUREGROW)) {
|
if (isLogging(Logging.NATURALSTRUCTUREGROW)) {
|
||||||
pm.registerEvents(new StructureGrowLogging(this), this);
|
pm.registerEvents(new StructureGrowLogging(this), this);
|
||||||
}
|
}
|
||||||
|
if (isLogging(Logging.BONEMEALSTRUCTUREGROW)) {
|
||||||
|
pm.registerEvents(new BlockFertilizeLogging(this), this);
|
||||||
|
}
|
||||||
if (isLogging(Logging.GRASSGROWTH) || isLogging(Logging.MYCELIUMSPREAD) || isLogging(Logging.VINEGROWTH) || isLogging(Logging.MUSHROOMSPREAD) || isLogging(Logging.BAMBOOGROWTH) || isLogging(Logging.DRIPSTONEGROWTH)) {
|
if (isLogging(Logging.GRASSGROWTH) || isLogging(Logging.MYCELIUMSPREAD) || isLogging(Logging.VINEGROWTH) || isLogging(Logging.MUSHROOMSPREAD) || isLogging(Logging.BAMBOOGROWTH) || isLogging(Logging.DRIPSTONEGROWTH)) {
|
||||||
pm.registerEvents(new BlockSpreadLogging(this), this);
|
pm.registerEvents(new BlockSpreadLogging(this), this);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,36 @@
|
|||||||
|
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.WorldConfig;
|
||||||
|
import org.bukkit.block.BlockState;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.block.BlockFertilizeEvent;
|
||||||
|
import static de.diddiz.LogBlock.config.Config.getWorldConfig;
|
||||||
|
|
||||||
|
public class BlockFertilizeLogging extends LoggingListener {
|
||||||
|
public BlockFertilizeLogging(LogBlock lb) {
|
||||||
|
super(lb);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
|
public void onBlockFertilize(BlockFertilizeEvent event) {
|
||||||
|
final WorldConfig wcfg = getWorldConfig(event.getBlock().getLocation().getWorld());
|
||||||
|
if (wcfg != null) {
|
||||||
|
if (!wcfg.isLogging(Logging.BONEMEALSTRUCTUREGROW)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final Actor actor;
|
||||||
|
if (event.getPlayer() != null) {
|
||||||
|
actor = Actor.actorFromEntity(event.getPlayer());
|
||||||
|
} else {
|
||||||
|
actor = new Actor("Dispenser");
|
||||||
|
}
|
||||||
|
for (final BlockState state : event.getBlocks()) {
|
||||||
|
consumer.queueBlockReplace(actor, state.getBlock().getState(), state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -20,20 +20,14 @@ public class StructureGrowLogging extends LoggingListener {
|
|||||||
public void onStructureGrow(StructureGrowEvent event) {
|
public void onStructureGrow(StructureGrowEvent event) {
|
||||||
final WorldConfig wcfg = getWorldConfig(event.getWorld());
|
final WorldConfig wcfg = getWorldConfig(event.getWorld());
|
||||||
if (wcfg != null) {
|
if (wcfg != null) {
|
||||||
final Actor actor;
|
if (!wcfg.isLogging(Logging.NATURALSTRUCTUREGROW)) {
|
||||||
if (event.getPlayer() != null) {
|
return;
|
||||||
if (!wcfg.isLogging(Logging.BONEMEALSTRUCTUREGROW)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
actor = Actor.actorFromEntity(event.getPlayer());
|
|
||||||
} else {
|
|
||||||
if (!wcfg.isLogging(Logging.NATURALSTRUCTUREGROW)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
actor = new Actor("NaturalGrow");
|
|
||||||
}
|
}
|
||||||
for (final BlockState state : event.getBlocks()) {
|
if (!event.isFromBonemeal()) {
|
||||||
consumer.queueBlockReplace(actor, state.getBlock().getState(), state);
|
final Actor actor = new Actor("NaturalGrow");
|
||||||
|
for (final BlockState state : event.getBlocks()) {
|
||||||
|
consumer.queueBlockReplace(actor, state.getBlock().getState(), state);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user