File tree Expand file tree Collapse file tree 1 file changed +17
-8
lines changed
core/src/main/java/de/bluecolored/bluemap/core/world/mca/region Expand file tree Collapse file tree 1 file changed +17
-8
lines changed Original file line number Diff line number Diff line change 2525package de .bluecolored .bluemap .core .world .mca .region ;
2626
2727import com .flowpowered .math .vector .Vector2i ;
28+ import de .bluecolored .bluemap .core .logger .Logger ;
2829import de .bluecolored .bluemap .core .util .Key ;
2930import de .bluecolored .bluemap .core .util .Keyed ;
3031import de .bluecolored .bluemap .core .util .Registry ;
@@ -114,16 +115,24 @@ public String getRegionFileName(int regionX, int regionZ) {
114115 Matcher matcher = regionFileNamePattern .matcher (fileName );
115116 if (!matcher .matches ()) return null ;
116117
117- int regionX = Integer .parseInt (matcher .group (1 ));
118- int regionZ = Integer .parseInt (matcher .group (2 ));
118+ try {
119119
120- // sanity-check for roughly minecraft max boundaries (-30 000 000 to 30 000 000)
121- if (
122- regionX < -100000 || regionX > 100000 ||
123- regionZ < -100000 || regionZ > 100000
124- ) return null ;
120+ int regionX = Integer .parseInt (matcher .group (1 ));
121+ int regionZ = Integer .parseInt (matcher .group (2 ));
125122
126- return new Vector2i (regionX , regionZ );
123+ // sanity-check for roughly minecraft max boundaries (-30 000 000 to 30 000 000)
124+ if (
125+ regionX < -100000 || regionX > 100000 ||
126+ regionZ < -100000 || regionZ > 100000
127+ ) {
128+ return null ;
129+ }
130+
131+ return new Vector2i (regionX , regionZ );
132+
133+ } catch (NumberFormatException ex ) {
134+ return null ;
135+ }
127136 }
128137
129138 }
You can’t perform that action at this time.
0 commit comments