@@ -51,19 +51,23 @@ public abstract class SQLStorage implements AuthStorage {
5151 + "`UUID` CHAR(36), "
5252 + "`Name` VARCHAR(16) NOT NULL, "
5353 + "`Premium` BOOLEAN NOT NULL, "
54+ + "`Floodgate` BOOLEAN NOT NULL, "
5455 + "`LastIp` VARCHAR(255) NOT NULL, "
5556 + "`LastLogin` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, "
5657 //the premium shouldn't steal the cracked account by changing the name
5758 + "UNIQUE (`Name`) "
5859 + ')' ;
5960
60- protected static final String LOAD_BY_NAME = "SELECT * FROM `" + PREMIUM_TABLE + "` WHERE `Name`=? LIMIT 1" ;
61- protected static final String LOAD_BY_UUID = "SELECT * FROM `" + PREMIUM_TABLE + "` WHERE `UUID`=? LIMIT 1" ;
61+ protected static final String LOAD_BY_NAME = "SELECT * FROM `" + PREMIUM_TABLE
62+ + "` WHERE `Name`=? LIMIT 1" ;
63+ protected static final String LOAD_BY_UUID = "SELECT * FROM `" + PREMIUM_TABLE
64+ + "` WHERE `UUID`=? LIMIT 1" ;
6265 protected static final String INSERT_PROFILE = "INSERT INTO `" + PREMIUM_TABLE
63- + "` (`UUID`, `Name`, `Premium`, `LastIp`) " + "VALUES (?, ?, ?, ?) " ;
66+ + "` (`UUID`, `Name`, `Premium`, `Floodgate`, ` LastIp`) " + "VALUES (?, ?, ?, ?, ?) " ;
6467 // limit not necessary here, because it's unique
6568 protected static final String UPDATE_PROFILE = "UPDATE `" + PREMIUM_TABLE
66- + "` SET `UUID`=?, `Name`=?, `Premium`=?, `LastIp`=?, `LastLogin`=CURRENT_TIMESTAMP WHERE `UserID`=?" ;
69+ + "` SET `UUID`=?, `Name`=?, `Premium`=?, `Floodgate`=?, `LastIp`=?, "
70+ + "`LastLogin`=CURRENT_TIMESTAMP WHERE `UserID`=?" ;
6771
6872 protected final FastLoginCore <?, ?, ?> core ;
6973 protected final HikariDataSource dataSource ;
@@ -100,7 +104,7 @@ public StoredProfile loadProfile(String name) {
100104 loadStmt .setString (1 , name );
101105
102106 try (ResultSet resultSet = loadStmt .executeQuery ()) {
103- return parseResult (resultSet ).orElseGet (() -> new StoredProfile (null , name , false , "" ));
107+ return parseResult (resultSet ).orElseGet (() -> new StoredProfile (null , name , false , false , "" ));
104108 }
105109 } catch (SQLException sqlEx ) {
106110 core .getPlugin ().getLog ().error ("Failed to query profile: {}" , name , sqlEx );
@@ -127,14 +131,14 @@ public StoredProfile loadProfile(UUID uuid) {
127131
128132 private Optional <StoredProfile > parseResult (ResultSet resultSet ) throws SQLException {
129133 if (resultSet .next ()) {
130- long userId = resultSet .getInt (1 );
134+ long userId = resultSet .getInt ("UserID" );
131135
132- UUID uuid = Optional .ofNullable (resultSet .getString (2 )).map (UUIDAdapter ::parseId ).orElse (null );
136+ UUID uuid = Optional .ofNullable (resultSet .getString ("UUID" )).map (UUIDAdapter ::parseId ).orElse (null );
133137
134- String name = resultSet .getString (3 );
135- boolean premium = resultSet .getBoolean (4 );
136- String lastIp = resultSet .getString (5 );
137- Instant lastLogin = resultSet .getTimestamp (6 ).toInstant ();
138+ String name = resultSet .getString ("Name" );
139+ boolean premium = resultSet .getBoolean ("Premium" );
140+ String lastIp = resultSet .getString ("LastIp" );
141+ Instant lastLogin = resultSet .getTimestamp ("LastLogin" ).toInstant ();
138142 return Optional .of (new StoredProfile (userId , uuid , name , premium , lastIp , lastLogin ));
139143 }
140144
0 commit comments