@@ -14,13 +14,12 @@ final class Settings{
1414 private final String internalSettingsFile = Main .mapArtFeaturesOnly ? "settings_for_mapart_ver.txt" : "settings.txt" ;
1515
1616 final boolean showNicheConfigs ;
17- final boolean storeDataInInstanceFolder ;
18- final boolean database , epearlOwners ;
17+ final boolean storeDataInInstanceFolder , database , epearlOwners ;
1918 final boolean placementHelperIframeAutoPlace , placementHelperMapArt , placementHelperMapArtAutoPlace , placementHelperMapArtAutoRemove ;
20- final boolean mapLoaderBot , inventoryRestockAuto , broadcaster ;
21- final boolean serverJoinListener , serverQuitListener , gameMessageListener , gameMessageFilter , containerOpenCloseListener ;
19+ final boolean serverJoinListener , serverQuitListener , gameMessageListener , gameMessageFilter ;
20+ final boolean onTickInventory , onTickContainer , onTickIframes , containerOpenCloseListener , mapLoaderBot , broadcaster ;
21+ final boolean tooltipMapHighlights , tooltipMapMetadata , tooltipRepairCost ;
2222 final boolean cmdAssignPearl , cmdDeletedMapsNearby , cmdExportMapImg , cmdMapArtGroup , cmdMapHashCode , cmdSeen , cmdSendAs , cmdTimeOnline ;
23- final boolean mapHighlights , mapHighlightsInGUIs , tooltipMapHighlights , tooltipMapMetadata , tooltipRepairCost ;
2423
2524
2625 private final HashMap <String , Boolean > loadSettings (){
@@ -34,9 +33,17 @@ private final HashMap<String, Boolean> loadSettings(){
3433 }
3534 }//==================================================
3635
37- HashMap <String , Boolean > config = new HashMap <>();
38- final String configContents = FileIO .loadFile ("settings.txt" , getClass ().getResourceAsStream ("/assets/" +Main .MOD_ID +"/" +internalSettingsFile ));
39- for (String line : configContents .split ("\\ r?\\ n" )){
36+ final HashMap <String , Boolean > config = new HashMap <>();
37+ String configContents = FileIO .loadFile ("settings.txt" , getClass ().getResourceAsStream ("/assets/" +Main .MOD_ID +"/" +internalSettingsFile ));
38+ {//==================================================
39+ // TODO: remove these legacy-patches in a future version
40+ if (configContents .contains ("map_highlights:" )){
41+ Main .LOGGER .info ("EvModConfig: Deleting unusable old settings.txt file (due to name changes; resetting to defaults)" );
42+ FileIO .deleteFile ("settings.txt" );
43+ configContents = FileIO .loadFile ("settings.txt" , getClass ().getResourceAsStream ("/assets/" +Main .MOD_ID +"/" +internalSettingsFile ));
44+ }
45+ }
46+ for (final String line : configContents .split ("\\ r?\\ n" )){
4047 final int sep = line .indexOf (':' );
4148 if (sep == -1 ) continue ;
4249 final String key = line .substring (0 , sep ).trim ();
@@ -47,9 +54,9 @@ private final HashMap<String, Boolean> loadSettings(){
4754 return config ;
4855 }
4956
50- private final boolean extractConfigValue (HashMap <String , Boolean > config , String key ){
57+ private final boolean extractConfigValue (final HashMap <String , Boolean > config , final String key ){
5158 final Boolean value = config .remove (key );
52- return value != null ? value : false ;
59+ return value != null && value ;
5360 }
5461
5562 Settings (){
@@ -63,21 +70,21 @@ private final boolean extractConfigValue(HashMap<String, Boolean> config, String
6370 epearlOwners = extractConfigValue (settings , "epearl_owners" );
6471 broadcaster = extractConfigValue (settings , "broadcaster" );
6572 placementHelperIframeAutoPlace = extractConfigValue (settings , "placement_helper.iframe.autoplace" );
66- placementHelperMapArt = extractConfigValue (settings , "placement_helper.mapart" );
73+ onTickInventory = extractConfigValue (settings , "on_tick.inventory" );
74+ onTickIframes = extractConfigValue (settings , "on_tick.iframes" );
75+ onTickContainer = extractConfigValue (settings , "on_tick.container" );
76+ containerOpenCloseListener = extractConfigValue (settings , "listener.container_open" );
77+ placementHelperMapArt = onTickInventory && extractConfigValue (settings , "placement_helper.mapart" );
6778 placementHelperMapArtAutoPlace = placementHelperMapArt && extractConfigValue (settings , "placement_helper.mapart.autoplace" );
6879 placementHelperMapArtAutoRemove = placementHelperMapArt && extractConfigValue (settings , "placement_helper.mapart.autoremove" );
6980 mapLoaderBot = extractConfigValue (settings , "map_bot.loader" );
7081 serverJoinListener = extractConfigValue (settings , "listener.server_join" );
7182 serverQuitListener = extractConfigValue (settings , "listener.server_quit" );
7283 gameMessageListener = extractConfigValue (settings , "listener.game_message.read" );
7384 gameMessageFilter = extractConfigValue (settings , "listener.game_message.filter" );
74- containerOpenCloseListener = extractConfigValue (settings , "listener.container_open" );
75- mapHighlights = extractConfigValue (settings , "map_highlights" );
76- mapHighlightsInGUIs = extractConfigValue (settings , "map_highlights.in_gui" );
77- tooltipMapHighlights = mapHighlights && extractConfigValue (settings , "tooltip.map_highlights" );
85+ tooltipMapHighlights = (onTickInventory || onTickIframes ) && extractConfigValue (settings , "tooltip.map_highlights" );
7886 tooltipMapMetadata = extractConfigValue (settings , "tooltip.map_metadata" );
7987 tooltipRepairCost = extractConfigValue (settings , "tooltip.repair_cost" );
80- inventoryRestockAuto = containerOpenCloseListener && extractConfigValue (settings , "inventory_restock.auto" );
8188
8289 cmdAssignPearl = epearlOwners && extractConfigValue (settings , "command.assignpearl" );
8390 cmdDeletedMapsNearby = extractConfigValue (settings , "command.deletedmapsnearby" );
0 commit comments