
walkmc.extensions.Notifications.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of walk-server Show documentation
Show all versions of walk-server Show documentation
A spigot fork to kotlin structure and news.
package walkmc.extensions
import org.bukkit.entity.*
import walkmc.*
import walkmc.extensions.collections.*
import walkmc.extensions.strings.*
import walkmc.placeholder.*
/**
* Sends a notification to the specified player with the specifieds placeholders.
*/
fun Chat.log(player: Player, vararg placeholders: Pair) {
if (!notificate) return
player.log(message.process(PlayerPlaceholder, player).process(*placeholders))
}
/**
* Sends a notification to the specified player with the specifieds placeholders.
*/
fun ActionBar.log(player: Player, vararg placeholders: Pair) {
if (!notificate) return
player.action(message.process(PlayerPlaceholder, player).process(*placeholders))
}
/**
* Sends a notification to the specified player with the specifieds placeholders.
*/
fun Title.log(player: Player, vararg placeholders: Pair) {
if (!notificate) return
player.title(
title.process(PlayerPlaceholder, player).process(*placeholders),
subtitle.process(PlayerPlaceholder, player).process(*placeholders),
fadeIn, stay, fadeOut
)
}
/**
* Sends a notification to the specified player with the specifieds placeholders.
*/
fun Notification.log(player: Player, vararg placeholders: Pair) {
when (this) {
is Chat -> log(player, *placeholders)
is ActionBar -> log(player, *placeholders)
is Title -> log(player, *placeholders)
}
}
/**
* Sends a notification to the specified player with the specifieds placeholders.
*/
fun Chat.log(player: Player, placeholders: Map) {
if (!notificate) return
player.log(message.process(PlayerPlaceholder, player).process(placeholders))
}
/**
* Sends a notification to the specified player with the specifieds placeholders.
*/
fun ActionBar.log(player: Player, placeholders: Map) {
if (!notificate) return
player.action(message.process(PlayerPlaceholder, player).process(placeholders))
}
/**
* Sends a notification to the specified player with the specifieds placeholders.
*/
fun Title.log(player: Player, placeholders: Map) {
if (!notificate) return
player.title(
title.process(PlayerPlaceholder, player).process(placeholders),
subtitle.process(PlayerPlaceholder, player).process(placeholders),
fadeIn, stay, fadeOut
)
}
/**
* Sends a notification to the specified player with the specifieds placeholders.
*/
fun Notification.log(player: Player, placeholders: Map) {
when (this) {
is Chat -> log(player, placeholders)
is ActionBar -> log(player, placeholders)
is Title -> log(player, placeholders)
}
}
/**
* Sends a notification to the specified player with the specifieds placeholders.
*/
fun Chat.log(player: Player, placeholder: Placeholder, value: T) {
if (!notificate) return
player.log(message.process(PlayerPlaceholder, player).process(placeholder, value))
}
/**
* Sends a notification to the specified player with the specifieds placeholders.
*/
fun ActionBar.log(player: Player, placeholder: Placeholder, value: T) {
if (!notificate) return
player.action(message.process(PlayerPlaceholder, player).process(placeholder, value))
}
/**
* Sends a notification to the specified player with the specifieds placeholders.
*/
fun Title.log(player: Player, placeholder: Placeholder, value: T) {
if (!notificate) return
player.title(
title.process(PlayerPlaceholder, player).process(placeholder, value),
subtitle.process(PlayerPlaceholder, player).process(placeholder, value),
fadeIn, stay, fadeOut
)
}
/**
* Sends a notification to the specified player with the specifieds placeholders.
*/
fun Notification.log(player: Player, placeholder: Placeholder, value: T) {
when (this) {
is Chat -> log(player, placeholder, value)
is ActionBar -> log(player, placeholder, value)
is Title -> log(player, placeholder, value)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy