diff --git a/src/main/java/net/coreprotect/database/Database.java b/src/main/java/net/coreprotect/database/Database.java index 844c8f0..9137c35 100755 --- a/src/main/java/net/coreprotect/database/Database.java +++ b/src/main/java/net/coreprotect/database/Database.java @@ -372,7 +372,7 @@ public class Database extends Queue { statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "session(rowid int NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid),time int, user int, wid int, x int, y int (3), z int, action tinyint" + index + ") ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4"); index = ", INDEX(wid,x,z,time), INDEX(user,time), INDEX(time)"; statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "sign(rowid int NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid),time int, user int, wid int, x int, y int, z int, action tinyint, color int, color_secondary int, data tinyint, waxed tinyint, face tinyint, line_1 varchar(100), line_2 varchar(100), line_3 varchar(100), line_4 varchar(100), line_5 varchar(100), line_6 varchar(100), line_7 varchar(100), line_8 varchar(100)" + index + ") ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4"); - statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "skull(rowid int NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid), time int, owner varchar(64)) ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4"); + statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "skull(rowid int NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid), time int, owner varchar(255)) ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4"); index = ", INDEX(user), INDEX(uuid)"; statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "user(rowid int NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid),time int,user varchar(100),uuid varchar(64)" + index + ") ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4"); index = ", INDEX(uuid,user)"; diff --git a/src/main/java/net/coreprotect/paper/Paper_v1_20.java b/src/main/java/net/coreprotect/paper/Paper_v1_20.java index db2c829..3888dba 100644 --- a/src/main/java/net/coreprotect/paper/Paper_v1_20.java +++ b/src/main/java/net/coreprotect/paper/Paper_v1_20.java @@ -22,7 +22,15 @@ public class Paper_v1_20 extends Paper_v1_17 implements PaperInterface { @Override public String getSkullOwner(Skull skull) { - return skull.getPlayerProfile().getName(); + String owner = skull.getPlayerProfile().getName(); + if (owner.length() > 255 && skull.getPlayerProfile().getId() != null) { + return skull.getPlayerProfile().getId().toString(); + } + else if (owner.length() > 255) { + return owner.substring(0, 255); + } + + return owner; } @Override diff --git a/src/main/java/net/coreprotect/patch/script/__2_23_0.java b/src/main/java/net/coreprotect/patch/script/__2_23_0.java new file mode 100644 index 0000000..cdf47c0 --- /dev/null +++ b/src/main/java/net/coreprotect/patch/script/__2_23_0.java @@ -0,0 +1,31 @@ +package net.coreprotect.patch.script; + +import java.sql.Statement; + +import net.coreprotect.config.Config; +import net.coreprotect.config.ConfigHandler; +import net.coreprotect.language.Phrase; +import net.coreprotect.language.Selector; +import net.coreprotect.utility.Chat; + +public class __2_23_0 { + + protected static boolean patch(Statement statement) { + try { + if (Config.getGlobal().MYSQL) { + try { + statement.executeUpdate("ALTER TABLE " + ConfigHandler.prefix + "skull MODIFY owner VARCHAR(255);"); + } + catch (Exception e) { + Chat.console(Phrase.build(Phrase.PATCH_SKIP_UPDATE, ConfigHandler.prefix + "skull", Selector.FIRST, Selector.FIRST)); + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + + return true; + } + +}