Skip to content

Commit 97e2219

Browse files
authored
fix sql error when using JsonGameSerializer (#457)
1 parent 14de276 commit 97e2219

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

src/main/java/io/luna/game/model/World.java

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
import io.luna.game.model.mob.bot.BotManager;
1717
import io.luna.game.model.mob.bot.BotRepository;
1818
import io.luna.game.model.object.GameObjectList;
19-
import io.luna.game.persistence.GameSerializerManager;
20-
import io.luna.game.persistence.PersistenceService;
19+
import io.luna.game.persistence.*;
2120
import io.luna.game.task.Task;
2221
import io.luna.game.task.TaskManager;
2322
import io.luna.net.msg.out.NpcUpdateMessageWriter;
@@ -270,14 +269,18 @@ public World(LunaContext context) {
270269
botManager = new BotManager();
271270

272271
// Initialize the connection pool.
273-
try {
274-
connectionPool = new SqlConnectionPool.Builder()
275-
.poolName("LunaSqlPool")
276-
.database("luna_players")
277-
.build();
278-
} catch (Exception e) {
279-
logger.fatal("Fatal error creating SQL pool!", e);
280-
throw new RuntimeException(e);
272+
if (getSerializerManager().getSerializer() instanceof SqlGameSerializer) {
273+
try {
274+
connectionPool = new SqlConnectionPool.Builder()
275+
.poolName("LunaSqlPool")
276+
.database("luna_players")
277+
.build();
278+
} catch (Exception e) {
279+
logger.fatal("Fatal error creating SQL pool!", e);
280+
throw new RuntimeException(e);
281+
}
282+
} else {
283+
connectionPool = null;
281284
}
282285

283286
// Initialize synchronization thread pool.

0 commit comments

Comments
 (0)