Skip to content
This repository was archived by the owner on Feb 25, 2022. It is now read-only.

Commit 5f76fd3

Browse files
author
melike2d
committed
reformat project
1 parent b007c9e commit 5f76fd3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1880
-1864
lines changed

LavalinkServer/src/main/java/lavalink/server/Launcher.kt

Lines changed: 80 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -43,89 +43,89 @@ class LavalinkApplication
4343

4444
object Launcher {
4545

46-
private val log = LoggerFactory.getLogger(Launcher::class.java)
47-
48-
val startTime = System.currentTimeMillis()
49-
50-
private fun getVersionInfo(indentation: String = "\t", vanity: Boolean = true): String {
51-
val appInfo = AppInfo()
52-
val gitRepoState = GitRepoState()
53-
54-
val dtf = DateTimeFormatter
55-
.ofPattern("dd.MM.yyyy HH:mm:ss z")
56-
.withZone(ZoneId.of("UTC"))
57-
58-
val buildTime = dtf.format(Instant.ofEpochMilli(appInfo.buildTime))
59-
val commitTime = dtf.format(Instant.ofEpochMilli(gitRepoState.commitTime * 1000))
60-
61-
val version = appInfo.version.takeUnless { it.startsWith("@") } ?: "Unknown"
62-
val buildNumber = appInfo.buildNumber.takeUnless { it.startsWith("@") } ?: "Unofficial"
63-
64-
return buildString {
65-
if (vanity) {
66-
appendLine()
67-
appendLine()
68-
appendLine(getVanity())
69-
}
70-
71-
if (!gitRepoState.isLoaded) {
72-
appendLine()
73-
appendLine("$indentation*** Unable to find or load Git metadata ***")
74-
}
75-
76-
appendLine()
77-
append("${indentation}Version: "); appendLine(version)
78-
append("${indentation}Build: "); appendLine(buildNumber)
79-
if (gitRepoState.isLoaded) {
80-
append("${indentation}Build time: "); appendLine(buildTime)
81-
append("${indentation}Branch "); appendLine(gitRepoState.branch)
82-
append("${indentation}Commit: "); appendLine(gitRepoState.commitIdAbbrev)
83-
append("${indentation}Commit time: "); appendLine(commitTime)
84-
}
85-
86-
append("${indentation}JVM: "); appendLine(System.getProperty("java.version"))
87-
append("${indentation}Lavaplayer "); appendLine(PlayerLibrary.VERSION)
46+
private val log = LoggerFactory.getLogger(Launcher::class.java)
47+
48+
val startTime = System.currentTimeMillis()
49+
50+
private fun getVersionInfo(indentation: String = "\t", vanity: Boolean = true): String {
51+
val appInfo = AppInfo()
52+
val gitRepoState = GitRepoState()
53+
54+
val dtf = DateTimeFormatter
55+
.ofPattern("dd.MM.yyyy HH:mm:ss z")
56+
.withZone(ZoneId.of("UTC"))
57+
58+
val buildTime = dtf.format(Instant.ofEpochMilli(appInfo.buildTime))
59+
val commitTime = dtf.format(Instant.ofEpochMilli(gitRepoState.commitTime * 1000))
60+
61+
val version = appInfo.version.takeUnless { it.startsWith("@") } ?: "Unknown"
62+
val buildNumber = appInfo.buildNumber.takeUnless { it.startsWith("@") } ?: "Unofficial"
63+
64+
return buildString {
65+
if (vanity) {
66+
appendLine()
67+
appendLine()
68+
appendLine(getVanity())
69+
}
70+
71+
if (!gitRepoState.isLoaded) {
72+
appendLine()
73+
appendLine("$indentation*** Unable to find or load Git metadata ***")
74+
}
75+
76+
appendLine()
77+
append("${indentation}Version: "); appendLine(version)
78+
append("${indentation}Build: "); appendLine(buildNumber)
79+
if (gitRepoState.isLoaded) {
80+
append("${indentation}Build time: "); appendLine(buildTime)
81+
append("${indentation}Branch "); appendLine(gitRepoState.branch)
82+
append("${indentation}Commit: "); appendLine(gitRepoState.commitIdAbbrev)
83+
append("${indentation}Commit time: "); appendLine(commitTime)
84+
}
85+
86+
append("${indentation}JVM: "); appendLine(System.getProperty("java.version"))
87+
append("${indentation}Lavaplayer "); appendLine(PlayerLibrary.VERSION)
88+
}
8889
}
89-
}
90-
91-
private fun getVanity(): String {
92-
//ansi color codes
93-
val red = ""
94-
val green = ""
95-
val defaultC = ""
96-
97-
var vanity = ("g . r _ _ _ _ g__ _ _\n"
98-
+ "g /\\\\ r| | __ ___ ____ _| (_)_ __ | | __g\\ \\ \\ \\\n"
99-
+ "g ( ( )r| |/ _` \\ \\ / / _` | | | '_ \\| |/ /g \\ \\ \\ \\\n"
100-
+ "g \\\\/ r| | (_| |\\ V / (_| | | | | | | < g ) ) ) )\n"
101-
+ "g ' r|_|\\__,_| \\_/ \\__,_|_|_|_| |_|_|\\_\\g / / / /\n"
102-
+ "d =========================================g/_/_/_/d")
103-
104-
vanity = vanity.replace("r".toRegex(), red)
105-
vanity = vanity.replace("g".toRegex(), green)
106-
vanity = vanity.replace("d".toRegex(), defaultC)
107-
return vanity
108-
}
109-
110-
@JvmStatic
111-
fun main(args: Array<String>) {
112-
when (args.firstOrNull()?.lowercase()) {
113-
"-v", "--version" -> return println(getVersionInfo(indentation = "", vanity = false))
90+
91+
private fun getVanity(): String {
92+
//ansi color codes
93+
val red = ""
94+
val green = ""
95+
val defaultC = ""
96+
97+
var vanity = ("g . r _ _ _ _ g__ _ _\n"
98+
+ "g /\\\\ r| | __ ___ ____ _| (_)_ __ | | __g\\ \\ \\ \\\n"
99+
+ "g ( ( )r| |/ _` \\ \\ / / _` | | | '_ \\| |/ /g \\ \\ \\ \\\n"
100+
+ "g \\\\/ r| | (_| |\\ V / (_| | | | | | | < g ) ) ) )\n"
101+
+ "g ' r|_|\\__,_| \\_/ \\__,_|_|_|_| |_|_|\\_\\g / / / /\n"
102+
+ "d =========================================g/_/_/_/d")
103+
104+
vanity = vanity.replace("r".toRegex(), red)
105+
vanity = vanity.replace("g".toRegex(), green)
106+
vanity = vanity.replace("d".toRegex(), defaultC)
107+
return vanity
114108
}
115109

116-
/* start the spring application */
117-
val sa = SpringApplication(LavalinkApplication::class.java)
118-
sa.webApplicationType = WebApplicationType.SERVLET
119-
sa.setBannerMode(Banner.Mode.OFF) // We have our own
120-
sa.addListeners(
121-
ApplicationListener { event: Any ->
122-
when (event) {
123-
is ApplicationEnvironmentPreparedEvent -> log.info(getVersionInfo())
124-
is ApplicationFailedEvent -> log.error("Application failed", event.exception)
110+
@JvmStatic
111+
fun main(args: Array<String>) {
112+
when (args.firstOrNull()?.lowercase()) {
113+
"-v", "--version" -> return println(getVersionInfo(indentation = "", vanity = false))
125114
}
126-
}
127-
)
128115

129-
sa.run(*args)
130-
}
116+
/* start the spring application */
117+
val sa = SpringApplication(LavalinkApplication::class.java)
118+
sa.webApplicationType = WebApplicationType.SERVLET
119+
sa.setBannerMode(Banner.Mode.OFF) // We have our own
120+
sa.addListeners(
121+
ApplicationListener { event: Any ->
122+
when (event) {
123+
is ApplicationEnvironmentPreparedEvent -> log.info(getVersionInfo())
124+
is ApplicationFailedEvent -> log.error("Application failed", event.exception)
125+
}
126+
}
127+
)
128+
129+
sa.run(*args)
130+
}
131131
}

LavalinkServer/src/main/java/lavalink/server/config/AudioSourcesConfig.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ import org.springframework.stereotype.Component
3030
@Component
3131
object AudioSourcesConfig {
3232

33-
var youtube: Boolean = true
34-
var bandcamp: Boolean = true
35-
var soundcloud: Boolean = true
36-
var twitch: Boolean = true
37-
var vimeo: Boolean = true
38-
var http: Boolean = true
39-
var local: Boolean = false
33+
var youtube: Boolean = true
34+
var bandcamp: Boolean = true
35+
var soundcloud: Boolean = true
36+
var twitch: Boolean = true
37+
var vimeo: Boolean = true
38+
var http: Boolean = true
39+
var local: Boolean = false
4040

4141
}

LavalinkServer/src/main/java/lavalink/server/config/KoeConfigProperties.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ import org.springframework.stereotype.Component
2929
@ConfigurationProperties(prefix = "lavalink.server.koe")
3030
@Component
3131
class KoeConfigProperties {
32-
var useEpoll: Boolean = true
33-
var highPacketPriority: Boolean = true
34-
var bufferDurationMs: Int? = null
35-
var byteBufAllocator: String = "pooled"
32+
var useEpoll: Boolean = true
33+
var highPacketPriority: Boolean = true
34+
var bufferDurationMs: Int? = null
35+
var byteBufAllocator: String = "pooled"
3636
}

LavalinkServer/src/main/java/lavalink/server/config/KoeConfiguration.kt

Lines changed: 47 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -40,58 +40,60 @@ import org.springframework.context.annotation.Configuration
4040
@Configuration
4141
class KoeConfiguration(val configProperties: KoeConfigProperties) {
4242

43-
private val log: Logger = LoggerFactory.getLogger(KoeConfiguration::class.java)
43+
private val log: Logger = LoggerFactory.getLogger(KoeConfiguration::class.java)
4444

45-
@Bean
46-
fun koeOptions(): KoeOptions = KoeOptions.builder().apply {
47-
log.info("OS: " + System.getProperty("os.name") + ", Arch: " + System.getProperty("os.arch"))
48-
val os = System.getProperty("os.name")
49-
val arch = System.getProperty("os.arch")
45+
@Bean
46+
fun koeOptions(): KoeOptions = KoeOptions.builder().apply {
47+
log.info("OS: " + System.getProperty("os.name") + ", Arch: " + System.getProperty("os.arch"))
48+
val os = System.getProperty("os.name")
49+
val arch = System.getProperty("os.arch")
5050

51-
setHighPacketPriority(configProperties.highPacketPriority)
51+
setHighPacketPriority(configProperties.highPacketPriority)
5252

53-
/* JDA-NAS */
54-
// Maybe add Windows natives back?
55-
val nasSupported = os.contains("linux", ignoreCase = true)
56-
&& arch.equals("amd64", ignoreCase = true)
53+
/* JDA-NAS */
54+
// Maybe add Windows natives back?
55+
val nasSupported = os.contains("linux", ignoreCase = true)
56+
&& arch.equals("amd64", ignoreCase = true)
5757

58-
if (nasSupported) {
59-
log.info("Enabling JDA-NAS")
58+
if (nasSupported) {
59+
log.info("Enabling JDA-NAS")
6060

61-
var bufferSize = configProperties.bufferDurationMs ?: UdpQueueFramePollerFactory.DEFAULT_BUFFER_DURATION
62-
if (bufferSize <= 0) {
63-
log.warn("Buffer size of ${bufferSize}ms is illegal. Defaulting to ${UdpQueueFramePollerFactory.DEFAULT_BUFFER_DURATION}")
64-
bufferSize = UdpQueueFramePollerFactory.DEFAULT_BUFFER_DURATION
65-
}
61+
var bufferSize = configProperties.bufferDurationMs ?: UdpQueueFramePollerFactory.DEFAULT_BUFFER_DURATION
62+
if (bufferSize <= 0) {
63+
log.warn("Buffer size of ${bufferSize}ms is illegal. Defaulting to ${UdpQueueFramePollerFactory.DEFAULT_BUFFER_DURATION}")
64+
bufferSize = UdpQueueFramePollerFactory.DEFAULT_BUFFER_DURATION
65+
}
6666

67-
setFramePollerFactory(UdpQueueFramePollerFactory(bufferSize, Runtime.getRuntime().availableProcessors()))
68-
} else {
69-
log.warn("This system and architecture appears to not support native audio sending! "
70-
+ "GC pauses may cause your bot to stutter during playback.")
71-
}
67+
setFramePollerFactory(UdpQueueFramePollerFactory(bufferSize, Runtime.getRuntime().availableProcessors()))
68+
} else {
69+
log.warn(
70+
"This system and architecture appears to not support native audio sending! "
71+
+ "GC pauses may cause your bot to stutter during playback."
72+
)
73+
}
7274

73-
/* Epoll Transport */
74-
if (configProperties.useEpoll && Epoll.isAvailable()) {
75-
log.info("Using Epoll Transport.")
76-
setEventLoopGroup(EpollEventLoopGroup())
77-
setDatagramChannelClass(EpollDatagramChannel::class.java)
78-
setSocketChannelClass(EpollSocketChannel::class.java)
79-
}
75+
/* Epoll Transport */
76+
if (configProperties.useEpoll && Epoll.isAvailable()) {
77+
log.info("Using Epoll Transport.")
78+
setEventLoopGroup(EpollEventLoopGroup())
79+
setDatagramChannelClass(EpollDatagramChannel::class.java)
80+
setSocketChannelClass(EpollSocketChannel::class.java)
81+
}
8082

81-
/* Byte Buf Allocator */
82-
var custom = true
83-
when (configProperties.byteBufAllocator) {
84-
"netty-default" -> setByteBufAllocator(ByteBufAllocator.DEFAULT)
85-
"default", "pooled" -> setByteBufAllocator(PooledByteBufAllocator.DEFAULT)
86-
"unpooled" -> setByteBufAllocator(UnpooledByteBufAllocator.DEFAULT)
87-
else -> {
88-
log.warn("Invalid byte buf allocator \"${configProperties.byteBufAllocator}\", defaulting to the 'pooled' byte buf allocator.")
89-
custom = false
90-
}
91-
}
83+
/* Byte Buf Allocator */
84+
var custom = true
85+
when (configProperties.byteBufAllocator) {
86+
"netty-default" -> setByteBufAllocator(ByteBufAllocator.DEFAULT)
87+
"default", "pooled" -> setByteBufAllocator(PooledByteBufAllocator.DEFAULT)
88+
"unpooled" -> setByteBufAllocator(UnpooledByteBufAllocator.DEFAULT)
89+
else -> {
90+
log.warn("Invalid byte buf allocator \"${configProperties.byteBufAllocator}\", defaulting to the 'pooled' byte buf allocator.")
91+
custom = false
92+
}
93+
}
9294

93-
if (custom) {
94-
log.info("Using the '${configProperties.byteBufAllocator}' byte buf allocator")
95-
}
96-
}.create()
95+
if (custom) {
96+
log.info("Using the '${configProperties.byteBufAllocator}' byte buf allocator")
97+
}
98+
}.create()
9799
}

LavalinkServer/src/main/java/lavalink/server/config/LavaplayerConfigProperties.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ import org.springframework.stereotype.Component
2929
@ConfigurationProperties(prefix = "lavalink.server.lavaplayer")
3030
@Component
3131
class LavaplayerConfigProperties {
32-
var youtubePlaylistLoadLimit: Int? = null
33-
var isGcWarnings = true
34-
var isYoutubeSearchEnabled = true
35-
var isSoundcloudSearchEnabled = true
36-
var ratelimit: RateLimitConfig? = null
37-
var nonAllocating: Boolean = false
38-
var frameBufferDuration: Int = 5000
32+
var youtubePlaylistLoadLimit: Int? = null
33+
var isGcWarnings = true
34+
var isYoutubeSearchEnabled = true
35+
var isSoundcloudSearchEnabled = true
36+
var ratelimit: RateLimitConfig? = null
37+
var nonAllocating: Boolean = false
38+
var frameBufferDuration: Int = 5000
3939
}

LavalinkServer/src/main/java/lavalink/server/config/MetricsPrometheusConfigProperties.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@
2121
*
2222
*/
2323

24-
package lavalink.server.config;
24+
package lavalink.server.config
2525

26-
import org.springframework.boot.context.properties.ConfigurationProperties;
27-
import org.springframework.stereotype.Component;
26+
import org.springframework.boot.context.properties.ConfigurationProperties
27+
import org.springframework.stereotype.Component
2828

2929
/**
3030
* Created by napster on 20.05.18.
3131
*/
3232
@Component
3333
@ConfigurationProperties("metrics.prometheus")
3434
class MetricsPrometheusConfigProperties {
35-
var enabled = false;
36-
var endpoint: String = "";
35+
var enabled = false
36+
var endpoint: String = ""
3737
}

LavalinkServer/src/main/java/lavalink/server/config/RateLimitConfig.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
package lavalink.server.config
2525

2626
data class RateLimitConfig(
27-
var ipBlocks: List<String> = emptyList(),
28-
var excludedIps: List<String> = emptyList(),
29-
var strategy: String = "RotateOnBan",
30-
var retryLimit: Int = -1,
31-
var searchTriggersFail: Boolean = true
27+
var ipBlocks: List<String> = emptyList(),
28+
var excludedIps: List<String> = emptyList(),
29+
var strategy: String = "RotateOnBan",
30+
var retryLimit: Int = -1,
31+
var searchTriggersFail: Boolean = true
3232
)

0 commit comments

Comments
 (0)