Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## v0.3.4 - Snapshot
* Fixed SoftwareType Checker

## v0.3.3 - Snapshot
* Configured Renovate
* Updated dependencies
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
id 'org.jetbrains.dokka' version '1.6.10'
}

def projectVersion = (System.getenv("VERSION") ?: '0.3.3-SNAPSHOT').replaceFirst("v", "").replace('/', '')
def projectVersion = (System.getenv("VERSION") ?: '0.3.4-SNAPSHOT').replaceFirst("v", "").replace('/', '')

group 'xyz.theprogramsrc'
version projectVersion
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package xyz.theprogramsrc.simplecoreapi.global.utils

import java.util.Objects

/**
* Representation of a ServerSoftware
* @param check The function to check if the software is running the server or not.
Expand Down Expand Up @@ -49,19 +51,25 @@ enum class SoftwareType(val check: () -> Boolean = { false }, val display: Strin
// Proxies
BUNGEE(check = {
try {
val proxyServerInstance = Class.forName("net.md_5.bungee.api.ProxyServer").getMethod("getInstance").invoke(null) as Class<*>
val name = proxyServerInstance.getMethod("getName").invoke(proxyServerInstance) as String
name.equals("BungeeCord")
val proxyServer = Class.forName("net.md_5.bungee.api.ProxyServer")
val proxyServerInstanceValue = proxyServer.getDeclaredField("instance").apply {
isAccessible = true
}.get(null)
val proxyServerName = proxyServer.getMethod("getName").invoke(proxyServerInstanceValue) as String
Objects.equals(proxyServerName, "BungeeCord")
} catch (e: Exception) {
false
}
}, "BungeeCord"),

WATERFALL(check = {
try {
val proxyServerInstance = Class.forName("net.md_5.bungee.api.ProxyServer").getMethod("getInstance").invoke(null) as Class<*>
val name = proxyServerInstance.getMethod("getName").invoke(proxyServerInstance) as String
name.equals("Waterfall")
val proxyServer = Class.forName("net.md_5.bungee.api.ProxyServer")
val proxyServerInstanceValue = proxyServer.getDeclaredField("instance").apply {
isAccessible = true
}.get(null)
val proxyServerName = proxyServer.getMethod("getName").invoke(proxyServerInstanceValue) as String
Objects.equals(proxyServerName, "Waterfall")
} catch (e: Exception) {
false
}
Expand Down