Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
efd35e89f1 | ||
|
|
e79a3af870 | ||
|
|
8d6457b91c | ||
|
|
70b941239a | ||
|
|
800f72512d | ||
|
|
e9ce418772 | ||
|
|
effd79984f | ||
|
|
55fea8a20b | ||
|
|
19c6baf927 | ||
|
|
4130a767dc |
@@ -0,0 +1,93 @@
|
||||
%PDF-1.4
|
||||
%“Œ‹ž ReportLab Generated PDF document (opensource)
|
||||
1 0 obj
|
||||
<<
|
||||
/F1 2 0 R /F2 3 0 R
|
||||
>>
|
||||
endobj
|
||||
2 0 obj
|
||||
<<
|
||||
/BaseFont /Helvetica /Encoding /WinAnsiEncoding /Name /F1 /Subtype /Type1 /Type /Font
|
||||
>>
|
||||
endobj
|
||||
3 0 obj
|
||||
<<
|
||||
/BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding /Name /F2 /Subtype /Type1 /Type /Font
|
||||
>>
|
||||
endobj
|
||||
4 0 obj
|
||||
<<
|
||||
/Contents 9 0 R /MediaBox [ 0 0 612 792 ] /Parent 8 0 R /Resources <<
|
||||
/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ]
|
||||
>> /Rotate 0 /Trans <<
|
||||
|
||||
>>
|
||||
/Type /Page
|
||||
>>
|
||||
endobj
|
||||
5 0 obj
|
||||
<<
|
||||
/Contents 10 0 R /MediaBox [ 0 0 612 792 ] /Parent 8 0 R /Resources <<
|
||||
/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ]
|
||||
>> /Rotate 0 /Trans <<
|
||||
|
||||
>>
|
||||
/Type /Page
|
||||
>>
|
||||
endobj
|
||||
6 0 obj
|
||||
<<
|
||||
/PageMode /UseNone /Pages 8 0 R /Type /Catalog
|
||||
>>
|
||||
endobj
|
||||
7 0 obj
|
||||
<<
|
||||
/Author (\(anonymous\)) /CreationDate (D:20261002192444-05'00') /Creator (\(unspecified\)) /Keywords () /ModDate (D:20261002192444-05'00') /Producer (ReportLab PDF Library - \(opensource\))
|
||||
/Subject (\(unspecified\)) /Title (\(anonymous\)) /Trapped /False
|
||||
>>
|
||||
endobj
|
||||
8 0 obj
|
||||
<<
|
||||
/Count 2 /Kids [ 4 0 R 5 0 R ] /Type /Pages
|
||||
>>
|
||||
endobj
|
||||
9 0 obj
|
||||
<<
|
||||
/Filter [ /ASCII85Decode /FlateDecode ] /Length 941
|
||||
>>
|
||||
stream
|
||||
GatUr>Aoub'S,*</'_X..>3Tc8b\HlXgC`s?!-jL(Y>1->Hk)D''8#s-F]g]87dYk"`lBT3Tm^l!8i6Wp6SbZmo,V/"V??KXrni.Jb0?*VACm%_*0WB_)-/JG0FmF<.87/$][#s;b/E#9aJSZ9bW8!Os#RoH'6hOBa1>.18?;%&=,F[e8QkpCIn\g0-PaqoErUce;Ja\%pp`nj8sgNOibjW9mK;P96:guFagtKR<p39G*c=nDt\7t*J][PodK(NAs\IYM;Qm[9kJLaraG.8bdXg>$BAg<#u>Y;4_##8/)UJT;t+&]+cfCjE7T^a9](jOG]:\rKJ/Lr)-hepCk<k?F;+KFKZrZ%J'nOM#AlSq]q%(Rr_R-&f1JqA>kd&:Sp,<;SdjoS(qsK+f*K$hV)"^'D0:QL>TZG2ZIQ0Rh_k7_4md"VY*Udb?$t+?#i?iLrXF',n>!4#L$@cXVd3P\%'*T<;MK.h#].""@#s946\VD!)/,TLC)Vf;(G4pX57RqN5DGeQAt]\7N0^;`bI,`BjMR==YA%]dfoHkkC@2VZ4S%DdDW.Ic,"E)8RUNtlI[B,+5"P8#>r/FYU:)VO^hde>Q'0[sJ[RuDo(6pa=dRnh)'nr_U?i0E$+Y<u4^<:nRO'U[Y2.Kn>K7:"DemIP2TuX&;GXpS-h.30M$GJE_aP%o;J;Z\DXZ#em3JK#E"WTmr#QS[D*aiJ8G-f2b+?u\P>uHk*dPlP[[/<*ZC1muX<,9]cusD]gP"?[@njM7"t6ROh$,9;NI--J!X5-tqh&.gV^695^F?+4h"hM]7PG'9?"JP%W9nb]C5l@<<Aa/"4mIMS$:lOF>1gGfa2a]f(dkE,9j)@Nho$FudAM2H7aq:=2iLJiT'<DT`dXJ-VEiKd^I&X/o/s"n!*seRm$Sj*p%1iuD,eF,NS<^#9"YrX/q*nj7&ds~>endstream
|
||||
endobj
|
||||
10 0 obj
|
||||
<<
|
||||
/Filter [ /ASCII85Decode /FlateDecode ] /Length 702
|
||||
>>
|
||||
stream
|
||||
Gau1+?#Q2d'Sc)J/']H/)@mMQOmZs]W>939[`,dEWZ5s`Ohha%FoD%j+$j+B;$C[>KYZMe*rC@m0\C^0p)<)oCC2.*0jk7M&MQKRkZ8&Sm!4?_0Dtm`Q(pRpF*9WHV),dn&!cdU>ZYnF#>GrRBklQ@=qP,VV$U8Y/?P;^A-(SU;S4Je!Qecp$N>_oM;T+0ZX4-Xh^gDaT*%4Yr;_bjCM9ReHMktJPD8DjX>`c;FL6A?G.Zq'etON%q*8*VPXd0UI&TE&Gg2p_]WCS*F@ID)1BA).3tOmNPF$m?*4!5AQ$TA"1,*io]\>M$i3AI@IGYfNQ(kTY(fFM^d0!=;lC1SE0TL"%Z%FJZ<":=98NMf);(G\GE=1GT:q/%QFp\Jj^.e1M+m8,9'<&7E@-UY[EE1f0A5LmM@*kr(jlIVj(_0FNc3i3XoP+:">PLTFgG#q9npllbY3mD_'Z?Dch=!95d<lYY1Ki=P-Wmk,C`KeuDuqCA);SRn0`(@BWX"s)_PLin+'3T!ZF>`>ft1=ni[(XMZ;VYhkCl5[=,i=<Pk$T8n6K]+qH9J")BJM)aD-biRRcts1q;2*#(&ZTH@>fT10L$n6\5X/+bS:5R;'3WeHr@KG?$k>6B&sQpniu]Dc0%ciNIf$Km\`YBT>un[[@\0h)p\6\>CA[1?jkW#hhdh+AjmFAUJ6,hM!,$,[g<N<3-Q'~>endstream
|
||||
endobj
|
||||
xref
|
||||
0 11
|
||||
0000000000 65535 f
|
||||
0000000061 00000 n
|
||||
0000000102 00000 n
|
||||
0000000209 00000 n
|
||||
0000000321 00000 n
|
||||
0000000514 00000 n
|
||||
0000000708 00000 n
|
||||
0000000776 00000 n
|
||||
0000001056 00000 n
|
||||
0000001121 00000 n
|
||||
0000002152 00000 n
|
||||
trailer
|
||||
<<
|
||||
/ID
|
||||
[<823ed1f68bcfbaecab7b5c501b924b32><823ed1f68bcfbaecab7b5c501b924b32>]
|
||||
% ReportLab generated PDF document -- digest (opensource)
|
||||
|
||||
/Info 7 0 R
|
||||
/Root 6 0 R
|
||||
/Size 11
|
||||
>>
|
||||
startxref
|
||||
2945
|
||||
%%EOF
|
||||
@@ -0,0 +1,86 @@
|
||||
# JodaTime to java.time.* Migration Plan: dbWarehouseHandler.java
|
||||
|
||||
## Overview
|
||||
This document outlines the migration of JodaTime references in `dbWarehouseHandler.java` from `org.joda.time.DateTime` to `java.time.Instant`.
|
||||
|
||||
## Files to be Modified
|
||||
- `src/engine/db/handlers/dbWarehouseHandler.java`
|
||||
|
||||
## JodaTime References Found
|
||||
1. Import statement: `import org.joda.time.DateTime;`
|
||||
2. Method parameter: `DateTime upgradeDate` in method signature (line 58)
|
||||
3. Method parameter: `DateTime date` in method signature (line 490)
|
||||
4. Usage of getMillis() method: `upgradeDate.getMillis()` (line 79)
|
||||
5. Usage of getMillis() method: `date.getMillis()` (line 501)
|
||||
|
||||
## Migration Strategy
|
||||
|
||||
### Step 1: Update Import Statement
|
||||
Replace:
|
||||
```java
|
||||
import org.joda.time.DateTime;
|
||||
```
|
||||
With:
|
||||
```java
|
||||
import java.time.Instant;
|
||||
```
|
||||
|
||||
### Step 2: Update Method Signatures
|
||||
Replace:
|
||||
```java
|
||||
DateTime upgradeDate
|
||||
```
|
||||
With:
|
||||
```java
|
||||
Instant upgradeDate
|
||||
```
|
||||
|
||||
Replace:
|
||||
```java
|
||||
DateTime date
|
||||
```
|
||||
With:
|
||||
```java
|
||||
Instant date
|
||||
```
|
||||
|
||||
### Step 3: Update Method Calls
|
||||
Replace:
|
||||
```java
|
||||
upgradeDate.getMillis()
|
||||
```
|
||||
With:
|
||||
```java
|
||||
upgradeDate.toEpochMilli()
|
||||
```
|
||||
|
||||
Replace:
|
||||
```java
|
||||
date.getMillis()
|
||||
```
|
||||
With:
|
||||
```java
|
||||
date.toEpochMilli()
|
||||
```
|
||||
|
||||
### Step 4: Database Timestamp Handling
|
||||
The database timestamp handling remains the same as `java.sql.Timestamp` constructor accepts long values (milliseconds since epoch), which can be obtained from `Instant.toEpochMilli()`.
|
||||
|
||||
## Implementation Plan
|
||||
|
||||
1. Update import statement from `org.joda.time.DateTime` to `java.time.Instant`
|
||||
2. Update method signature for `upgradeDate` parameter from `DateTime` to `Instant`
|
||||
3. Update method signature for `date` parameter from `DateTime` to `Instant`
|
||||
4. Replace `upgradeDate.getMillis()` with `upgradeDate.toEpochMilli()`
|
||||
5. Replace `date.getMillis()` with `date.toEpochMilli()`
|
||||
|
||||
## Testing Considerations
|
||||
- Ensure the network packet serialization format remains unchanged
|
||||
- Verify database operations work correctly with Instant values
|
||||
- Test warehouse creation and transaction creation functionality
|
||||
- Confirm that all existing functionality continues to work as expected
|
||||
|
||||
## Compatibility Notes
|
||||
- The migration maintains backward compatibility with database operations since `java.sql.Timestamp` constructor accepts milliseconds
|
||||
- Network packet structure remains the same (no serialization changes needed)
|
||||
- Thread safety improvements from using java.time.* classes
|
||||
@@ -0,0 +1,67 @@
|
||||
# JodaTime to java.time.* Migration Tracking
|
||||
|
||||
## Overview
|
||||
This file tracks the remaining JodaTime references that need to be migrated to java.time.* in the Magicbane Server codebase.
|
||||
|
||||
## Current Status (as of 2026-10-02)
|
||||
Branch: ai-refactor-jodatimeFull
|
||||
|
||||
## Files with JodaTime References (Total: 30 files)
|
||||
|
||||
### Files Already Migrated or Partially Migrated
|
||||
1. ArcMineWindowAvailableTimeMsg.java - ✅ COMPLETE (already using java.time.*)
|
||||
|
||||
### Files to be Migrated
|
||||
1. BaneRecord.java - ✅ COMPLETE
|
||||
2. dbBaneHandler.java - ✅ COMPLETE
|
||||
3. dbBuildingHandler.java - ✅ COMPLETE
|
||||
4. dbGuildHandler.java - ✅ COMPLETE
|
||||
5. dbMobHandler.java - ✅ COMPLETE
|
||||
6. dbNPCHandler.java - ✅ COMPLETE
|
||||
7. dbShrineHandler.java - ✅ COMPLETE
|
||||
8. dbWarehouseHandler.java - ✅ COMPLETE (2026-10-02)
|
||||
9. GuildManager.java - ✅ COMPLETE (2026-10-02)
|
||||
10. BaneDefaultTimeJob.java - [ ]
|
||||
11. ByteBufferWriter.java - [ ]
|
||||
12. AcceptInviteToGuildHandler.java - [ ]
|
||||
13. BanishUnbanishHandler.java - [ ]
|
||||
14. ManageCityAssetMsgHandler.java - [ ]
|
||||
15. PlaceAssetMsgHandler.java - [ ]
|
||||
16. GuildInfoMsg.java - [ ]
|
||||
17. ManageCityAssetsMsg.java - [ ]
|
||||
18. ManageNPCMsg.java - [ ]
|
||||
19. NetMsgFactory.java - [ ]
|
||||
20. Bane.java - [ ]
|
||||
21. Guild.java - [ ]
|
||||
22. GuildHistory.java - [ ]
|
||||
23. ItemFactory.java - [ ]
|
||||
24. Mob.java - [ ]
|
||||
25. NPC.java - [ ]
|
||||
26. PlayerCharacter.java - [ ]
|
||||
27. ProducedItem.java - [ ]
|
||||
28. Transaction.java - [ ]
|
||||
29. Warehouse.java - [ ]
|
||||
|
||||
## Migration Strategy
|
||||
1. Analyze each file to understand JodaTime usage patterns
|
||||
2. Replace imports with java.time equivalents
|
||||
3. Update variable declarations and method calls
|
||||
4. Ensure network packet compatibility is maintained
|
||||
5. Test functionality after each change
|
||||
|
||||
## Progress Tracking Template
|
||||
For each file, mark as complete when migration is finished:
|
||||
- [x] File name - Status: COMPLETED (Date: YYYY-MM-DD)
|
||||
- [ ] File name - Status: PENDING
|
||||
|
||||
## Migration Notes
|
||||
- Focus on minimal changes to maintain compatibility
|
||||
- Preserve existing network packet serialization format
|
||||
- Use java.time classes for better performance and thread safety
|
||||
- Test each migration in a controlled environment
|
||||
|
||||
## Next Steps
|
||||
1. Start with files that have minimal dependencies (like ArcMineWindowAvailableTimeMsg)
|
||||
2. Proceed systematically through the list
|
||||
3. Create detailed migration plans for complex files
|
||||
4. Test changes in-game after each migration
|
||||
@@ -14,7 +14,7 @@ import engine.gameManager.DbManager;
|
||||
import engine.objects.Bane;
|
||||
import engine.objects.City;
|
||||
import engine.workthreads.WarehousePushThread;
|
||||
import org.joda.time.DateTime;
|
||||
import java.time.Instant;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.*;
|
||||
@@ -34,8 +34,8 @@ public class BaneRecord extends DataRecord {
|
||||
private String baneDropperHash;
|
||||
private String baneGuildHash;
|
||||
private String baneNationHash;
|
||||
private DateTime baneLiveTime;
|
||||
private DateTime baneDropTime;
|
||||
private Instant baneLiveTime;
|
||||
private Instant baneDropTime;
|
||||
|
||||
private BaneRecord(Bane bane) {
|
||||
this.recordType = Enum.DataRecordType.BANE;
|
||||
@@ -129,9 +129,9 @@ public class BaneRecord extends DataRecord {
|
||||
return outStatement;
|
||||
}
|
||||
|
||||
public static DateTime getLastBaneDateTime(City city) {
|
||||
public static Instant getLastBaneDateTime(City city) {
|
||||
|
||||
DateTime outDateTime = null;
|
||||
Instant outDateTime = null;
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement statement = buildDateTimeQueryStatement(connection, city);
|
||||
@@ -139,7 +139,7 @@ public class BaneRecord extends DataRecord {
|
||||
|
||||
while (rs.next()) {
|
||||
|
||||
outDateTime = new DateTime(rs.getTimestamp("endDatetime"));
|
||||
outDateTime = rs.getTimestamp("endDatetime").toInstant();
|
||||
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ public class BaneRecord extends DataRecord {
|
||||
|
||||
}
|
||||
|
||||
public static void updateLiveDate(Bane bane, DateTime dateTime) {
|
||||
public static void updateLiveDate(Bane bane, Instant dateTime) {
|
||||
|
||||
if (bane == null)
|
||||
return;
|
||||
@@ -175,13 +175,13 @@ public class BaneRecord extends DataRecord {
|
||||
}
|
||||
}
|
||||
|
||||
private static PreparedStatement buildUpdateLiveDateStatement(Connection connection, Bane bane, DateTime dateTime) throws SQLException {
|
||||
private static PreparedStatement buildUpdateLiveDateStatement(Connection connection, Bane bane, Instant dateTime) throws SQLException {
|
||||
|
||||
PreparedStatement outStatement = null;
|
||||
String queryString = "UPDATE `warehouse_banehistory` SET `liveDatetime` = ?, `dirty` = 1 WHERE `city_id` = ? AND `resolution` = 'PENDING'";
|
||||
|
||||
outStatement = connection.prepareStatement(queryString);
|
||||
outStatement.setTimestamp(1, new java.sql.Timestamp(dateTime.getMillis()));
|
||||
outStatement.setTimestamp(1, new java.sql.Timestamp(dateTime.toEpochMilli()));
|
||||
outStatement.setString(2, bane.getCity().getHash());
|
||||
|
||||
return outStatement;
|
||||
|
||||
@@ -14,7 +14,7 @@ import engine.objects.Bane;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.City;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import org.joda.time.DateTime;
|
||||
import java.time.Instant;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.Connection;
|
||||
@@ -71,12 +71,12 @@ public class dbBaneHandler extends dbHandlerBase {
|
||||
}
|
||||
|
||||
|
||||
public boolean SET_BANE_TIME(DateTime toSet, int cityUUID) {
|
||||
public boolean SET_BANE_TIME(Instant toSet, int cityUUID) {
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `dyn_banes` SET `liveDate`=? WHERE `cityUUID`=?")) {
|
||||
|
||||
preparedStatement.setTimestamp(1, new java.sql.Timestamp(toSet.getMillis()));
|
||||
preparedStatement.setTimestamp(1, java.sql.Timestamp.from(toSet));
|
||||
preparedStatement.setLong(2, cityUUID);
|
||||
|
||||
preparedStatement.execute();
|
||||
|
||||
@@ -16,7 +16,9 @@ import engine.Enum.TaxType;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.*;
|
||||
import org.joda.time.DateTime;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.Connection;
|
||||
@@ -38,7 +40,7 @@ public class dbBuildingHandler extends dbHandlerBase {
|
||||
public Building CREATE_BUILDING(int parentZoneID, int OwnerUUID, String name, int meshUUID,
|
||||
Vector3fImmutable location, float meshScale, int currentHP,
|
||||
ProtectionState protectionState, int currentGold, int rank,
|
||||
DateTime upgradeDate, int blueprintUUID, float w, float rotY) {
|
||||
Instant upgradeDate, int blueprintUUID, float w, float rotY) {
|
||||
|
||||
Building building = null;
|
||||
|
||||
@@ -59,7 +61,7 @@ public class dbBuildingHandler extends dbHandlerBase {
|
||||
preparedStatement.setInt(12, rank);
|
||||
|
||||
if (upgradeDate != null)
|
||||
preparedStatement.setTimestamp(13, new java.sql.Timestamp(upgradeDate.getMillis()));
|
||||
preparedStatement.setTimestamp(13, new java.sql.Timestamp(upgradeDate.toEpochMilli()));
|
||||
else
|
||||
preparedStatement.setNull(13, java.sql.Types.DATE);
|
||||
|
||||
@@ -752,7 +754,7 @@ public class dbBuildingHandler extends dbHandlerBase {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean updateBuildingUpgradeTime(LocalDateTime upgradeDateTime, Building toUpgrade, int costToUpgrade) {
|
||||
public boolean updateBuildingUpgradeTime(Instant upgradeDateTime, Building toUpgrade, int costToUpgrade) {
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE obj_building SET upgradeDate=?, currentGold=? "
|
||||
@@ -761,8 +763,7 @@ public class dbBuildingHandler extends dbHandlerBase {
|
||||
if (upgradeDateTime == null)
|
||||
preparedStatement.setNull(1, java.sql.Types.DATE);
|
||||
else
|
||||
preparedStatement.setTimestamp(1, new java.sql.Timestamp(upgradeDateTime.atZone(ZoneId.systemDefault())
|
||||
.toInstant().toEpochMilli()));
|
||||
preparedStatement.setTimestamp(1, new java.sql.Timestamp(upgradeDateTime.toEpochMilli()));
|
||||
|
||||
preparedStatement.setInt(2, toUpgrade.getStrongboxValue() - costToUpgrade);
|
||||
preparedStatement.setInt(3, toUpgrade.getObjectUUID());
|
||||
@@ -841,7 +842,7 @@ public class dbBuildingHandler extends dbHandlerBase {
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE obj_building SET taxDate=? "
|
||||
+ "WHERE UID = ?")) {
|
||||
|
||||
preparedStatement.setTimestamp(1, new java.sql.Timestamp(DateTime.now().plusDays(7).getMillis()));
|
||||
preparedStatement.setTimestamp(1, new java.sql.Timestamp(Instant.now().plus(java.time.temporal.ChronoUnit.DAYS, 7).toEpochMilli()));
|
||||
preparedStatement.setInt(2, building.getObjectUUID());
|
||||
|
||||
return (preparedStatement.executeUpdate() > 0);
|
||||
|
||||
@@ -14,7 +14,7 @@ import engine.Enum.GuildHistoryType;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.objects.*;
|
||||
import engine.server.world.WorldServer;
|
||||
import org.joda.time.DateTime;
|
||||
import java.time.Instant;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.*;
|
||||
@@ -125,7 +125,7 @@ public class dbGuildHandler extends dbHandlerBase {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean ADD_TO_GUILDHISTORY(int target, PlayerCharacter playerCharacter, DateTime historyDate, GuildHistoryType historyType) {
|
||||
public boolean ADD_TO_GUILDHISTORY(int target, PlayerCharacter playerCharacter, Instant historyDate, GuildHistoryType historyType) {
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_character_guildhistory` (`GuildID`, `CharacterID`, `historyDate`, `historyType`) VALUES (?,?,?,?)")) {
|
||||
@@ -136,7 +136,7 @@ public class dbGuildHandler extends dbHandlerBase {
|
||||
if (historyDate == null)
|
||||
preparedStatement.setNull(3, java.sql.Types.DATE);
|
||||
else
|
||||
preparedStatement.setTimestamp(3, new Timestamp(historyDate.getMillis()));
|
||||
preparedStatement.setTimestamp(3, java.sql.Timestamp.from(historyDate));
|
||||
|
||||
preparedStatement.setString(4, historyType.name());
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ package engine.db.handlers;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.objects.Mob;
|
||||
import engine.objects.Zone;
|
||||
import org.joda.time.DateTime;
|
||||
import java.time.Instant;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.Connection;
|
||||
@@ -69,7 +69,7 @@ public class dbMobHandler extends dbHandlerBase {
|
||||
return mobile;
|
||||
}
|
||||
|
||||
public boolean updateUpgradeTime(Mob mob, DateTime upgradeDateTime) {
|
||||
public boolean updateUpgradeTime(Mob mob, Instant upgradeDateTime) {
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE obj_mob SET upgradeDate=? "
|
||||
@@ -78,7 +78,7 @@ public class dbMobHandler extends dbHandlerBase {
|
||||
if (upgradeDateTime == null)
|
||||
preparedStatement.setNull(1, java.sql.Types.DATE);
|
||||
else
|
||||
preparedStatement.setTimestamp(1, new java.sql.Timestamp(upgradeDateTime.getMillis()));
|
||||
preparedStatement.setTimestamp(1, java.sql.Timestamp.from(upgradeDateTime));
|
||||
|
||||
preparedStatement.setInt(2, mob.getObjectUUID());
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import engine.objects.NPC;
|
||||
import engine.objects.NPCProfits;
|
||||
import engine.objects.ProducedItem;
|
||||
import engine.objects.Zone;
|
||||
import org.joda.time.DateTime;
|
||||
import java.time.Instant;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.Connection;
|
||||
@@ -203,7 +203,7 @@ public class dbNPCHandler extends dbHandlerBase {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean updateUpgradeTime(NPC npc, DateTime upgradeDateTime) {
|
||||
public boolean updateUpgradeTime(NPC npc, Instant upgradeDateTime) {
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE obj_npc SET upgradeDate=? "
|
||||
@@ -212,7 +212,7 @@ public class dbNPCHandler extends dbHandlerBase {
|
||||
if (upgradeDateTime == null)
|
||||
preparedStatement.setNull(1, java.sql.Types.DATE);
|
||||
else
|
||||
preparedStatement.setTimestamp(1, new java.sql.Timestamp(upgradeDateTime.getMillis()));
|
||||
preparedStatement.setTimestamp(1, java.sql.Timestamp.from(upgradeDateTime));
|
||||
|
||||
preparedStatement.setInt(2, npc.getObjectUUID());
|
||||
|
||||
@@ -308,7 +308,7 @@ public class dbNPCHandler extends dbHandlerBase {
|
||||
+ NPC._pirateNames.size() + " mobBases");
|
||||
}
|
||||
|
||||
public boolean ADD_TO_PRODUCTION_LIST(final long ID, final long npcUID, final long itemBaseID, DateTime dateTime, String prefix, String suffix, String name, boolean isRandom, int playerID) {
|
||||
public boolean ADD_TO_PRODUCTION_LIST(final long ID, final long npcUID, final long itemBaseID, Instant dateTime, String prefix, String suffix, String name, boolean isRandom, int playerID) {
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_npc_production` (`ID`,`npcUID`, `itemBaseID`,`dateToUpgrade`, `isRandom`, `prefix`, `suffix`, `name`,`playerID`) VALUES (?,?,?,?,?,?,?,?,?)")) {
|
||||
@@ -316,7 +316,7 @@ public class dbNPCHandler extends dbHandlerBase {
|
||||
preparedStatement.setLong(1, ID);
|
||||
preparedStatement.setLong(2, npcUID);
|
||||
preparedStatement.setLong(3, itemBaseID);
|
||||
preparedStatement.setTimestamp(4, new java.sql.Timestamp(dateTime.getMillis()));
|
||||
preparedStatement.setTimestamp(4, java.sql.Timestamp.from(dateTime));
|
||||
preparedStatement.setBoolean(5, isRandom);
|
||||
preparedStatement.setString(6, prefix);
|
||||
preparedStatement.setString(7, suffix);
|
||||
|
||||
@@ -15,7 +15,7 @@ import engine.math.Vector3fImmutable;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.Shrine;
|
||||
import org.joda.time.DateTime;
|
||||
import java.time.Instant;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.Connection;
|
||||
@@ -52,7 +52,7 @@ public class dbShrineHandler extends dbHandlerBase {
|
||||
public ArrayList<AbstractGameObject> CREATE_SHRINE(int parentZoneID, int OwnerUUID, String name, int meshUUID,
|
||||
Vector3fImmutable location, float meshScale, int currentHP,
|
||||
ProtectionState protectionState, int currentGold, int rank,
|
||||
DateTime upgradeDate, int blueprintUUID, float w, float rotY, String shrineType) {
|
||||
Instant upgradeDate, int blueprintUUID, float w, float rotY, String shrineType) {
|
||||
|
||||
ArrayList<AbstractGameObject> shrineList = new ArrayList<>();
|
||||
|
||||
@@ -73,7 +73,7 @@ public class dbShrineHandler extends dbHandlerBase {
|
||||
preparedStatement.setInt(12, rank);
|
||||
|
||||
if (upgradeDate != null)
|
||||
preparedStatement.setTimestamp(13, new java.sql.Timestamp(upgradeDate.getMillis()));
|
||||
preparedStatement.setTimestamp(13, java.sql.Timestamp.from(upgradeDate));
|
||||
else
|
||||
preparedStatement.setNull(13, java.sql.Types.DATE);
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import engine.gameManager.DbManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.*;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.joda.time.DateTime;
|
||||
import java.time.Instant;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.Connection;
|
||||
@@ -55,7 +55,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
public ArrayList<AbstractGameObject> CREATE_WAREHOUSE(int parentZoneID, int OwnerUUID, String name, int meshUUID,
|
||||
Vector3fImmutable location, float meshScale, int currentHP,
|
||||
ProtectionState protectionState, int currentGold, int rank,
|
||||
DateTime upgradeDate, int blueprintUUID, float w, float rotY) {
|
||||
Instant upgradeDate, int blueprintUUID, float w, float rotY) {
|
||||
|
||||
ArrayList<AbstractGameObject> warehouseList = new ArrayList<>();
|
||||
|
||||
@@ -76,7 +76,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
preparedStatement.setInt(12, rank);
|
||||
|
||||
if (upgradeDate != null)
|
||||
preparedStatement.setTimestamp(13, new java.sql.Timestamp(upgradeDate.getMillis()));
|
||||
preparedStatement.setTimestamp(13, new java.sql.Timestamp(upgradeDate.toEpochMilli()));
|
||||
else
|
||||
preparedStatement.setNull(13, java.sql.Types.DATE);
|
||||
|
||||
@@ -487,7 +487,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean CREATE_TRANSACTION(int warehouseBuildingID, GameObjectType targetType, int targetUUID, TransactionType transactionType, Resource resource, int amount, DateTime date) {
|
||||
public boolean CREATE_TRANSACTION(int warehouseBuildingID, GameObjectType targetType, int targetUUID, TransactionType transactionType, Resource resource, int amount, Instant date) {
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_warehouse_transactions` (`warehouseUID`, `targetType`,`targetUID`, `type`,`resource`,`amount`,`date` ) VALUES (?,?,?,?,?,?,?)")) {
|
||||
@@ -498,7 +498,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
preparedStatement.setString(4, transactionType.name());
|
||||
preparedStatement.setString(5, resource.name());
|
||||
preparedStatement.setInt(6, amount);
|
||||
preparedStatement.setTimestamp(7, new java.sql.Timestamp(date.getMillis()));
|
||||
preparedStatement.setTimestamp(7, new java.sql.Timestamp(date.toEpochMilli()));
|
||||
|
||||
return (preparedStatement.executeUpdate() > 0);
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.guild.AcceptInviteToGuildMsg;
|
||||
import engine.net.client.msg.guild.GuildInfoMsg;
|
||||
import engine.objects.*;
|
||||
import org.joda.time.DateTime;
|
||||
import java.time.Instant;
|
||||
|
||||
public enum GuildManager {
|
||||
|
||||
@@ -68,8 +68,8 @@ public enum GuildManager {
|
||||
return false;
|
||||
|
||||
if (playerCharacter.getGuild() != null && !playerCharacter.getGuild().isEmptyGuild()) {
|
||||
if (DbManager.GuildQueries.ADD_TO_GUILDHISTORY(playerCharacter.getGuildUUID(), playerCharacter, DateTime.now(), GuildHistoryType.LEAVE)) {
|
||||
GuildHistory guildHistory = new GuildHistory(playerCharacter.getGuildUUID(), playerCharacter.getGuild().getName(), DateTime.now(), GuildHistoryType.LEAVE);
|
||||
if (DbManager.GuildQueries.ADD_TO_GUILDHISTORY(playerCharacter.getGuildUUID(), playerCharacter, Instant.now(), GuildHistoryType.LEAVE)) {
|
||||
GuildHistory guildHistory = new GuildHistory(playerCharacter.getGuildUUID(), playerCharacter.getGuild().getName(), Instant.now(), GuildHistoryType.LEAVE);
|
||||
playerCharacter.getGuildHistory().add(guildHistory);
|
||||
}
|
||||
}
|
||||
@@ -91,8 +91,8 @@ public enum GuildManager {
|
||||
dispatch = Dispatch.borrow(playerCharacter, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
||||
}
|
||||
if (DbManager.GuildQueries.ADD_TO_GUILDHISTORY(guild.getObjectUUID(), playerCharacter, DateTime.now(), historyType)) {
|
||||
GuildHistory guildHistory = new GuildHistory(guild.getObjectUUID(), guild.getName(), DateTime.now(), historyType);
|
||||
if (DbManager.GuildQueries.ADD_TO_GUILDHISTORY(guild.getObjectUUID(), playerCharacter, Instant.now(), historyType)) {
|
||||
GuildHistory guildHistory = new GuildHistory(guild.getObjectUUID(), guild.getName(), Instant.now(), historyType);
|
||||
playerCharacter.getGuildHistory().add(guildHistory);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,8 +18,9 @@ import engine.net.client.Protocol;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.Guild;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.Seconds;
|
||||
import java.time.Instant;
|
||||
import java.time.Duration;
|
||||
import java.time.temporal.ChronoField;
|
||||
|
||||
public class ArcMineWindowAvailableTimeMsg extends ClientNetMsg {
|
||||
|
||||
@@ -27,8 +28,8 @@ public class ArcMineWindowAvailableTimeMsg extends ClientNetMsg {
|
||||
private Building treeOfLife;
|
||||
|
||||
private int currentMineHour;
|
||||
private Seconds secondsLeft;
|
||||
private DateTime lateTime;
|
||||
private Duration secondsLeft;
|
||||
private Instant lateTime;
|
||||
private int late;
|
||||
|
||||
/**
|
||||
@@ -73,15 +74,15 @@ public class ArcMineWindowAvailableTimeMsg extends ClientNetMsg {
|
||||
currentMineHour = guild.getMineTime();
|
||||
|
||||
late = MBServerStatics.MINE_LATE_WINDOW;
|
||||
lateTime = DateTime.now();
|
||||
lateTime = Instant.now();
|
||||
|
||||
if (late == 0)
|
||||
lateTime = lateTime.plusDays(1);
|
||||
lateTime = lateTime.plus(Duration.ofDays(1));
|
||||
|
||||
lateTime = lateTime.hourOfDay().setCopy(late);
|
||||
lateTime = lateTime.with(ChronoField.HOUR_OF_DAY, late);
|
||||
|
||||
late = ((late > 23) ? (late - 24) : late);
|
||||
secondsLeft = Seconds.secondsBetween(DateTime.now(), lateTime);
|
||||
secondsLeft = Duration.between(Instant.now(), lateTime);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -107,4 +108,4 @@ public class ArcMineWindowAvailableTimeMsg extends ClientNetMsg {
|
||||
public void setBuildingUUID(int buildingUUID) {
|
||||
this.buildingUUID = buildingUUID;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user