diff --git a/src/main/java/net/coreprotect/config/Config.java b/src/main/java/net/coreprotect/config/Config.java index e6e496f..4bac42d 100644 --- a/src/main/java/net/coreprotect/config/Config.java +++ b/src/main/java/net/coreprotect/config/Config.java @@ -86,6 +86,7 @@ public class Config extends Language { public boolean PLAYER_MESSAGES; public boolean PLAYER_COMMANDS; public boolean PLAYER_SESSIONS; + public boolean UNKNOWN_LOGGING; public boolean USERNAME_CHANGES; public boolean WORLDEDIT; public int MYSQL_MAXIMUM_POOL_SIZE; @@ -196,6 +197,7 @@ public class Config extends Language { this.HOPPER_FILTER_META = this.getBoolean("hopper-filter-meta", false); this.EXCLUDE_TNT = this.getBoolean("exclude-tnt", false); this.NETWORK_DEBUG = this.getBoolean("network-debug", false); + this.UNKNOWN_LOGGING = this.getBoolean("unknown-logging", false); this.DONATION_KEY = this.getString("donation-key"); this.MYSQL = this.getBoolean("use-mysql"); this.PREFIX = this.getString("table-prefix"); diff --git a/src/main/java/net/coreprotect/listener/block/BlockFormListener.java b/src/main/java/net/coreprotect/listener/block/BlockFormListener.java index a544eb2..71a41f6 100644 --- a/src/main/java/net/coreprotect/listener/block/BlockFormListener.java +++ b/src/main/java/net/coreprotect/listener/block/BlockFormListener.java @@ -20,10 +20,11 @@ public final class BlockFormListener extends Queue implements Listener { @EventHandler(priority = EventPriority.MONITOR) protected void onBlockForm(BlockFormEvent event) { // random form, snow/ice - World world = event.getBlock().getWorld(); + Block block = event.getBlock(); + World world = block.getWorld(); BlockState newState = event.getNewState(); - if (Config.getConfig(world).LIQUID_TRACKING && (newState.getType().equals(Material.OBSIDIAN) || newState.getType().equals(Material.COBBLESTONE) || event.getBlock().getType().name().endsWith("_CONCRETE_POWDER"))) { - Block block = event.getBlock(); + boolean log = false; + if (Config.getConfig(world).LIQUID_TRACKING && (newState.getType().equals(Material.OBSIDIAN) || newState.getType().equals(Material.COBBLESTONE) || block.getType().name().endsWith("_CONCRETE_POWDER"))) { String player = Lookup.whoPlacedCache(block); int wid = Util.getWorldId(world.getName()); if (!(player.length() > 0)) { @@ -58,7 +59,7 @@ public final class BlockFormListener extends Queue implements Listener { } } if (player.length() > 0) { - boolean log = true; + log = true; /* if (newState.getType().equals(Material.COBBLESTONE)) { log = false; @@ -78,6 +79,9 @@ public final class BlockFormListener extends Queue implements Listener { } } } + if (!log && Config.getConfig(world).UNKNOWN_LOGGING && Lookup.whoPlacedCache(block).length() == 0){ + Queue.queueBlockPlace("#unknown", block.getLocation().getBlock().getState(), block.getType(), block.getState(), newState.getType(), -1, 0, newState.getBlockData().getAsString()); + } } }