@@ -37,47 +37,68 @@ public RailwayMapRenderer(DynmapRailways plugin, DynmapCommonAPI dynmapAPI, Rail
3737 // No CoreProtect filtering
3838 }
3939
40+ /**
41+ * Check if debug mode is enabled.
42+ */
43+ private boolean isDebugEnabled () {
44+ return plugin .getConfig ().getBoolean ("general.debug" , false );
45+ }
46+
4047 /**
4148 * Initialize the map renderer.
4249 */
4350 public void initialize () {
44- logger .info ("[DEBUG] Starting RailwayMapRenderer initialization..." );
51+ if (isDebugEnabled ()) {
52+ logger .info ("[DEBUG] Starting RailwayMapRenderer initialization..." );
53+ }
4554 // Touch plugin to avoid unused field warning and for debugging context
4655 if (plugin != null ) {
47- logger .fine ("[DEBUG] Renderer initialized for plugin: " + plugin .getClass ().getName ());
56+ if (isDebugEnabled ()) {
57+ logger .fine ("[DEBUG] Renderer initialized for plugin: " + plugin .getClass ().getName ());
58+ }
4859 }
4960
50- // No CoreProtect filtering
51-
5261 if (dynmapAPI == null ) {
5362 logger .severe ("[DEBUG] Dynmap API is null!" );
5463 return ;
5564 }
56- logger .info ("[DEBUG] Dynmap API found: " + dynmapAPI .getClass ().getName ());
65+ if (isDebugEnabled ()) {
66+ logger .info ("[DEBUG] Dynmap API found: " + dynmapAPI .getClass ().getName ());
67+ }
5768
5869 // Get Marker API
5970 markerAPI = dynmapAPI .getMarkerAPI ();
60- logger .info ("[DEBUG] Marker API retrieved: " + (markerAPI != null ? markerAPI .getClass ().getName () : "null" ));
71+ if (isDebugEnabled ()) {
72+ logger .info ("[DEBUG] Marker API retrieved: " + (markerAPI != null ? markerAPI .getClass ().getName () : "null" ));
73+ }
6174
6275 if (markerAPI == null ) {
6376 logger .severe ("[DEBUG] Dynmap Marker API not available!" );
6477 return ;
6578 }
6679
6780 // Get or create marker sets
68- logger .info ("[DEBUG] Creating marker sets..." );
81+ if (isDebugEnabled ()) {
82+ logger .info ("[DEBUG] Creating marker sets..." );
83+ }
6984 createMarkerSets ();
7085
71- logger .info ("[DEBUG] Railway marker set: " + (railwayMarkerSet != null ? railwayMarkerSet .getClass ().getName () : "null" ));
72- logger .info ("[DEBUG] Station marker set: " + (stationMarkerSet != null ? stationMarkerSet .getClass ().getName () : "null" ));
86+ if (isDebugEnabled ()) {
87+ logger .info ("[DEBUG] Railway marker set: " + (railwayMarkerSet != null ? railwayMarkerSet .getClass ().getName () : "null" ));
88+ logger .info ("[DEBUG] Station marker set: " + (stationMarkerSet != null ? stationMarkerSet .getClass ().getName () : "null" ));
89+ }
7390
7491 if (railwayMarkerSet == null || stationMarkerSet == null ) {
75- logger .warning ("[DEBUG] Failed to create marker sets" );
92+ if (isDebugEnabled ()) {
93+ logger .warning ("[DEBUG] Failed to create marker sets" );
94+ }
7695 return ;
7796 }
7897
7998 // Initial render
80- logger .info ("[DEBUG] Updating all markers..." );
99+ if (isDebugEnabled ()) {
100+ logger .info ("[DEBUG] Updating all markers..." );
101+ }
81102 updateAllMarkers ();
82103
83104 logger .info ("Railway map renderer initialized successfully." );
@@ -87,23 +108,35 @@ public void initialize() {
87108 * Create or get marker sets.
88109 */
89110 private void createMarkerSets () {
90- logger .info ("[DEBUG] createMarkerSets() called" );
111+ if (isDebugEnabled ()) {
112+ logger .info ("[DEBUG] createMarkerSets() called" );
113+ }
91114 // Get marker sets
92115 railwayMarkerSet = markerAPI .getMarkerSet (MARKER_SET_ID );
93116 stationMarkerSet = markerAPI .getMarkerSet (STATIONS_SET_ID );
94- logger .info ("[DEBUG] Retrieved existing marker sets: railway=" + (railwayMarkerSet != null ) + ", station=" + (stationMarkerSet != null ));
117+ if (isDebugEnabled ()) {
118+ logger .info ("[DEBUG] Retrieved existing marker sets: railway=" + (railwayMarkerSet != null ) + ", station=" + (stationMarkerSet != null ));
119+ }
95120
96121 // Create if missing
97122 if (railwayMarkerSet == null ) {
98- logger .info ("[DEBUG] Railway marker set is null, attempting to create..." );
123+ if (isDebugEnabled ()) {
124+ logger .info ("[DEBUG] Railway marker set is null, attempting to create..." );
125+ }
99126 railwayMarkerSet = markerAPI .createMarkerSet (MARKER_SET_ID , "Railway Lines" , null , false );
100- logger .info ("[DEBUG] Created Railway Lines marker set successfully" );
127+ if (isDebugEnabled ()) {
128+ logger .info ("[DEBUG] Created Railway Lines marker set successfully" );
129+ }
101130 }
102131
103132 if (stationMarkerSet == null ) {
104- logger .info ("[DEBUG] Station marker set is null, attempting to create..." );
133+ if (isDebugEnabled ()) {
134+ logger .info ("[DEBUG] Station marker set is null, attempting to create..." );
135+ }
105136 stationMarkerSet = markerAPI .createMarkerSet (STATIONS_SET_ID , "Railway Stations" , null , false );
106- logger .info ("[DEBUG] Created Railway Stations marker set successfully" );
137+ if (isDebugEnabled ()) {
138+ logger .info ("[DEBUG] Created Railway Stations marker set successfully" );
139+ }
107140 }
108141
109142 // Set layer priorities - higher priority renders on top
@@ -121,10 +154,14 @@ private void createMarkerSets() {
121154 */
122155 public void updateAllMarkers () {
123156 try {
124- logger .info ("[DEBUG] updateAllMarkers() called" );
157+ if (isDebugEnabled ()) {
158+ logger .info ("[DEBUG] updateAllMarkers() called" );
159+ }
125160
126161 if (railwayMarkerSet == null || stationMarkerSet == null ) {
127- logger .warning ("[DEBUG] Marker sets not available - cannot render" );
162+ if (isDebugEnabled ()) {
163+ logger .warning ("[DEBUG] Marker sets not available - cannot render" );
164+ }
128165 return ;
129166 }
130167
@@ -136,34 +173,50 @@ public void updateAllMarkers() {
136173 // Clear old markers
137174 clearMarkers (railwayMarkerSet );
138175 clearMarkers (stationMarkerSet );
139- logger .info ("[DEBUG] Cleared old markers" );
176+ if (isDebugEnabled ()) {
177+ logger .info ("[DEBUG] Cleared old markers" );
178+ }
140179
141180 // Render rail lines
142181 Map <String , RailLine > railLines = dataStorage .getRailLines ();
143- logger .info ("[DEBUG] Found " + railLines .size () + " rail lines to render" );
182+ if (isDebugEnabled ()) {
183+ logger .info ("[DEBUG] Found " + railLines .size () + " rail lines to render" );
184+ }
144185
145186 boolean playerPlacedOnly = plugin .getConfig ().getBoolean ("coreprotect.player-placed-only" , true );
146187 for (RailLine line : railLines .values ()) {
147- logger .info ("[DEBUG] Processing line: " + line .getId () + " with " + line .getBlockCount () + " blocks, active=" + line .isActive ());
188+ if (isDebugEnabled ()) {
189+ logger .info ("[DEBUG] Processing line: " + line .getId () + " with " + line .getBlockCount () + " blocks, active=" + line .isActive ());
190+ }
148191 if (line .isActive () && line .getBlockCount () > 1 && (!playerPlacedOnly || line .getCreatedBy () != null )) {
149192 renderRailLine (line );
150- logger .info ("[DEBUG] Rendered line: " + line .getId ());
193+ if (isDebugEnabled ()) {
194+ logger .info ("[DEBUG] Rendered line: " + line .getId ());
195+ }
151196 }
152197 }
153198
154199 // Render stations
155200 Map <String , Station > stations = dataStorage .getStations ();
156- logger .info ("[DEBUG] Found " + stations .size () + " stations to render" );
201+ if (isDebugEnabled ()) {
202+ logger .info ("[DEBUG] Found " + stations .size () + " stations to render" );
203+ }
157204
158205 for (Station station : stations .values ()) {
159- logger .info ("[DEBUG] Processing station: " + station .getId () + ", active=" + station .isActive ());
206+ if (isDebugEnabled ()) {
207+ logger .info ("[DEBUG] Processing station: " + station .getId () + ", active=" + station .isActive ());
208+ }
160209 if (station .isActive ()) {
161210 renderStation (station );
162- logger .info ("[DEBUG] Rendered station: " + station .getId ());
211+ if (isDebugEnabled ()) {
212+ logger .info ("[DEBUG] Rendered station: " + station .getId ());
213+ }
163214 }
164215 }
165216
166- logger .info ("[DEBUG] updateAllMarkers() completed successfully" );
217+ if (isDebugEnabled ()) {
218+ logger .info ("[DEBUG] updateAllMarkers() completed successfully" );
219+ }
167220 } catch (Exception e ) {
168221 logger .warning ("Error updating markers: " + e .getMessage ());
169222 e .printStackTrace ();
@@ -379,7 +432,7 @@ private void renderStation(Station station) {
379432 // Get station appearance settings from config (with defaults)
380433 double radius = plugin .getConfig ().getDouble ("stations.radius" , 5.0 );
381434 String fillColorHex = plugin .getConfig ().getString ("stations.fill-color" , "#FFFFFF" );
382- double fillOpacity = plugin .getConfig ().getDouble ("stations.fill-opacity" , 0.9 );
435+ double fillOpacity = plugin .getConfig ().getDouble ("stations.fill-opacity" , 0.3 );
383436 int borderWidth = plugin .getConfig ().getInt ("stations.border-width" , 2 );
384437 String borderColorHex = plugin .getConfig ().getString ("stations.border-color" , "#000000" );
385438 double borderOpacity = plugin .getConfig ().getDouble ("stations.border-opacity" , 1.0 );
0 commit comments