From 8ae4a67635b00cf646f2e348df095c920befe2dc Mon Sep 17 00:00:00 2001 From: MagicBot Date: Tue, 27 Feb 2024 13:19:24 -0500 Subject: [PATCH] Refactor to array. --- src/engine/objects/ItemTemplate.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/engine/objects/ItemTemplate.java b/src/engine/objects/ItemTemplate.java index 2ba82e9f..d352bf8d 100644 --- a/src/engine/objects/ItemTemplate.java +++ b/src/engine/objects/ItemTemplate.java @@ -10,7 +10,6 @@ package engine.objects; import engine.Enum; import engine.math.Vector3fImmutable; -import javafx.util.Pair; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.pmw.tinylog.Logger; @@ -56,7 +55,7 @@ public class ItemTemplate { public float item_weapon_projectile_speed; public int item_weapon_combat_idle_anim; - public HashMap> item_weapon_damage = new HashMap<>(); + public HashMap item_weapon_damage = new HashMap<>(); public EnumSet item_flags = EnumSet.noneOf(Enum.ItemFlags.class); public EnumSet item_use_flags = EnumSet.noneOf(Enum.ItemUseFlags.class); public int item_initial_charges; @@ -70,8 +69,7 @@ public class ItemTemplate { public EnumSet item_disc_res = EnumSet.noneOf(Enum.DisciplineType.class); public int item_level_req; public Enum.SexType item_sex_req; - public HashMap> item_user_power_action = new HashMap<>(); - + public HashMap item_user_power_action = new HashMap<>(); public ItemTemplate(JSONObject jsonObject) { @@ -178,7 +176,7 @@ public class ItemTemplate { Enum.SourceType sourceType = Enum.SourceType.valueOf(((String) damage_entry.get("damage_type")).toUpperCase()); int min = ((Long) damage_entry.get("damage_min")).intValue(); int max = ((Long) damage_entry.get("damage_max")).intValue(); - Pair minMax = new Pair<>(min, max); // getKey = min. getValue = max. + int[] minMax = {min, max}; item_weapon_damage.put(sourceType, minMax); } } @@ -266,7 +264,7 @@ public class ItemTemplate { JSONObject powerActionEntry = (JSONObject) o; String power = (String) powerActionEntry.get("power"); JSONArray args = (JSONArray) powerActionEntry.get("arguments"); - Pair arguments = new Pair<>(((Long) args.get(0)).intValue(), ((Long) args.get(1)).intValue()); + int[] arguments = {((Long) args.get(0)).intValue(), ((Long) args.get(1)).intValue()}; item_user_power_action.put(power, arguments); } } catch (Exception e) {