@@ -30,90 +30,95 @@ class Main : CliktCommand(
30
30
For more detailed information, please refer to https://github.com/jaoafa/DynmapProcessor#readme
31
31
""" .trimIndent()
32
32
) {
33
- val inputType by option(
33
+ private val inputType by option(
34
34
" -t" ,
35
35
" --type" ,
36
36
help = " Input type"
37
37
).enum<InputType >().default(InputType .FILE )
38
38
39
- val input by option(
39
+ private val input by option(
40
40
" -i" , " --input" ,
41
41
help = " The directory of tile images."
42
42
).path(mustExist = true , canBeFile = false )
43
43
44
- val jdbcUrl by option(
44
+ private val jdbcUrl by option(
45
45
" -j" , " --jdbc-url" ,
46
46
help = " JDBC URL to connect to the dynmap database."
47
47
).check { it.startsWith(" jdbc:mysql://" ) }
48
48
49
- val dbUser by option(
49
+ private val dbUser by option(
50
50
" -u" , " --db-user" ,
51
51
help = " Database user name."
52
52
)
53
53
54
- val dbPassword by option(
54
+ private val dbPassword by option(
55
55
" -p" , " --db-password" ,
56
56
help = " Database user password."
57
57
)
58
58
59
- val dbTablePrefix by option(
59
+ private val dbTablePrefix by option(
60
60
" --db-table-prefix" ,
61
61
help = " Database table name."
62
62
).default(" dmap" )
63
63
64
- val dbMapId by option(
64
+ private val dbMapId by option(
65
65
" --db-map-id" ,
66
66
help = " Map ID."
67
67
).int().default(1 )
68
68
69
- val output by option(
69
+ private val output by option(
70
70
" -o" , " --output" ,
71
71
help = " The directory to output generated images and metadata."
72
72
).path(canBeFile = false ).required()
73
73
74
- val cache by option(
74
+ private val cache by option(
75
75
" --cache" , // fixme when zoom level is different but use of cache is allowed...
76
76
help = " Whether to allow the use of cached basemap. (Skip basemap generation from scratch)"
77
77
).flag(default = false )
78
78
79
- val zoom by option(
79
+ private val purgeIsolated by option(
80
+ " --purge-isolated" ,
81
+ help = " Whether to purge isolated chunks."
82
+ ).flag(default = false )
83
+
84
+ private val zoom by option(
80
85
" -z" , " --zoom" ,
81
86
help = " Specify the zoom level from 0 to 4 (4 by default)"
82
87
).int().default(4 ).check(" Value must be 0 to 4" ) {
83
88
it in 0 .. 4
84
89
}
85
90
86
- val grid by option(
91
+ private val grid by option(
87
92
" -g" , " --grid" ,
88
93
help = " Whether to enable chunk grid."
89
94
).flag(default = false )
90
95
91
- val edit by option(
96
+ private val edit by option(
92
97
" -e" , " --edit" ,
93
98
help = " Whether to enable image editing."
94
99
).flag(default = false )
95
100
96
- val markers by option(
101
+ private val markers by option(
97
102
" -m" , " --markers" ,
98
103
help = " The file path to the JSON file that configures markers."
99
104
).path(mustExist = true , canBeDir = false )
100
105
101
- val clip by option(
106
+ private val clip by option(
102
107
" -c" , " --clip" ,
103
108
help = " Clip the specified area from the map image. Format: x1,y1,x2,y2"
104
109
).split(" ," ).check(" Length of the list must be 4. For example: 120,150,-10,10" ) { it.size == 4 }
105
110
106
- val height by option(
111
+ private val height by option(
107
112
" -h" , " --height" ,
108
113
help = " Height of the map image. Using this with the width option might cause distortion."
109
114
).int().check(" Value must be positive." ) { 0 < it }
110
115
111
- val width by option(
116
+ private val width by option(
112
117
" -w" , " --width" ,
113
118
help = " Width of the map image. Using this with the height option might cause distortion."
114
119
).int().check(" Value must be positive." ) { 0 < it }
115
120
116
- val resize by option(
121
+ private val resize by option(
117
122
" -r" , " --resize" ,
118
123
help = " Scale up (or down) the output image to the specified scale rate. (0<x<1 to scale down, 1<x to scale up)"
119
124
).double().default(1.0 ).check { it > 0 }
@@ -139,9 +144,10 @@ class Main : CliktCommand(
139
144
140
145
val inputDirectory = when (inputType) {
141
146
InputType .FILE -> input.toString()
142
- InputType .DATABASE -> if (input != null ) input.toString() else createTempDirectory(" dynmap-processor" ).toFile().apply {
143
- deleteOnExit()
144
- }.absolutePath
147
+ InputType .DATABASE -> if (input != null ) input.toString() else createTempDirectory(" dynmap-processor" ).toFile()
148
+ .apply {
149
+ deleteOnExit()
150
+ }.absolutePath
145
151
}
146
152
147
153
if (jdbcUrl != null && dbUser != null && dbPassword != null ) {
@@ -159,7 +165,7 @@ class Main : CliktCommand(
159
165
val mapImage =
160
166
if (basemapExists && metadataExists && cache)
161
167
MapImage .load(outputString, inputDirectory)
162
- else MapImage .create(outputString, inputDirectory, zoom, chunkImageResolution, grid)
168
+ else MapImage .create(outputString, inputDirectory, zoom, chunkImageResolution, grid, purgeIsolated )
163
169
164
170
if (edit) {
165
171
val markerFile = File (this .markers.toString())
0 commit comments