forked from LogBlock/LogBlock
@ -1135,11 +1135,11 @@ public class Consumer extends Thread {
|
||||
|
||||
private int safeY(Location loc) {
|
||||
int safeY = loc.getBlockY();
|
||||
if (safeY < 0) {
|
||||
safeY = 0;
|
||||
if (safeY < Short.MIN_VALUE) {
|
||||
safeY = Short.MIN_VALUE;
|
||||
}
|
||||
if (safeY > 65535) {
|
||||
safeY = 65535;
|
||||
if (safeY > Short.MAX_VALUE) {
|
||||
safeY = Short.MAX_VALUE;
|
||||
}
|
||||
return safeY;
|
||||
}
|
||||
|
@ -730,6 +730,7 @@ class Updater {
|
||||
}
|
||||
|
||||
if (configVersion.compareTo(new ComparableVersion("1.16.0")) < 0) {
|
||||
logblock.getLogger().info("Updating tables to 1.16.0 ...");
|
||||
try (Connection conn = logblock.getConnection()) {
|
||||
conn.setAutoCommit(true);
|
||||
final Statement st = conn.createStatement();
|
||||
@ -742,6 +743,20 @@ class Updater {
|
||||
}
|
||||
config.set("version", "1.16.0");
|
||||
}
|
||||
if (configVersion.compareTo(new ComparableVersion("1.17.0")) < 0) {
|
||||
logblock.getLogger().info("Updating tables to 1.17.0 ...");
|
||||
try (Connection conn = logblock.getConnection()) {
|
||||
conn.setAutoCommit(true);
|
||||
final Statement st = conn.createStatement();
|
||||
for (final WorldConfig wcfg : getLoggedWorlds()) {
|
||||
st.executeUpdate("ALTER TABLE `" + wcfg.table + "-blocks` CHANGE `y` `y` SMALLINT(5) NOT NULL");
|
||||
}
|
||||
st.close();
|
||||
} catch (final SQLException ex) {
|
||||
logblock.getLogger().log(Level.SEVERE, "[Updater] Warning: Could not alter table", ex);
|
||||
}
|
||||
config.set("version", "1.17.0");
|
||||
}
|
||||
|
||||
if (configVersion.compareTo(new ComparableVersion(Config.CURRENT_CONFIG_VERSION)) < 0) {
|
||||
config.set("version", Config.CURRENT_CONFIG_VERSION);
|
||||
@ -827,7 +842,7 @@ class Updater {
|
||||
createTable(state, "lb-entitytypes", "(id INT UNSIGNED NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY (id)) DEFAULT CHARSET " + charset);
|
||||
|
||||
for (final WorldConfig wcfg : getLoggedWorlds()) {
|
||||
createTable(state, wcfg.table + "-blocks", "(id INT UNSIGNED NOT NULL AUTO_INCREMENT, date DATETIME NOT NULL, playerid INT UNSIGNED NOT NULL, replaced SMALLINT UNSIGNED NOT NULL, replacedData SMALLINT NOT NULL, type SMALLINT UNSIGNED NOT NULL, typeData SMALLINT NOT NULL, x MEDIUMINT NOT NULL, y SMALLINT UNSIGNED NOT NULL, z MEDIUMINT NOT NULL, PRIMARY KEY (id), KEY coords (x, z, y), KEY date (date), KEY playerid (playerid))");
|
||||
createTable(state, wcfg.table + "-blocks", "(id INT UNSIGNED NOT NULL AUTO_INCREMENT, date DATETIME NOT NULL, playerid INT UNSIGNED NOT NULL, replaced SMALLINT UNSIGNED NOT NULL, replacedData SMALLINT NOT NULL, type SMALLINT UNSIGNED NOT NULL, typeData SMALLINT NOT NULL, x MEDIUMINT NOT NULL, y SMALLINT NOT NULL, z MEDIUMINT NOT NULL, PRIMARY KEY (id), KEY coords (x, z, y), KEY date (date), KEY playerid (playerid))");
|
||||
createTable(state, wcfg.table + "-chestdata", "(id INT UNSIGNED NOT NULL, item MEDIUMBLOB, itemremove TINYINT, itemtype SMALLINT NOT NULL DEFAULT '0', PRIMARY KEY (id))");
|
||||
createTable(state, wcfg.table + "-state", "(id INT UNSIGNED NOT NULL, replacedState MEDIUMBLOB NULL, typeState MEDIUMBLOB NULL, PRIMARY KEY (id))");
|
||||
if (wcfg.isLogging(Logging.KILL)) {
|
||||
|
@ -60,7 +60,7 @@ public class Config {
|
||||
// Not loaded from config - checked at runtime
|
||||
public static boolean mb4 = false;
|
||||
|
||||
public static final String CURRENT_CONFIG_VERSION = "1.16.0";
|
||||
public static final String CURRENT_CONFIG_VERSION = "1.17.0";
|
||||
|
||||
public static enum LogKillsLevel {
|
||||
PLAYERS,
|
||||
|
@ -52,15 +52,15 @@ public class LoggingUtil {
|
||||
int initialy = loc.getBlockY();
|
||||
int y = initialy;
|
||||
int z = loc.getBlockZ();
|
||||
while (y > 0 && BukkitUtils.canFallIn(loc.getWorld(), x, (y - 1), z)) {
|
||||
while (y > loc.getWorld().getMinHeight() && BukkitUtils.canFallIn(loc.getWorld(), x, (y - 1), z)) {
|
||||
y--;
|
||||
}
|
||||
if (initialy != y && !BukkitUtils.isEmpty(replaced.getType())) {
|
||||
// this is not the final location but the block got removed (vines etc)
|
||||
consumer.queueBlockBreak(actor, replaced);
|
||||
}
|
||||
// If y is 0 then the block fell out of the world :(
|
||||
if (y != 0) {
|
||||
// If y is minHeight then the block fell out of the world :(
|
||||
if (y > loc.getWorld().getMinHeight()) {
|
||||
// Run this check to avoid false positives
|
||||
Location finalLoc = new Location(loc.getWorld(), x, y, z);
|
||||
if (y == initialy || !BukkitUtils.getFallingEntityKillers().contains(finalLoc.getBlock().getType())) {
|
||||
@ -94,11 +94,11 @@ public class LoggingUtil {
|
||||
int x = loc.getBlockX();
|
||||
int y = loc.getBlockY();
|
||||
int z = loc.getBlockZ();
|
||||
while (y > 0 && BukkitUtils.canFallIn(loc.getWorld(), x, (y - 1), z)) {
|
||||
while (y > loc.getWorld().getMinHeight() && BukkitUtils.canFallIn(loc.getWorld(), x, (y - 1), z)) {
|
||||
y--;
|
||||
}
|
||||
// If y is 0 then the sand block fell out of the world :(
|
||||
if (y != 0) {
|
||||
// If y is minHeight then the sand block fell out of the world :(
|
||||
if (y > loc.getWorld().getMinHeight()) {
|
||||
Location finalLoc = new Location(loc.getWorld(), x, y, z);
|
||||
// Run this check to avoid false positives
|
||||
if (!BukkitUtils.getFallingEntityKillers().contains(finalLoc.getBlock().getType())) {
|
||||
|
Reference in New Issue
Block a user