@@ -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
@@ -126,14 +133,15 @@ public Nation(final @NotNull ResultSet rs) throws @NotNull SQLException {
126133 UUID .fromString (rs .getString ("leader" )),
127134 UUID .fromString (rs .getString ("vice" )),
128135 rs .getTimestamp ("founded" ),
136+ rs .getLong ("founded_ticks" ),
129137 rs .getString ("bank" )
130138 );
131139 }
132140
133141 public void save () {
134142 try (
135143 final @ NotNull Connection conn = SMPCore .getInstance ().db ()
136- .getConnection (); final @ NotNull PreparedStatement stmt = conn .prepareStatement ("INSERT OR REPLACE INTO `nations` (`id`, `name`, `short_name`, `color`, `leader`, `vice`, `founded`, `bank`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)" )
144+ .getConnection (); final @ NotNull PreparedStatement stmt = conn .prepareStatement ("INSERT OR REPLACE INTO `nations` (`id`, `name`, `short_name`, `color`, `leader`, `vice`, `founded`, `founded_ticks`, ` bank`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)" )
137145 ) {
138146 stmt .setString (1 , id );
139147 stmt .setString (2 , name );
@@ -142,7 +150,8 @@ public void save() {
142150 stmt .setString (5 , leaderUUID .toString ());
143151 stmt .setString (6 , viceLeaderUUID .toString ());
144152 stmt .setTimestamp (7 , new java .sql .Timestamp (founded .getTime ()));
145- stmt .setString (8 , bank );
153+ stmt .setLong (8 , foundedTicks );
154+ stmt .setString (9 , bank );
146155 stmt .executeUpdate ();
147156 }
148157 catch (final @ NotNull SQLException e ) {
0 commit comments