File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed
paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patchroulette Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -43,11 +43,6 @@ abstract class PatchRouletteCancel : AbstractPatchRouletteTask() {
4343 abstract val patch: Property <String >
4444
4545 override fun run () {
46- if (patch.isPresent) {
47- cancelPatch(patch.get())
48- return
49- }
50-
5146 val config = if (config.path.isRegularFile()) {
5247 gson.fromJson<PatchRouletteApply .Config >(config.path)
5348 } else {
@@ -57,7 +52,15 @@ abstract class PatchRouletteCancel : AbstractPatchRouletteTask() {
5752 throw PaperweightException (" No current patch in config" )
5853 }
5954
60- config.currentPatches.forEach { cancelPatch(it.pathString) }
61- this .config.path.writeText(gson.toJson(config.copy(currentPatches = listOf ())))
55+ val patchesToCancel = if (! patch.isPresent) config.currentPatches else {
56+ if (! config.currentPatches.contains(Path (patch.get()))) {
57+ throw PaperweightException (" Cannot cancel patch ${patch.get()} as it isn't currently being worked on!" )
58+ }
59+
60+ listOf (Path (patch.get()))
61+ }
62+
63+ patchesToCancel.forEach { cancelPatch(it.pathString) }
64+ this .config.path.writeText(gson.toJson(config.copy(currentPatches = (config.currentPatches - patchesToCancel.toSet()))))
6265 }
6366}
You can’t perform that action at this time.
0 commit comments