This commit is contained in:
Intelli 2023-07-13 14:43:09 -06:00
parent df9b478be7
commit 1e007c98a4
7 changed files with 16 additions and 25 deletions

View File

@ -212,4 +212,9 @@ public class BukkitAdapter implements BukkitInterface {
return Tag.SIGNS.isTagged(material);
}
@Override
public boolean isChiseledBookshelf(Material material) {
return false;
}
}

View File

@ -67,4 +67,6 @@ public interface BukkitInterface {
public boolean isSign(Material material);
public boolean isChiseledBookshelf(Material material);
}

View File

@ -104,4 +104,9 @@ public class Bukkit_v1_20 extends Bukkit_v1_19 implements BukkitInterface {
return Tag.ALL_SIGNS.isTagged(material);
}
@Override
public boolean isChiseledBookshelf(Material material) {
return material == Material.CHISELED_BOOKSHELF;
}
}

View File

@ -348,7 +348,7 @@ public class Database extends Queue {
index = ", INDEX(time), INDEX(user,time), INDEX(wid,x,z,time)";
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "command(rowid int NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid),time int, user int, wid int, x int, y int (3), z int, message varchar(16000)" + index + ") ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4");
index = ", INDEX(wid,x,z,time), INDEX(user,time), INDEX(type,time)";
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "container(rowid int NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid), time int, user int, wid int, x int, y int, z int, type int, data int, amount int, slot tinyint, metadata blob, action tinyint, rolled_back tinyint" + index + ") ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4");
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "container(rowid int NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid), time int, user int, wid int, x int, y int, z int, type int, data int, amount int, metadata blob, action tinyint, rolled_back tinyint" + index + ") ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4");
index = ", INDEX(wid,x,z,time), INDEX(user,time), INDEX(type,time)";
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "item(rowid int NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid), time int, user int, wid int, x int, y int, z int, type int, data blob, amount int, action tinyint, rolled_back tinyint" + index + ") ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4");
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "database_lock(rowid int NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid),status tinyint,time int) ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4");
@ -426,7 +426,7 @@ public class Database extends Queue {
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "command (time INTEGER, user INTEGER, wid INTEGER, x INTEGER, y INTEGER, z INTEGER, message TEXT);");
}
if (!tableData.contains(prefix + "container")) {
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "container (time INTEGER, user INTEGER, wid INTEGER, x INTEGER, y INTEGER, z INTEGER, type INTEGER, data INTEGER, amount INTEGER, slot INTEGER, metadata BLOB, action INTEGER, rolled_back INTEGER);");
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "container (time INTEGER, user INTEGER, wid INTEGER, x INTEGER, y INTEGER, z INTEGER, type INTEGER, data INTEGER, amount INTEGER, metadata BLOB, action INTEGER, rolled_back INTEGER);");
}
if (!tableData.contains(prefix + "item")) {
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "item (time INTEGER, user INTEGER, wid INTEGER, x INTEGER, y INTEGER, z INTEGER, type INTEGER, data BLOB, amount INTEGER, action INTEGER, rolled_back INTEGER);");

View File

@ -1716,7 +1716,7 @@ public class Rollback extends Queue {
modifiedArmor = addedItem ? setArmor : modifiedArmor;
}
if (!addedItem) {
if (type.name().equals("CHISELED_BOOKSHELF")) {
if (BukkitAdapter.ADAPTER.isChiseledBookshelf(type)) {
ItemStack[] inventoryContents = inventory.getStorageContents();
int i = 0;
for (ItemStack stack : inventoryContents) {

View File

@ -684,7 +684,7 @@ public final class PlayerInteractListener extends Queue implements Listener {
}
}
}
else if (type.name().equals("CHISELED_BOOKSHELF")) {
else if (BukkitAdapter.ADAPTER.isChiseledBookshelf(type)) {
BlockState blockState = block.getState();
if (blockState instanceof BlockInventoryHolder) {
InventoryChangeListener.inventoryTransaction(player.getName(), blockState.getLocation(), null);

View File

@ -161,27 +161,6 @@ public class __2_22_0 {
Chat.console(Phrase.build(Phrase.PATCH_SKIP_UPDATE, ConfigHandler.prefix + "sign", Selector.FIRST, Selector.FIRST));
}
}
if (!Patch.continuePatch()) {
return false;
}
if (Config.getGlobal().MYSQL) {
try {
statement.executeUpdate("ALTER TABLE " + ConfigHandler.prefix + "container ADD COLUMN slot TINYINT DEFAULT 0;");
}
catch (Exception e) {
Chat.console(Phrase.build(Phrase.PATCH_SKIP_UPDATE, ConfigHandler.prefix + "container", Selector.FIRST, Selector.FIRST));
}
}
else {
try {
statement.executeUpdate("ALTER TABLE " + ConfigHandler.prefix + "container ADD COLUMN slot INTEGER DEFAULT 0;");
}
catch (Exception e) {
Chat.console(Phrase.build(Phrase.PATCH_SKIP_UPDATE, ConfigHandler.prefix + "container", Selector.FIRST, Selector.FIRST));
}
}
}
catch (Exception e) {
e.printStackTrace();