mirror of
https://github.com/PlayPro/CoreProtect.git
synced 2024-11-28 12:55:34 +01:00
Added hidden "unknown-user" logging option (default: false) (#397)
* Allow unknown user logging (attempt to patch a bug of tnt splashing blocks and it not being logged) * Changed "unknown-logging" to be hidden (default: false) * Update BlockFormListener.java --------- Co-authored-by: Radiant <i.like.using.discord@gmail.com> Co-authored-by: Intelli <6790859+Intelli@users.noreply.github.com>
This commit is contained in:
parent
2476aa2ea8
commit
1331b8d0c5
@ -86,6 +86,7 @@ public class Config extends Language {
|
|||||||
public boolean PLAYER_MESSAGES;
|
public boolean PLAYER_MESSAGES;
|
||||||
public boolean PLAYER_COMMANDS;
|
public boolean PLAYER_COMMANDS;
|
||||||
public boolean PLAYER_SESSIONS;
|
public boolean PLAYER_SESSIONS;
|
||||||
|
public boolean UNKNOWN_LOGGING;
|
||||||
public boolean USERNAME_CHANGES;
|
public boolean USERNAME_CHANGES;
|
||||||
public boolean WORLDEDIT;
|
public boolean WORLDEDIT;
|
||||||
public int MYSQL_MAXIMUM_POOL_SIZE;
|
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.HOPPER_FILTER_META = this.getBoolean("hopper-filter-meta", false);
|
||||||
this.EXCLUDE_TNT = this.getBoolean("exclude-tnt", false);
|
this.EXCLUDE_TNT = this.getBoolean("exclude-tnt", false);
|
||||||
this.NETWORK_DEBUG = this.getBoolean("network-debug", 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.DONATION_KEY = this.getString("donation-key");
|
||||||
this.MYSQL = this.getBoolean("use-mysql");
|
this.MYSQL = this.getBoolean("use-mysql");
|
||||||
this.PREFIX = this.getString("table-prefix");
|
this.PREFIX = this.getString("table-prefix");
|
||||||
|
@ -20,10 +20,11 @@ public final class BlockFormListener extends Queue implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
protected void onBlockForm(BlockFormEvent event) {
|
protected void onBlockForm(BlockFormEvent event) {
|
||||||
// random form, snow/ice
|
// random form, snow/ice
|
||||||
World world = event.getBlock().getWorld();
|
Block block = event.getBlock();
|
||||||
|
World world = block.getWorld();
|
||||||
BlockState newState = event.getNewState();
|
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"))) {
|
boolean log = false;
|
||||||
Block block = event.getBlock();
|
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);
|
String player = Lookup.whoPlacedCache(block);
|
||||||
int wid = Util.getWorldId(world.getName());
|
int wid = Util.getWorldId(world.getName());
|
||||||
if (!(player.length() > 0)) {
|
if (!(player.length() > 0)) {
|
||||||
@ -58,7 +59,7 @@ public final class BlockFormListener extends Queue implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (player.length() > 0) {
|
if (player.length() > 0) {
|
||||||
boolean log = true;
|
log = true;
|
||||||
/*
|
/*
|
||||||
if (newState.getType().equals(Material.COBBLESTONE)) {
|
if (newState.getType().equals(Material.COBBLESTONE)) {
|
||||||
log = false;
|
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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user