Reworked config. Deleted, renamed and added a few.

This commit is contained in:
Robin Kupper
2011-04-13 23:15:26 +02:00
parent e035e3d03c
commit 2897bed011
4 changed files with 125 additions and 131 deletions

View File

@@ -35,7 +35,7 @@ public class ClearLog implements Runnable
rs.next(); rs.next();
int deleted = rs.getInt(1); int deleted = rs.getInt(1);
if (deleted > 0) { if (deleted > 0) {
if (LogBlock.config.dumpDroppedLog) if (LogBlock.config.dumpDeletedLog)
state.execute("SELECT * FROM `" + table + "` WHERE date < '" + time + "' INTO OUTFILE '" + new File(dumbFolder, table + "-" + time + ".csv").getAbsolutePath().replace("\\", "\\\\") + "' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' LINES TERMINATED BY '\n'"); state.execute("SELECT * FROM `" + table + "` WHERE date < '" + time + "' INTO OUTFILE '" + new File(dumbFolder, table + "-" + time + ".csv").getAbsolutePath().replace("\\", "\\\\") + "' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' LINES TERMINATED BY '\n'");
state.execute("DELETE FROM `" + table + "` WHERE date < '" + time + "'"); state.execute("DELETE FROM `" + table + "` WHERE date < '" + time + "'");
LogBlock.log.info("[LogBlock] Cleared out table " + table + ". Deleted " + deleted + " entries."); LogBlock.log.info("[LogBlock] Cleared out table " + table + ". Deleted " + deleted + " entries.");
@@ -44,7 +44,7 @@ public class ClearLog implements Runnable
rs.next(); rs.next();
deleted = rs.getInt(1); deleted = rs.getInt(1);
if (deleted > 0) { if (deleted > 0) {
if (LogBlock.config.dumpDroppedLog) if (LogBlock.config.dumpDeletedLog)
state.execute("SELECT id, signtext FROM `" + table + "-sign` LEFT JOIN `" + table + "` USING (id) WHERE `" + table + "`.id IS NULL INTO OUTFILE '" + new File(dumbFolder, table + "-sign-" + time + ".csv").getAbsolutePath().replace("\\", "\\\\") + "' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' LINES TERMINATED BY '\n'"); state.execute("SELECT id, signtext FROM `" + table + "-sign` LEFT JOIN `" + table + "` USING (id) WHERE `" + table + "`.id IS NULL INTO OUTFILE '" + new File(dumbFolder, table + "-sign-" + time + ".csv").getAbsolutePath().replace("\\", "\\\\") + "' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' LINES TERMINATED BY '\n'");
state.execute("DELETE `" + table + "-sign` FROM `" + table + "-sign` LEFT JOIN `" + table + "` USING (id) WHERE `" + table + "`.id IS NULL;"); state.execute("DELETE `" + table + "-sign` FROM `" + table + "-sign` LEFT JOIN `" + table + "` USING (id) WHERE `" + table + "`.id IS NULL;");
LogBlock.log.info("[LogBlock] Cleared out table " + table + "-sign. Deleted " + deleted + " entries."); LogBlock.log.info("[LogBlock] Cleared out table " + table + "-sign. Deleted " + deleted + " entries.");
@@ -53,7 +53,7 @@ public class ClearLog implements Runnable
rs.next(); rs.next();
deleted = rs.getInt(1); deleted = rs.getInt(1);
if (deleted > 0) { if (deleted > 0) {
if (LogBlock.config.dumpDroppedLog) if (LogBlock.config.dumpDeletedLog)
state.execute("SELECT id, intype, inamount, outtype, outamount FROM `" + table + "-chest` LEFT JOIN `" + table + "` USING (id) WHERE `" + table + "`.id IS NULL INTO OUTFILE '" + new File(dumbFolder, table + "-chest-" + time + ".csv").getAbsolutePath().replace("\\", "\\\\") + "' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' LINES TERMINATED BY '\n'"); state.execute("SELECT id, intype, inamount, outtype, outamount FROM `" + table + "-chest` LEFT JOIN `" + table + "` USING (id) WHERE `" + table + "`.id IS NULL INTO OUTFILE '" + new File(dumbFolder, table + "-chest-" + time + ".csv").getAbsolutePath().replace("\\", "\\\\") + "' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' LINES TERMINATED BY '\n'");
state.execute("DELETE `" + table + "-chest` FROM `" + table + "-chest` LEFT JOIN `" + table + "` USING (id) WHERE `" + table + "`.id IS NULL;"); state.execute("DELETE `" + table + "-chest` FROM `" + table + "-chest` LEFT JOIN `" + table + "` USING (id) WHERE `" + table + "`.id IS NULL;");
LogBlock.log.info("[LogBlock] Cleared out table " + table + "-chest. Deleted " + deleted + " entries."); LogBlock.log.info("[LogBlock] Cleared out table " + table + "-chest. Deleted " + deleted + " entries.");

View File

@@ -1,5 +1,6 @@
package de.diddiz.LogBlock; package de.diddiz.LogBlock;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@@ -9,20 +10,13 @@ import org.bukkit.util.config.Configuration;
public class Config { public class Config {
final HashMap<Integer, String> tables; final HashMap<Integer, String> tables;
final List<Integer> dontRollback; final String url;
final List<Integer> replaceAtRollback; final String user;
final String dbDriver; final String password;
final String dbUrl;
final String dbUsername;
final String dbPassword;
final int keepLogDays;
final boolean dumpDroppedLog;
final int delay; final int delay;
final int defaultDist; final boolean useBukkitScheduler;
final int defaultTime; final int keepLogDays;
final int toolID; final boolean dumpDeletedLog;
final int toolblockID;
final boolean toolblockRemove;
final boolean logBlockCreations; final boolean logBlockCreations;
final boolean logBlockDestroyings; final boolean logBlockDestroyings;
final boolean logSignTexts; final boolean logSignTexts;
@@ -30,112 +24,114 @@ public class Config {
final boolean logFire; final boolean logFire;
final boolean logLeavesDecay; final boolean logLeavesDecay;
final boolean logChestAccess; final boolean logChestAccess;
final String logTNTExplosionsAs; final List<Integer> dontRollback;
final String logCreeperExplosionsAs; final List<Integer> replaceAnyway;
final String logFireballExplosionsAs; final int defaultDist;
final String logFireAs; final int defaultTime;
final String logLeavesDecayAs; final int toolID;
boolean usePermissions; final int toolblockID;
Config (LogBlock logblock) throws Exception { Config (LogBlock logblock) throws Exception {
Configuration config = logblock.getConfiguration(); Configuration config = logblock.getConfiguration();
config.load(); config.load();
List<String> keys = config.getKeys(null); List<String> keys = config.getKeys(null);
List<String> subkeys;
if (!keys.contains("version")) if (!keys.contains("version"))
config.setProperty("version", logblock.getDescription().getVersion()); config.setProperty("version", logblock.getDescription().getVersion());
if (!keys.contains("worldNames")) if (!keys.contains("loggedWorlds"))
config.setProperty("worldNames", Arrays.asList(new String[]{"world"})); config.setProperty("loggedWorlds", Arrays.asList(new String[]{"world", "nether"}));
if (!keys.contains("worldTables")) if (!keys.contains("tables"))
config.setProperty("worldTables", Arrays.asList(new String[]{"lb-main"})); config.setProperty("tables", Arrays.asList(new String[]{"lb-main", "lb-hell"}));
if (!keys.contains("dontRollback")) subkeys = config.getKeys("mysql");
config.setProperty("dontRollback", Arrays.asList(new Integer[]{46, 51})); if (subkeys == null)
if (!keys.contains("replaceAtRollback")) subkeys = new ArrayList<String>();
config.setProperty("replaceAtRollback", Arrays.asList(new Integer[]{8, 9, 10, 11, 51})); if (!subkeys.contains("host"))
if (!keys.contains("driver")) config.setProperty("mysql.host", "localhost");
config.setProperty("driver", "com.mysql.jdbc.Driver"); if (!subkeys.contains("port"))
if (!keys.contains("url")) config.setProperty("mysql.port", 3306);
config.setProperty("url", "jdbc:mysql://localhost:3306/db"); if (!subkeys.contains("database"))
if (!keys.contains("username")) config.setProperty("mysql.database", "minecraft");
config.setProperty("username", "user"); if (!subkeys.contains("user"))
if (!keys.contains("password")) config.setProperty("mysql.user", "username");
config.setProperty("password", "pass"); if (!subkeys.contains("password"))
if (!keys.contains("keepLogDays")) config.setProperty("mysql.password", "pass");
config.setProperty("keepLogDays", -1); subkeys = config.getKeys("consumer");
if (!keys.contains("dumpDroppedLog")) if (subkeys == null)
config.setProperty("dumpDroppedLog", true); subkeys = new ArrayList<String>();
if (!keys.contains("delay")) if (!subkeys.contains("delay"))
config.setProperty("delay", 6); config.setProperty("consumer.delay", 6);
if (!keys.contains("defaultDist")) if (!subkeys.contains("useBukkitScheduler"))
config.setProperty("defaultDist", 20); config.setProperty("consumer.useBukkitScheduler", true);
if (!keys.contains("defaultTime")) subkeys = config.getKeys("clearlog");
config.setProperty("defaultTime", "30 minutes"); if (subkeys == null)
if (!keys.contains("toolID")) subkeys = new ArrayList<String>();
config.setProperty("toolID", 270); if (!subkeys.contains("dumpDeletedLog"))
if (!keys.contains("toolblockID")) config.setProperty("clearlog.dumpDeletedLog", false);
config.setProperty("toolblockID", 7); if (!subkeys.contains("keepLogDays"))
if (!keys.contains("toolblockRemove")) config.setProperty("clearlog.keepLogDays", -1);
config.setProperty("toolblockRemove", true); subkeys = config.getKeys("logging");
if (!keys.contains("logBlockCreations")) if (subkeys == null)
config.setProperty("logBlockCreations", true); subkeys = new ArrayList<String>();
if (!keys.contains("logBlockDestroyings")) if (!subkeys.contains("logBlockCreations"))
config.setProperty("logBlockDestroyings", true); config.setProperty("logging.logBlockCreations", true);
if (!keys.contains("logSignTexts")) if (!subkeys.contains("logBlockDestroyings"))
config.setProperty("logSignTexts", false); config.setProperty("logging.logBlockDestroyings", true);
if (!keys.contains("logExplosions")) if (!subkeys.contains("logSignTexts"))
config.setProperty("logExplosions", false); config.setProperty("logging.logSignTexts", false);
if (!keys.contains("logFire")) if (!subkeys.contains("logExplosions"))
config.setProperty("logFire", false); config.setProperty("logging.logExplosions", false);
if (!keys.contains("logChestAccess")) if (!subkeys.contains("llogFire"))
config.setProperty("logChestAccess", false); config.setProperty("logging.logFire", false);
if (!keys.contains("logLeavesDecay")) if (!subkeys.contains("logChestAccess"))
config.setProperty("logLeavesDecay", false); config.setProperty("logging.logChestAccess", false);
if (!keys.contains("logTNTExplosionsAs")) if (!subkeys.contains("logLeavesDecay"))
config.setProperty("logTNTExplosionsAs", "TNT"); config.setProperty("logging.logLeavesDecay", false);
if (!keys.contains("logCreeperExplosionsAs")) subkeys = config.getKeys("rollback");
config.setProperty("logCreeperExplosionsAs", "Creeper"); if (subkeys == null)
if (!keys.contains("logFireballExplosionsAs")) subkeys = new ArrayList<String>();
config.setProperty("logFireballExplosionsAs", "Ghast"); if (!subkeys.contains("dontRollback"))
if (!keys.contains("logFireAs")) config.setProperty("rollback.dontRollback", Arrays.asList(new Integer[]{10, 11, 46, 51}));
config.setProperty("logFireAs", "Fire"); if (!subkeys.contains("replaceAnyway"))
if (!keys.contains("logLeavesDecayAs")) config.setProperty("rollback.replaceAnyway", Arrays.asList(new Integer[]{8, 9, 10, 11, 51}));
config.setProperty("logLeavesDecayAs", "LeavesDecay"); subkeys = config.getKeys("lookup");
if (!keys.contains("usePermissions")) if (subkeys == null)
config.setProperty("usePermissions", false); subkeys = new ArrayList<String>();
if (!subkeys.contains("defaultDist"))
config.setProperty("lookup.defaultDist", 20);
if (!subkeys.contains("defaultTime"))
config.setProperty("lookup.defaultTime", "30 minutes");
if (!subkeys.contains("toolID"))
config.setProperty("lookup.toolID", 270);
if (!subkeys.contains("toolblockID"))
config.setProperty("lookup.toolblockID", 7);
if (!config.save()) if (!config.save())
throw new Exception("Error while writing to config.yml"); throw new Exception("Error while writing to config.yml");
dbDriver = config.getString("driver"); url = "jdbc:mysql://" + config.getString("mysql.host") + ":" + config.getString("mysql.port") + "/" + config.getString("mysql.database");
dbUrl = config.getString("url"); user = config.getString("mysql.user");
dbUsername = config.getString("username"); password = config.getString("mysql.password");
dbPassword = config.getString("password"); delay = config.getInt("consumer.delay", 6);
keepLogDays = config.getInt("keepLogDays", -1); useBukkitScheduler = config.getBoolean("consumer.useBukkitScheduler", true);
dumpDroppedLog = config.getBoolean("dumpDroppedLog", true); keepLogDays = config.getInt("clearlog.keepLogDays", -1);
delay = config.getInt("delay", 6); dumpDeletedLog = config.getBoolean("clearlog.dumpDeletedLog", false);
defaultDist = config.getInt("defaultDist", 20); logBlockCreations = config.getBoolean("logging.logBlockCreations", true);
defaultTime = LogBlock.parseTimeSpec(config.getString("defaultTime")); logBlockDestroyings = config.getBoolean("logging.logBlockDestroyings", true);
toolID = config.getInt("toolID", 270); logSignTexts = config.getBoolean("logging.logSignTexts", false);
logExplosions = config.getBoolean("logging.logExplosions", false);
logFire = config.getBoolean("logging.logFire", false);
logChestAccess = config.getBoolean("logging.logChestAccess", false);
logLeavesDecay = config.getBoolean("logging.logLeavesDecay", false);
dontRollback = config.getIntList("rollback.dontRollback", null);
replaceAnyway = config.getIntList("rollback.replaceAnyway", null);
defaultDist = config.getInt("lookup.defaultDist", 20);
defaultTime = LogBlock.parseTimeSpec(config.getString("lookup.defaultTime"));
toolID = config.getInt("lookup.toolID", 270);
if (Material.getMaterial(toolID) == null || Material.getMaterial(toolID).isBlock()) if (Material.getMaterial(toolID) == null || Material.getMaterial(toolID).isBlock())
throw new Exception("toolID doesn't appear to be a valid item id"); throw new Exception("lookup.toolID doesn't appear to be a valid item id");
toolblockID = config.getInt("toolblockID", 7); toolblockID = config.getInt("lookup.toolblockID", 7);
if (Material.getMaterial(toolblockID) == null || !Material.getMaterial(toolblockID).isBlock() || toolblockID == 0) if (Material.getMaterial(toolblockID) == null || !Material.getMaterial(toolblockID).isBlock() || toolblockID == 0)
throw new Exception("toolblockID doesn't appear to be a valid block id"); throw new Exception("lookup.toolblockID doesn't appear to be a valid block id");
toolblockRemove = config.getBoolean("toolblockRemove", true); List<String> worldNames = config.getStringList("loggedWorlds", null);
logBlockCreations = config.getBoolean("logBlockCreations", true); List<String> worldTables = config.getStringList("tables", null);
logBlockDestroyings = config.getBoolean("logBlockDestroyings", true);
logSignTexts = config.getBoolean("logSignTexts", false);
logExplosions = config.getBoolean("logExplosions", false);
logFire = config.getBoolean("logFire", false);
logChestAccess = config.getBoolean("logChestAccess", false);
logLeavesDecay = config.getBoolean("logLeavesDecay", false);
logTNTExplosionsAs = config.getString("logTNTExplosionsAs");
logCreeperExplosionsAs = config.getString("logCreeperExplosionsAs");
logFireballExplosionsAs = config.getString("logFireballExplosionsAs");
logFireAs = config.getString("logFireAs");
logLeavesDecayAs = config.getString("logLeavesDecayAs");
usePermissions = config.getBoolean("usePermissions", false);
dontRollback = config.getIntList("dontRollback", null);
replaceAtRollback = config.getIntList("replaceAtRollback", null);
List<String> worldNames = config.getStringList("worldNames", null);
List<String> worldTables = config.getStringList("worldTables", null);
tables = new HashMap<Integer, String>(); tables = new HashMap<Integer, String>();
if (worldNames == null || worldTables == null || worldNames.size() == 0 || worldNames.size() != worldTables.size()) if (worldNames == null || worldTables == null || worldNames.size() == 0 || worldNames.size() != worldTables.size())
throw new Exception("worldNames or worldTables not set porperly"); throw new Exception("worldNames or worldTables not set porperly");

View File

@@ -41,6 +41,7 @@ import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import com.nijiko.permissions.PermissionHandler;
import com.nijikokun.bukkit.Permissions.Permissions; import com.nijikokun.bukkit.Permissions.Permissions;
import com.sk89q.worldedit.bukkit.WorldEditPlugin; import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.bukkit.selections.CuboidSelection; import com.sk89q.worldedit.bukkit.selections.CuboidSelection;
@@ -56,6 +57,7 @@ public class LogBlock extends JavaPlugin
public ConnectionPool pool; public ConnectionPool pool;
private Consumer consumer = null; private Consumer consumer = null;
private Timer timer = null; private Timer timer = null;
private PermissionHandler permissions = null;
@Override @Override
public void onEnable() { public void onEnable() {
@@ -67,14 +69,11 @@ public class LogBlock extends JavaPlugin
getServer().getPluginManager().disablePlugin(this); getServer().getPluginManager().disablePlugin(this);
return; return;
} }
if (config.usePermissions) { if (getServer().getPluginManager().getPlugin("Permissions") != null) {
if (getServer().getPluginManager().getPlugin("Permissions") != null) permissions = ((Permissions)getServer().getPluginManager().getPlugin("Permissions")).getHandler();
log.info("[LogBlock] Permissions enabled"); log.info("[LogBlock] Permissions enabled");
else { } else
config.usePermissions = false; log.info("[LogBlock] Permissions plugin not found. Using default permissions.");
log.warning("[LogBlock] Permissions plugin not found. Using default permissions.");
}
}
File file = new File("lib/mysql-connector-java-bin.jar"); File file = new File("lib/mysql-connector-java-bin.jar");
try { try {
if (!file.exists() || file.length() == 0) { if (!file.exists() || file.length() == 0) {
@@ -89,7 +88,7 @@ public class LogBlock extends JavaPlugin
return; return;
} }
try { try {
pool = new ConnectionPool(config.dbDriver, config.dbUrl, config.dbUsername, config.dbPassword); pool = new ConnectionPool("com.mysql.jdbc.Driver", config.url, config.user, config.password);
Connection conn = pool.getConnection(); Connection conn = pool.getConnection();
conn.close(); conn.close();
} catch (Exception ex) { } catch (Exception ex) {
@@ -429,7 +428,7 @@ public class LogBlock extends JavaPlugin
if (!dbm.getTables(null, null, "lb-players", null).next()) if (!dbm.getTables(null, null, "lb-players", null).next())
return false; return false;
} }
state.execute("INSERT IGNORE INTO `lb-players` (playername) VALUES ('" + config.logTNTExplosionsAs + "'), ('" + config.logCreeperExplosionsAs + "'), ('" + config.logFireAs + "'), ('" + config.logLeavesDecayAs + "'), ('" + config.logFireballExplosionsAs + "'), ('Environment')"); state.execute("INSERT IGNORE INTO `lb-players` (playername) VALUES ('TNT'), ('Creeper'), ('Fire'), ('LeavesDecay'), ('Ghast'), ('Environment')");
for (String table : config.tables.values()) { for (String table : config.tables.values()) {
if (!dbm.getTables(null, null, table, null).next()) { if (!dbm.getTables(null, null, table, null).next()) {
log.log(Level.INFO, "[LogBlock] Crating table " + table + "."); log.log(Level.INFO, "[LogBlock] Crating table " + table + ".");
@@ -467,8 +466,8 @@ public class LogBlock extends JavaPlugin
} }
private boolean CheckPermission(Player player, String permission) { private boolean CheckPermission(Player player, String permission) {
if (config.usePermissions) if (permissions != null)
return Permissions.Security.permission(player, permission); return permissions.permission(player, permission);
else { else {
if (permission.equals("logblock.area")) if (permission.equals("logblock.area"))
return player.isOp(); return player.isOp();
@@ -521,12 +520,12 @@ public class LogBlock extends JavaPlugin
public void onBlockBurn(BlockBurnEvent event) { public void onBlockBurn(BlockBurnEvent event) {
if (!event.isCancelled()) if (!event.isCancelled())
consumer.queueBlock(config.logFireAs, event.getBlock(), event.getBlock().getTypeId(), 0, event.getBlock().getData()); consumer.queueBlock("Fire", event.getBlock(), event.getBlock().getTypeId(), 0, event.getBlock().getData());
} }
public void onLeavesDecay(LeavesDecayEvent event) { public void onLeavesDecay(LeavesDecayEvent event) {
if (!event.isCancelled()) if (!event.isCancelled())
consumer.queueBlock(config.logLeavesDecayAs, event.getBlock(), event.getBlock().getTypeId(), 0, event.getBlock().getData()); consumer.queueBlock("LeavesDecay", event.getBlock(), event.getBlock().getTypeId(), 0, event.getBlock().getData());
} }
} }
@@ -536,11 +535,11 @@ public class LogBlock extends JavaPlugin
if (!event.isCancelled()) { if (!event.isCancelled()) {
String name; String name;
if (event.getEntity() instanceof TNTPrimed) if (event.getEntity() instanceof TNTPrimed)
name = config.logTNTExplosionsAs; name = "TNT";
else if (event.getEntity() instanceof Creeper) else if (event.getEntity() instanceof Creeper)
name = config.logCreeperExplosionsAs; name = "Creeper";
else if (event.getEntity() instanceof Fireball) else if (event.getEntity() instanceof Fireball)
name = config.logFireballExplosionsAs; name = "Ghast";
else else
name = "Environment"; name = "Environment";
for (Block block : event.blockList()) for (Block block : event.blockList())
@@ -605,8 +604,7 @@ public class LogBlock extends JavaPlugin
event.setCancelled(true); event.setCancelled(true);
} else if (event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getMaterial().getId() == LogBlock.config.toolblockID && CheckPermission(event.getPlayer(), "logblock.lookup")) { } else if (event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getMaterial().getId() == LogBlock.config.toolblockID && CheckPermission(event.getPlayer(), "logblock.lookup")) {
getServer().getScheduler().scheduleAsyncDelayedTask(LogBlock.this, new BlockStats(pool.getConnection(), event.getPlayer(), event.getClickedBlock().getFace(event.getBlockFace()))); getServer().getScheduler().scheduleAsyncDelayedTask(LogBlock.this, new BlockStats(pool.getConnection(), event.getPlayer(), event.getClickedBlock().getFace(event.getBlockFace())));
if (config.toolblockRemove) event.setCancelled(true);
event.setCancelled(true);
} }
} }
} }

View File

@@ -166,7 +166,7 @@ public class Rollback implements Runnable
Block block = world.getBlockAt(x, y, z); Block block = world.getBlockAt(x, y, z);
if (!world.isChunkLoaded(block.getChunk())) if (!world.isChunkLoaded(block.getChunk()))
world.loadChunk(block.getChunk()); world.loadChunk(block.getChunk());
if (equalsType(block.getTypeId(), type) || LogBlock.config.replaceAtRollback.contains(block.getTypeId()) || (type == 0 && replaced == 0)) { if (equalsType(block.getTypeId(), type) || LogBlock.config.replaceAnyway.contains(block.getTypeId()) || (type == 0 && replaced == 0)) {
if (block.setTypeIdAndData(replaced, data, false)) if (block.setTypeIdAndData(replaced, data, false))
return PerformResult.SUCCESS; return PerformResult.SUCCESS;
else else