mirror of
				https://github.com/GayPizzaSpecifications/foundation.git
				synced 2025-11-04 11:39:39 +00:00 
			
		
		
		
	Fix main classes and authors.
This commit is contained in:
		@ -7,4 +7,5 @@ load: STARTUP
 | 
				
			|||||||
depend:
 | 
					depend:
 | 
				
			||||||
  - Foundation
 | 
					  - Foundation
 | 
				
			||||||
authors:
 | 
					authors:
 | 
				
			||||||
  - kubelet
 | 
					  - kubeliv
 | 
				
			||||||
 | 
					  - azenla
 | 
				
			||||||
 | 
				
			|||||||
@ -7,7 +7,8 @@ load: STARTUP
 | 
				
			|||||||
depend:
 | 
					depend:
 | 
				
			||||||
  - Foundation
 | 
					  - Foundation
 | 
				
			||||||
authors:
 | 
					authors:
 | 
				
			||||||
  - kubelet
 | 
					  - kubeliv
 | 
				
			||||||
 | 
					  - azenla
 | 
				
			||||||
commands:
 | 
					commands:
 | 
				
			||||||
  chaos:
 | 
					  chaos:
 | 
				
			||||||
    description: Chaos Toggle
 | 
					    description: Chaos Toggle
 | 
				
			||||||
 | 
				
			|||||||
@ -5,7 +5,8 @@ api-version: 1.18
 | 
				
			|||||||
prefix: Foundation
 | 
					prefix: Foundation
 | 
				
			||||||
load: STARTUP
 | 
					load: STARTUP
 | 
				
			||||||
authors:
 | 
					authors:
 | 
				
			||||||
  - kubelet
 | 
					  - kubeliv
 | 
				
			||||||
 | 
					  - azenla
 | 
				
			||||||
commands:
 | 
					commands:
 | 
				
			||||||
  fbackup:
 | 
					  fbackup:
 | 
				
			||||||
    description: Back the server up now
 | 
					    description: Back the server up now
 | 
				
			||||||
 | 
				
			|||||||
@ -4,4 +4,5 @@ plugins {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
dependencies {
 | 
					dependencies {
 | 
				
			||||||
  api(project(":common-heimdall"))
 | 
					  api(project(":common-heimdall"))
 | 
				
			||||||
 | 
					  compileOnly(project(":foundation-core"))
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -8,6 +8,7 @@ import gay.pizza.foundation.heimdall.plugin.export.ExportChunksCommand
 | 
				
			|||||||
import com.charleskorn.kaml.Yaml
 | 
					import com.charleskorn.kaml.Yaml
 | 
				
			||||||
import com.zaxxer.hikari.HikariConfig
 | 
					import com.zaxxer.hikari.HikariConfig
 | 
				
			||||||
import com.zaxxer.hikari.HikariDataSource
 | 
					import com.zaxxer.hikari.HikariDataSource
 | 
				
			||||||
 | 
					import gay.pizza.foundation.core.Util
 | 
				
			||||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer
 | 
					import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer
 | 
				
			||||||
import org.bukkit.event.EventHandler
 | 
					import org.bukkit.event.EventHandler
 | 
				
			||||||
import org.bukkit.event.Listener
 | 
					import org.bukkit.event.Listener
 | 
				
			||||||
@ -46,7 +47,7 @@ class HeimdallPlugin : JavaPlugin(), Listener {
 | 
				
			|||||||
    val pluginDataPath = dataFolder.toPath()
 | 
					    val pluginDataPath = dataFolder.toPath()
 | 
				
			||||||
    pluginDataPath.toFile().mkdir()
 | 
					    pluginDataPath.toFile().mkdir()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    val configPath = copyDefaultConfig<HeimdallPlugin>(
 | 
					    val configPath = Util.copyDefaultConfig<HeimdallPlugin>(
 | 
				
			||||||
      slF4JLogger,
 | 
					      slF4JLogger,
 | 
				
			||||||
      pluginDataPath,
 | 
					      pluginDataPath,
 | 
				
			||||||
      "heimdall.yaml"
 | 
					      "heimdall.yaml"
 | 
				
			||||||
@ -169,33 +170,4 @@ class HeimdallPlugin : JavaPlugin(), Listener {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    bufferFlushThread.flush()
 | 
					    bufferFlushThread.flush()
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					 | 
				
			||||||
  private inline fun <reified T> copyDefaultConfig(log: Logger, targetPath: Path, resourceName: String): Path {
 | 
					 | 
				
			||||||
    if (resourceName.startsWith("/")) {
 | 
					 | 
				
			||||||
      throw IllegalArgumentException("resourceName starts with slash")
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (!targetPath.toFile().exists()) {
 | 
					 | 
				
			||||||
      throw Exception("Configuration output path does not exist!")
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    val outPath = targetPath.resolve(resourceName)
 | 
					 | 
				
			||||||
    val outFile = outPath.toFile()
 | 
					 | 
				
			||||||
    if (outFile.exists()) {
 | 
					 | 
				
			||||||
      log.debug("Configuration file already exists.")
 | 
					 | 
				
			||||||
      return outPath
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    val resourceStream = T::class.java.getResourceAsStream("/$resourceName")
 | 
					 | 
				
			||||||
      ?: throw Exception("Configuration resource does not exist!")
 | 
					 | 
				
			||||||
    val outputStream = outFile.outputStream()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    resourceStream.use {
 | 
					 | 
				
			||||||
      outputStream.use {
 | 
					 | 
				
			||||||
        log.info("Copied default configuration to $outPath")
 | 
					 | 
				
			||||||
        resourceStream.copyTo(outputStream)
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return outPath
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,11 +1,13 @@
 | 
				
			|||||||
name: Heimdall
 | 
					name: Foundation-Heimdall
 | 
				
			||||||
version: '${version}'
 | 
					version: '${version}'
 | 
				
			||||||
main: io.kexec.heimdall.plugin.HeimdallPlugin
 | 
					main: gay.pizza.foundation.heimdall.plugin.HeimdallPlugin
 | 
				
			||||||
api-version: 1.18
 | 
					api-version: 1.18
 | 
				
			||||||
prefix: Heimdall
 | 
					prefix: Foundation-Heimdall
 | 
				
			||||||
load: STARTUP
 | 
					load: STARTUP
 | 
				
			||||||
 | 
					depend:
 | 
				
			||||||
 | 
					  - Foundation
 | 
				
			||||||
authors:
 | 
					authors:
 | 
				
			||||||
  - kendfinger
 | 
					  - azenla
 | 
				
			||||||
commands:
 | 
					commands:
 | 
				
			||||||
  export_all_chunks:
 | 
					  export_all_chunks:
 | 
				
			||||||
    description: Export All Chunks
 | 
					    description: Export All Chunks
 | 
				
			||||||
 | 
				
			|||||||
@ -12,7 +12,7 @@ dependencies {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
tasks.jar {
 | 
					tasks.jar {
 | 
				
			||||||
  manifest.attributes(
 | 
					  manifest.attributes(
 | 
				
			||||||
    "Main-Class" to "io.kexec.heimdall.tool.MainKt"
 | 
					    "Main-Class" to "gay.pizza.foundation.heimdall.tool.MainKt"
 | 
				
			||||||
  )
 | 
					  )
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user