mirror of
https://github.com/GayPizzaSpecifications/foundation.git
synced 2025-08-03 13:31:32 +00:00
Repair extension loading by placing them in common-plugin rather than foundation-shared.
This commit is contained in:
@ -1,7 +0,0 @@
|
||||
package gay.pizza.foundation.shared
|
||||
|
||||
import org.bukkit.entity.Player
|
||||
|
||||
fun Player.chat(vararg messages: String): Unit = messages.forEach { message ->
|
||||
chat(message)
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
package gay.pizza.foundation.shared
|
||||
|
||||
fun <T, R : Comparable<R>> Collection<T>.sortedBy(order: SortOrder, selector: (T) -> R?): List<T> =
|
||||
if (order == SortOrder.Ascending) {
|
||||
sortedBy(selector)
|
||||
} else {
|
||||
sortedByDescending(selector)
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
package gay.pizza.foundation.shared
|
||||
|
||||
import org.bukkit.Material
|
||||
import org.bukkit.OfflinePlayer
|
||||
import org.bukkit.Server
|
||||
import org.bukkit.Statistic
|
||||
import org.bukkit.entity.EntityType
|
||||
|
||||
val Server.allPlayers: List<OfflinePlayer>
|
||||
get() = listOf(onlinePlayers, offlinePlayers.filter { !isPlayerOnline(it) }.toList()).flatten()
|
||||
|
||||
fun Server.isPlayerOnline(player: OfflinePlayer): Boolean =
|
||||
onlinePlayers.any { onlinePlayer -> onlinePlayer.name == player.name }
|
||||
|
||||
fun Server.allPlayerStatisticsOf(
|
||||
statistic: Statistic,
|
||||
material: Material? = null,
|
||||
entityType: EntityType? = null,
|
||||
order: SortOrder = SortOrder.Ascending
|
||||
): List<Pair<OfflinePlayer, Int>> = allPlayers.map { player ->
|
||||
player to if (material != null) {
|
||||
player.getStatistic(statistic, material)
|
||||
} else if (entityType != null) {
|
||||
player.getStatistic(statistic, entityType)
|
||||
} else {
|
||||
player.getStatistic(statistic)
|
||||
}
|
||||
}.sortedBy(order) { it.second }
|
@ -1,6 +0,0 @@
|
||||
package gay.pizza.foundation.shared
|
||||
|
||||
enum class SortOrder {
|
||||
Ascending,
|
||||
Descending
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
package gay.pizza.foundation.shared
|
||||
|
||||
import org.bukkit.Location
|
||||
import org.bukkit.World
|
||||
import org.bukkit.entity.Entity
|
||||
import org.bukkit.entity.Player
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
fun <T: Entity> World.spawn(location: Location, clazz: KClass<T>): T = spawn(location, clazz.java)
|
||||
|
||||
fun <T: Entity> Player.spawn(clazz: KClass<T>): T = spawn(clazz.java)
|
||||
fun <T: Entity> Player.spawn(clazz: Class<T>): T = world.spawn(location, clazz)
|
Reference in New Issue
Block a user