mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
Force flag names to be 64 characters or less
- A few people seem to be on interesting SQL installs. This should fix the issues they have with 767 bytes,
This commit is contained in:
parent
b56d4d0fea
commit
5e842f1572
@ -1211,7 +1211,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
+ ") ENGINE=InnoDB DEFAULT CHARSET=utf8");
|
+ ") ENGINE=InnoDB DEFAULT CHARSET=utf8");
|
||||||
stmt.addBatch("CREATE TABLE IF NOT EXISTS `" + this.prefix + "plot_flags`("
|
stmt.addBatch("CREATE TABLE IF NOT EXISTS `" + this.prefix + "plot_flags`("
|
||||||
+ "`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,"
|
+ "`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,"
|
||||||
+ "`plot_id` INT(11) NOT NULL," + " `flag` VARCHAR(256),"
|
+ "`plot_id` INT(11) NOT NULL," + " `flag` VARCHAR(64),"
|
||||||
+ " `value` VARCHAR(512)," + "FOREIGN KEY (plot_id) REFERENCES `" + this.prefix
|
+ " `value` VARCHAR(512)," + "FOREIGN KEY (plot_id) REFERENCES `" + this.prefix
|
||||||
+ "plot` (id) ON DELETE CASCADE, " + "UNIQUE (plot_id, flag)"
|
+ "plot` (id) ON DELETE CASCADE, " + "UNIQUE (plot_id, flag)"
|
||||||
+ ") ENGINE=InnoDB DEFAULT CHARSET=utf8");
|
+ ") ENGINE=InnoDB DEFAULT CHARSET=utf8");
|
||||||
@ -1270,7 +1270,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
+ " `value` blob NOT NULL" + ')');
|
+ " `value` blob NOT NULL" + ')');
|
||||||
stmt.addBatch("CREATE TABLE IF NOT EXISTS `" + this.prefix + "plot_flags`("
|
stmt.addBatch("CREATE TABLE IF NOT EXISTS `" + this.prefix + "plot_flags`("
|
||||||
+ "`id` INTEGER PRIMARY KEY AUTOINCREMENT," + "`plot_id` INTEGER NOT NULL,"
|
+ "`id` INTEGER PRIMARY KEY AUTOINCREMENT," + "`plot_id` INTEGER NOT NULL,"
|
||||||
+ " `flag` VARCHAR(256)," + " `value` VARCHAR(512),"
|
+ " `flag` VARCHAR(64)," + " `value` VARCHAR(512),"
|
||||||
+ "FOREIGN KEY (plot_id) REFERENCES `" + this.prefix
|
+ "FOREIGN KEY (plot_id) REFERENCES `" + this.prefix
|
||||||
+ "plot` (id) ON DELETE CASCADE, " + "UNIQUE (plot_id, flag))");
|
+ "plot` (id) ON DELETE CASCADE, " + "UNIQUE (plot_id, flag))");
|
||||||
}
|
}
|
||||||
|
@ -75,6 +75,8 @@ public abstract class PlotFlag<T, F extends PlotFlag<T, F>> {
|
|||||||
flagName.append(chars[i]);
|
flagName.append(chars[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Preconditions.checkState(flagName.length() <= 64,
|
||||||
|
"flag name may not be more than 64 characters. Check: " + flagName.toString());
|
||||||
this.flagName = flagName.toString();
|
this.flagName = flagName.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user