diff --git a/common-plugin/src/main/kotlin/gay/pizza/foundation/common/ChatExtensions.kt b/common-plugin/src/main/kotlin/gay/pizza/foundation/common/ChatExtensions.kt new file mode 100644 index 0000000..0774869 --- /dev/null +++ b/common-plugin/src/main/kotlin/gay/pizza/foundation/common/ChatExtensions.kt @@ -0,0 +1,7 @@ +package gay.pizza.foundation.common + +import org.bukkit.entity.Player + +fun Player.chat(vararg messages: String): Unit = messages.forEach { message -> + chat(message) +} diff --git a/foundation-core/src/main/kotlin/gay/pizza/foundation/core/CommonExtensions.kt b/common-plugin/src/main/kotlin/gay/pizza/foundation/common/CollectionExtensions.kt similarity index 85% rename from foundation-core/src/main/kotlin/gay/pizza/foundation/core/CommonExtensions.kt rename to common-plugin/src/main/kotlin/gay/pizza/foundation/common/CollectionExtensions.kt index 32d4556..4c2c709 100644 --- a/foundation-core/src/main/kotlin/gay/pizza/foundation/core/CommonExtensions.kt +++ b/common-plugin/src/main/kotlin/gay/pizza/foundation/common/CollectionExtensions.kt @@ -1,4 +1,4 @@ -package gay.pizza.foundation.core +package gay.pizza.foundation.common fun > Collection.sortedBy(order: SortOrder, selector: (T) -> R?): List = if (order == SortOrder.Ascending) { diff --git a/common-plugin/src/main/kotlin/gay/pizza/foundation/common/Platform.kt b/common-plugin/src/main/kotlin/gay/pizza/foundation/common/Platform.kt new file mode 100644 index 0000000..30f0982 --- /dev/null +++ b/common-plugin/src/main/kotlin/gay/pizza/foundation/common/Platform.kt @@ -0,0 +1,7 @@ +package gay.pizza.foundation.common + +object Platform { + private val os: String? = System.getProperty("os.name") + + fun isWindows(): Boolean = os != null && os.lowercase().startsWith("windows") +} diff --git a/foundation-core/src/main/kotlin/gay/pizza/foundation/core/BukkitExtensions.kt b/common-plugin/src/main/kotlin/gay/pizza/foundation/common/ServerExtensions.kt similarity index 95% rename from foundation-core/src/main/kotlin/gay/pizza/foundation/core/BukkitExtensions.kt rename to common-plugin/src/main/kotlin/gay/pizza/foundation/common/ServerExtensions.kt index 1d49684..7bb54ec 100644 --- a/foundation-core/src/main/kotlin/gay/pizza/foundation/core/BukkitExtensions.kt +++ b/common-plugin/src/main/kotlin/gay/pizza/foundation/common/ServerExtensions.kt @@ -1,4 +1,4 @@ -package gay.pizza.foundation.core +package gay.pizza.foundation.common import org.bukkit.Material import org.bukkit.OfflinePlayer diff --git a/foundation-core/src/main/kotlin/gay/pizza/foundation/core/SortOrder.kt b/common-plugin/src/main/kotlin/gay/pizza/foundation/common/SortOrder.kt similarity index 59% rename from foundation-core/src/main/kotlin/gay/pizza/foundation/core/SortOrder.kt rename to common-plugin/src/main/kotlin/gay/pizza/foundation/common/SortOrder.kt index 1e64514..e08d84f 100644 --- a/foundation-core/src/main/kotlin/gay/pizza/foundation/core/SortOrder.kt +++ b/common-plugin/src/main/kotlin/gay/pizza/foundation/common/SortOrder.kt @@ -1,4 +1,4 @@ -package gay.pizza.foundation.core +package gay.pizza.foundation.common enum class SortOrder { Ascending, diff --git a/foundation-core/src/main/kotlin/gay/pizza/foundation/core/TextColors.kt b/foundation-core/src/main/kotlin/gay/pizza/foundation/core/TextColors.kt index 007aded..19439d5 100644 --- a/foundation-core/src/main/kotlin/gay/pizza/foundation/core/TextColors.kt +++ b/foundation-core/src/main/kotlin/gay/pizza/foundation/core/TextColors.kt @@ -3,5 +3,5 @@ package gay.pizza.foundation.core import net.kyori.adventure.text.format.TextColor object TextColors { - val AMARANTH_PINK = TextColor.fromHexString("#F7A8B8")!! + val AmaranthPink = TextColor.fromHexString("#F7A8B8")!! } diff --git a/foundation-core/src/main/kotlin/gay/pizza/foundation/core/Util.kt b/foundation-core/src/main/kotlin/gay/pizza/foundation/core/Util.kt index 72fa746..f1b2409 100644 --- a/foundation-core/src/main/kotlin/gay/pizza/foundation/core/Util.kt +++ b/foundation-core/src/main/kotlin/gay/pizza/foundation/core/Util.kt @@ -12,7 +12,7 @@ object Util { private val foundationName: Component = Component.text("Foundation") fun formatSystemMessage(message: String): Component { - return formatSystemMessage(TextColors.AMARANTH_PINK, message) + return formatSystemMessage(TextColors.AmaranthPink, message) } fun formatSystemMessage(prefixColor: TextColor, message: String): Component { @@ -57,9 +57,4 @@ object Util { return outPath } - - fun isPlatformWindows(): Boolean { - val os = System.getProperty("os.name") - return os != null && os.lowercase().startsWith("windows") - } } diff --git a/foundation-core/src/main/kotlin/gay/pizza/foundation/core/features/backup/BackupCommand.kt b/foundation-core/src/main/kotlin/gay/pizza/foundation/core/features/backup/BackupCommand.kt index e1853dd..e75a4cc 100644 --- a/foundation-core/src/main/kotlin/gay/pizza/foundation/core/features/backup/BackupCommand.kt +++ b/foundation-core/src/main/kotlin/gay/pizza/foundation/core/features/backup/BackupCommand.kt @@ -1,5 +1,6 @@ package gay.pizza.foundation.core.features.backup +import gay.pizza.foundation.common.Platform import gay.pizza.foundation.core.FoundationCorePlugin import gay.pizza.foundation.core.Util import net.kyori.adventure.text.Component @@ -58,7 +59,7 @@ class BackupCommand( } val backupTime = Instant.now() - val backupIdentifier = if (Util.isPlatformWindows()) { + val backupIdentifier = if (Platform.isWindows()) { backupTime.toEpochMilli().toString() } else { backupTime.toString() diff --git a/foundation-core/src/main/kotlin/gay/pizza/foundation/core/features/player/GooseCommand.kt b/foundation-core/src/main/kotlin/gay/pizza/foundation/core/features/player/GooseCommand.kt index 8aaa428..1592995 100644 --- a/foundation-core/src/main/kotlin/gay/pizza/foundation/core/features/player/GooseCommand.kt +++ b/foundation-core/src/main/kotlin/gay/pizza/foundation/core/features/player/GooseCommand.kt @@ -1,5 +1,6 @@ package gay.pizza.foundation.core.features.player +import gay.pizza.foundation.common.chat import org.bukkit.command.Command import org.bukkit.command.CommandExecutor import org.bukkit.command.CommandSender @@ -15,8 +16,10 @@ class GooseCommand : CommandExecutor { sender.sendMessage("Player is required for this command.") return true } - sender.chat("Goose is the most beautiful kbity to ever exist <3") - sender.chat("I don't know who Nat is but there is no way she can compare to Goose.") + sender.chat( + "Goose is the most beautiful kbity to ever exist <3", + "I don't know who Nat is but there is no way she can compare to Goose." + ) return true } } diff --git a/foundation-core/src/main/kotlin/gay/pizza/foundation/core/features/stats/LeaderboardCommand.kt b/foundation-core/src/main/kotlin/gay/pizza/foundation/core/features/stats/LeaderboardCommand.kt index 142c7ee..45799a2 100644 --- a/foundation-core/src/main/kotlin/gay/pizza/foundation/core/features/stats/LeaderboardCommand.kt +++ b/foundation-core/src/main/kotlin/gay/pizza/foundation/core/features/stats/LeaderboardCommand.kt @@ -1,7 +1,7 @@ package gay.pizza.foundation.core.features.stats -import gay.pizza.foundation.core.SortOrder -import gay.pizza.foundation.core.allPlayerStatisticsOf +import gay.pizza.foundation.common.SortOrder +import gay.pizza.foundation.common.allPlayerStatisticsOf import org.bukkit.Statistic import org.bukkit.command.Command import org.bukkit.command.CommandExecutor