From 4d18e71aa1d321e61e85b36b522ffb25318cbcf3 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Wed, 10 Apr 2024 17:33:59 -0400 Subject: [PATCH] More info on template bootstrap --- src/engine/db/handlers/dbItemHandler.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/engine/db/handlers/dbItemHandler.java b/src/engine/db/handlers/dbItemHandler.java index 040441e0..73162f9e 100644 --- a/src/engine/db/handlers/dbItemHandler.java +++ b/src/engine/db/handlers/dbItemHandler.java @@ -26,6 +26,7 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; +import java.util.HashMap; import java.util.HashSet; @@ -181,6 +182,8 @@ public class dbItemHandler extends dbHandlerBase { JSONParser jsonParser = new JSONParser(); + HashMap templateTCountMap = new HashMap<>(); + try (Connection connection = DbManager.getConnection(); PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_item_templates`;"); ResultSet rs = preparedStatement.executeQuery()) { @@ -191,8 +194,14 @@ public class dbItemHandler extends dbHandlerBase { ItemTemplate itemTemplate = new ItemTemplate(jsonObject); itemTemplate.template_id = templateID; ItemTemplate.templates.put(templateID, itemTemplate); + + if (templateTCountMap.entrySet().contains(itemTemplate.item_type)) + templateTCountMap.put(itemTemplate.item_type, templateTCountMap.get(itemTemplate.item_type) + 1); + else + templateTCountMap.put(itemTemplate.item_type, 1); } + Logger.info(templateTCountMap.toString()); } catch (Exception e) { Logger.error(e); }