@@ -58,6 +58,11 @@ public final class Nation {
5858 */
5959 public final @ NotNull Date founded ;
6060
61+ /**
62+ * In-game absolute ticks when this nation was founded (based on {@link org.bukkit.World#getFullTime()})
63+ */
64+ public final long foundedTicks ;
65+
6166 /**
6267 * National bank account of the nation
6368 */
@@ -71,16 +76,18 @@ public final class Nation {
7176 * @param leaderUUID See {@link #leaderUUID}
7277 * @param viceLeaderUUID See {@link #viceLeaderUUID}
7378 * @param founded See {@link #founded}
79+ * @param foundedTicks See {@link #foundedTicks}
7480 * @param bank See {@link #bank}
7581 */
76- public Nation (final @ NotNull String id , final @ NotNull String name , final @ NotNull String shortName , final @ NotNull String colour , final @ NotNull UUID leaderUUID , final @ NotNull UUID viceLeaderUUID , final @ NotNull Date founded , final @ NotNull String bank ) {
82+ public Nation (final @ NotNull String id , final @ NotNull String name , final @ NotNull String shortName , final @ NotNull String colour , final @ NotNull UUID leaderUUID , final @ NotNull UUID viceLeaderUUID , final @ NotNull Date founded , final long foundedTicks , final @ NotNull String bank ) {
7783 this .id = id ;
7884 this .name = name ;
7985 this .shortName = shortName ;
8086 this .color = colour ;
8187 this .leaderUUID = leaderUUID ;
8288 this .viceLeaderUUID = viceLeaderUUID ;
8389 this .founded = founded ;
90+ this .foundedTicks = foundedTicks ;
8491 this .bank = bank ;
8592 }
8693
@@ -132,14 +139,15 @@ public Nation(final @NotNull ResultSet rs) throws @NotNull SQLException {
132139 UUID .fromString (rs .getString ("leader" )),
133140 UUID .fromString (rs .getString ("vice" )),
134141 rs .getTimestamp ("founded" ),
142+ rs .getLong ("founded_ticks" ),
135143 rs .getString ("bank" )
136144 );
137145 }
138146
139147 public void save () {
140148 try (
141149 final @ NotNull Connection conn = SMPCore .getInstance ().db ()
142- .getConnection (); final @ NotNull PreparedStatement stmt = conn .prepareStatement ("INSERT OR REPLACE INTO `nations` (`id`, `name`, `short_name`, `color`, `leader`, `vice`, `founded`, `bank`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)" )
150+ .getConnection (); final @ NotNull PreparedStatement stmt = conn .prepareStatement ("INSERT OR REPLACE INTO `nations` (`id`, `name`, `short_name`, `color`, `leader`, `vice`, `founded`, `founded_ticks`, ` bank`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)" )
143151 ) {
144152 stmt .setString (1 , id );
145153 stmt .setString (2 , name );
@@ -148,7 +156,8 @@ public void save() {
148156 stmt .setString (5 , leaderUUID .toString ());
149157 stmt .setString (6 , viceLeaderUUID .toString ());
150158 stmt .setTimestamp (7 , new java .sql .Timestamp (founded .getTime ()));
151- stmt .setString (8 , bank );
159+ stmt .setLong (8 , foundedTicks );
160+ stmt .setString (9 , bank );
152161 stmt .executeUpdate ();
153162 }
154163 catch (final @ NotNull SQLException e ) {
0 commit comments