Skip to content

Commit 6219ef2

Browse files
committed
clear ProjectCompiler output cache on startup
1 parent 0d21a90 commit 6219ef2

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

cranberri-server-plugin/src/main/kotlin/jupiterpi/cranberri/CranberriPlugin.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package jupiterpi.cranberri
22

3+
import jupiterpi.cranberri.runtime.compilation.ProjectCompiler
34
import jupiterpi.cranberri.tools.computerToolListener
45
import jupiterpi.cranberri.tools.loggerToolListener
56
import jupiterpi.cranberri.tools.toolsCommand
@@ -28,6 +29,7 @@ class CranberriPlugin : JavaPlugin(), Listener {
2829
plugin = this
2930

3031
TextFile.createPath(DATA_ROOT)
32+
ProjectCompiler.clearOutputCache()
3133

3234
Bukkit.getPluginManager().registerEvents(this, this)
3335
server.consoleSender.sendMessage(Component.join(JoinConfiguration.noSeparators(),

cranberri-server-plugin/src/main/kotlin/jupiterpi/cranberri/runtime/compilation/ProjectCompiler.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ const val PROJECTS_OUT_ROOT = "cranberri_projects-out"
1616
private const val API_JAR = "plugins/cranberri-server-plugin-1.0-SNAPSHOT-all.jar"
1717

1818
object ProjectCompiler {
19+
fun clearOutputCache() {
20+
File(PROJECTS_OUT_ROOT).listFiles()?.forEach { it.deleteRecursively() }
21+
}
22+
1923
fun compileProject(projectName: String, instanceId: String) {
2024
if (projectName.contains("-")) throw Exception("Invalid project name: Mustn't include '-'")
2125

0 commit comments

Comments
 (0)