Updated to eco placeholder system
This commit is contained in:
+1
-1
@@ -41,7 +41,7 @@ allprojects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly 'com.willfp:eco:6.33.0'
|
compileOnly 'com.willfp:eco:6.30.0'
|
||||||
implementation 'com.willfp:libreforge:3.34.0'
|
implementation 'com.willfp:libreforge:3.34.0'
|
||||||
|
|
||||||
compileOnly 'org.jetbrains:annotations:23.0.0'
|
compileOnly 'org.jetbrains:annotations:23.0.0'
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ import com.willfp.eco.core.data.ServerProfile
|
|||||||
import com.willfp.eco.core.data.keys.PersistentDataKey
|
import com.willfp.eco.core.data.keys.PersistentDataKey
|
||||||
import com.willfp.eco.core.data.keys.PersistentDataKeyType
|
import com.willfp.eco.core.data.keys.PersistentDataKeyType
|
||||||
import com.willfp.eco.core.data.profile
|
import com.willfp.eco.core.data.profile
|
||||||
import com.willfp.eco.core.integrations.placeholder.PlaceholderEntry
|
|
||||||
import com.willfp.eco.core.integrations.placeholder.PlaceholderManager
|
import com.willfp.eco.core.integrations.placeholder.PlaceholderManager
|
||||||
|
import com.willfp.eco.core.placeholder.PlayerlessPlaceholder
|
||||||
import com.willfp.eco.util.ListUtils
|
import com.willfp.eco.util.ListUtils
|
||||||
import com.willfp.eco.util.formatEco
|
import com.willfp.eco.util.formatEco
|
||||||
import com.willfp.eco.util.savedDisplayName
|
import com.willfp.eco.util.savedDisplayName
|
||||||
@@ -73,77 +73,68 @@ class BoostersPlugin : LibReforgePlugin(2036, 14269, "&e") {
|
|||||||
|
|
||||||
override fun handleEnableAdditional() {
|
override fun handleEnableAdditional() {
|
||||||
PlaceholderManager.registerPlaceholder(
|
PlaceholderManager.registerPlaceholder(
|
||||||
PlaceholderEntry(
|
PlayerlessPlaceholder(
|
||||||
this,
|
this,
|
||||||
"booster_info",
|
"booster_info",
|
||||||
{
|
{
|
||||||
val booster = activeBooster
|
val booster = activeBooster
|
||||||
|
|
||||||
if (booster == null) {
|
if (booster == null) {
|
||||||
return@PlaceholderEntry this.langYml.getString("no-currently-active")
|
return@PlayerlessPlaceholder this.langYml.getString("no-currently-active")
|
||||||
.formatEco(formatPlaceholders = false)
|
.formatEco(formatPlaceholders = false)
|
||||||
} else {
|
} else {
|
||||||
return@PlaceholderEntry this.langYml.getString("active-placeholder")
|
return@PlayerlessPlaceholder this.langYml.getString("active-placeholder")
|
||||||
.replace("%player%", booster.player.savedDisplayName)
|
.replace("%player%", booster.player.savedDisplayName)
|
||||||
.replace("%booster%", booster.booster.name)
|
.replace("%booster%", booster.booster.name)
|
||||||
.formatEco(formatPlaceholders = false)
|
.formatEco(formatPlaceholders = false)
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
false
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
PlaceholderManager.registerPlaceholder(
|
PlaceholderManager.registerPlaceholder(
|
||||||
PlaceholderEntry(
|
PlayerlessPlaceholder(
|
||||||
this,
|
this,
|
||||||
"active",
|
"active",
|
||||||
{
|
) {
|
||||||
activeBooster?.booster?.id ?: ""
|
activeBooster?.booster?.id ?: ""
|
||||||
},
|
}
|
||||||
false
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
PlaceholderManager.registerPlaceholder(
|
PlaceholderManager.registerPlaceholder(
|
||||||
PlaceholderEntry(
|
PlayerlessPlaceholder(
|
||||||
this,
|
this,
|
||||||
"active_name",
|
"active_name"
|
||||||
{
|
) {
|
||||||
activeBooster?.booster?.name ?: ""
|
activeBooster?.booster?.name ?: ""
|
||||||
},
|
}
|
||||||
false
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
PlaceholderManager.registerPlaceholder(
|
PlaceholderManager.registerPlaceholder(
|
||||||
PlaceholderEntry(
|
PlayerlessPlaceholder(
|
||||||
this,
|
this,
|
||||||
"active_player",
|
"active_player",
|
||||||
{
|
) {
|
||||||
activeBooster?.player?.savedDisplayName ?: ""
|
activeBooster?.player?.savedDisplayName ?: ""
|
||||||
},
|
}
|
||||||
false
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
PlaceholderManager.registerPlaceholder(
|
PlaceholderManager.registerPlaceholder(
|
||||||
PlaceholderEntry(
|
PlayerlessPlaceholder(
|
||||||
this,
|
this,
|
||||||
"seconds_remaining",
|
"seconds_remaining"
|
||||||
{
|
) {
|
||||||
secondsLeft.toString()
|
secondsLeft.toString()
|
||||||
},
|
}
|
||||||
false
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
PlaceholderManager.registerPlaceholder(
|
PlaceholderManager.registerPlaceholder(
|
||||||
PlaceholderEntry(
|
PlayerlessPlaceholder(
|
||||||
this,
|
this,
|
||||||
"time_remaining",
|
"time_remaining"
|
||||||
{
|
) {
|
||||||
if (secondsLeft <= 0) {
|
if (secondsLeft <= 0) {
|
||||||
return@PlaceholderEntry "00:00:00"
|
return@PlayerlessPlaceholder "00:00:00"
|
||||||
}
|
}
|
||||||
|
|
||||||
// if you've seen this code on the internet, no you haven't. shush
|
// if you've seen this code on the internet, no you haven't. shush
|
||||||
@@ -156,9 +147,7 @@ class BoostersPlugin : LibReforgePlugin(2036, 14269, "&e") {
|
|||||||
val ss = (if (seconds < 10) "0" else "") + seconds
|
val ss = (if (seconds < 10) "0" else "") + seconds
|
||||||
|
|
||||||
"${hh}:${mm}:${ss}"
|
"${hh}:${mm}:${ss}"
|
||||||
},
|
}
|
||||||
false
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
this.registerHolderProvider { ListUtils.toSingletonList(activeBooster?.booster as Holder) }
|
this.registerHolderProvider { ListUtils.toSingletonList(activeBooster?.booster as Holder) }
|
||||||
|
|||||||
Reference in New Issue
Block a user