diff --git a/src/main/kotlin/com/pobnellion/pobutils/modules/CmdModule.kt b/src/main/kotlin/com/pobnellion/pobutils/modules/CmdModule.kt index 2e6b343..2d861ca 100644 --- a/src/main/kotlin/com/pobnellion/pobutils/modules/CmdModule.kt +++ b/src/main/kotlin/com/pobnellion/pobutils/modules/CmdModule.kt @@ -7,8 +7,6 @@ import com.pobnellion.pobutils.Pobutils import io.papermc.paper.command.brigadier.CommandSourceStack import io.papermc.paper.command.brigadier.Commands import io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents -import net.kyori.adventure.text.Component -import net.kyori.adventure.text.format.NamedTextColor import org.bukkit.plugin.java.JavaPlugin @Suppress("UnstableApiUsage") @@ -39,12 +37,12 @@ object CmdModule { val module = Pobutils.availableModules[moduleName] if (module == null) { - ctx.source.sender.sendMessage(Component.text("No module named '$moduleName'", NamedTextColor.RED)) + ctx.source.sender.sendRichMessage("No module named '$moduleName'") return@executes Command.SINGLE_SUCCESS } if (Pobutils.isEnabled(moduleName)) { - ctx.source.sender.sendMessage(Component.text("Module '$moduleName' is already enabled", NamedTextColor.RED)) + ctx.source.sender.sendRichMessage("Module '$moduleName' is already enabled") return@executes Command.SINGLE_SUCCESS } @@ -53,7 +51,7 @@ object CmdModule { plugin.config.set("modules.$moduleName", true) plugin.saveConfig() plugin.server.onlinePlayers.forEach { player -> player.updateCommands() } - ctx.source.sender.sendMessage(Component.text("Module '$moduleName' enabled", NamedTextColor.YELLOW)) + ctx.source.sender.sendRichMessage("Module '$moduleName' enabled") return@executes Command.SINGLE_SUCCESS }) @@ -71,12 +69,12 @@ object CmdModule { val module = Pobutils.availableModules[moduleName] if (module == null) { - ctx.source.sender.sendMessage(Component.text("No module named '$moduleName'", NamedTextColor.RED)) + ctx.source.sender.sendRichMessage("No module named '$moduleName'") return@executes Command.SINGLE_SUCCESS } if (!Pobutils.isEnabled(moduleName)) { - ctx.source.sender.sendMessage(Component.text("Module '$moduleName' is already disabled", NamedTextColor.RED)) + ctx.source.sender.sendRichMessage("Module '$moduleName' is already disabled") return@executes Command.SINGLE_SUCCESS } @@ -85,7 +83,7 @@ object CmdModule { plugin.config.set("modules.$moduleName", false) plugin.saveConfig() plugin.server.onlinePlayers.forEach { player -> player.updateCommands() } - ctx.source.sender.sendMessage(Component.text("Module '$moduleName' disabled", NamedTextColor.YELLOW)) + ctx.source.sender.sendRichMessage("Module '$moduleName' disabled") return@executes Command.SINGLE_SUCCESS }) @@ -103,18 +101,18 @@ object CmdModule { val module = Pobutils.availableModules[moduleName] if (module == null) { - ctx.source.sender.sendMessage(Component.text("No module named '$moduleName'", NamedTextColor.RED)) + ctx.source.sender.sendRichMessage("No module named '$moduleName'") return@executes Command.SINGLE_SUCCESS } if (!Pobutils.isEnabled(moduleName)) { - ctx.source.sender.sendMessage(Component.text("Module '$moduleName' is not currently enabled", NamedTextColor.RED)) + ctx.source.sender.sendRichMessage("Module '$moduleName' is not currently enabled") return@executes Command.SINGLE_SUCCESS } module.reload() plugin.server.onlinePlayers.forEach { player -> player.updateCommands() } - ctx.source.sender.sendMessage(Component.text("Module '$moduleName' reloaded", NamedTextColor.YELLOW)) + ctx.source.sender.sendRichMessage("Module '$moduleName' reloaded") return@executes Command.SINGLE_SUCCESS }) @@ -124,12 +122,8 @@ object CmdModule { val configCommand = Commands.literal("config") .executes { ctx -> for ((name, _) in Pobutils.availableModules) { - val enabledText = if (Pobutils.isEnabled(name)) - Component.text("enabled", NamedTextColor.GREEN) - else - Component.text("disabled", NamedTextColor.RED) - - ctx.source.sender.sendMessage(Component.text("$name: ", NamedTextColor.YELLOW).append(enabledText)) + val enabledText = if (Pobutils.isEnabled(name)) "enabled" else "disabled" + ctx.source.sender.sendRichMessage("$name: $enabledText") } return@executes Command.SINGLE_SUCCESS } diff --git a/src/main/kotlin/com/pobnellion/pobutils/modules/disableExplosions/CmdDisableExplosionsConfig.kt b/src/main/kotlin/com/pobnellion/pobutils/modules/disableExplosions/CmdDisableExplosionsConfig.kt index 1c9fffd..5110e3e 100644 --- a/src/main/kotlin/com/pobnellion/pobutils/modules/disableExplosions/CmdDisableExplosionsConfig.kt +++ b/src/main/kotlin/com/pobnellion/pobutils/modules/disableExplosions/CmdDisableExplosionsConfig.kt @@ -5,8 +5,6 @@ import com.mojang.brigadier.arguments.BoolArgumentType import com.mojang.brigadier.builder.LiteralArgumentBuilder import io.papermc.paper.command.brigadier.CommandSourceStack import io.papermc.paper.command.brigadier.Commands -import net.kyori.adventure.text.Component -import net.kyori.adventure.text.format.NamedTextColor import org.bukkit.plugin.java.JavaPlugin @Suppress("UnstableApiUsage") @@ -20,15 +18,12 @@ object CmdDisableExplosionsConfig { disableExplosions.igniteTnt = shouldIgniteTnt plugin.config.set("data.disableExplosions.igniteTnt", shouldIgniteTnt) plugin.saveConfig() - ctx.source.sender.sendMessage(Component.text("igniteTnt set to: $shouldIgniteTnt", NamedTextColor.YELLOW)) + ctx.source.sender.sendRichMessage("igniteTnt set to: $shouldIgniteTnt") return@executes Command.SINGLE_SUCCESS })) .executes { ctx -> ctx.source.sender.sendMessage("DisableExplosions config:") - - ctx.source.sender.sendMessage(Component.text("igniteTnt: ", NamedTextColor.YELLOW) - .append(Component.text(disableExplosions.igniteTnt.toString(), NamedTextColor.WHITE))) - + ctx.source.sender.sendRichMessage("igniteTnt: ${disableExplosions.igniteTnt}") return@executes Command.SINGLE_SUCCESS } } diff --git a/src/main/kotlin/com/pobnellion/pobutils/modules/formatChat/CmdFormatChatConfig.kt b/src/main/kotlin/com/pobnellion/pobutils/modules/formatChat/CmdFormatChatConfig.kt index 02c9df5..2c0749f 100644 --- a/src/main/kotlin/com/pobnellion/pobutils/modules/formatChat/CmdFormatChatConfig.kt +++ b/src/main/kotlin/com/pobnellion/pobutils/modules/formatChat/CmdFormatChatConfig.kt @@ -6,8 +6,6 @@ import com.mojang.brigadier.arguments.StringArgumentType import com.mojang.brigadier.builder.LiteralArgumentBuilder import io.papermc.paper.command.brigadier.CommandSourceStack import io.papermc.paper.command.brigadier.Commands -import net.kyori.adventure.text.Component -import net.kyori.adventure.text.format.NamedTextColor import org.bukkit.plugin.java.JavaPlugin @Suppress("UnstableApiUsage") @@ -21,7 +19,7 @@ object CmdFormatChatConfig { plugin.config.set("data.formatChat.serverAlias", alias) formatChat.serverAlias = alias plugin.saveConfig() - ctx.source.sender.sendMessage(Component.text("serverAlias set to: $alias", NamedTextColor.YELLOW)) + ctx.source.sender.sendRichMessage("serverAlias set to: $alias") return@executes Command.SINGLE_SUCCESS })) .then(Commands.literal("messageFormat") @@ -31,7 +29,7 @@ object CmdFormatChatConfig { plugin.config.set("data.formatChat.messageFormat", format) formatChat.messageFormat = format plugin.saveConfig() - ctx.source.sender.sendMessage(Component.text("messageFormat set to: $format", NamedTextColor.YELLOW)) + ctx.source.sender.sendRichMessage("messageFormat set to: $format") return@executes Command.SINGLE_SUCCESS })) .then(Commands.literal("formatMessageText") @@ -41,7 +39,7 @@ object CmdFormatChatConfig { plugin.config.set("data.formatChat.formatMessageText", shouldFormat) formatChat.formatMessageText = shouldFormat plugin.saveConfig() - ctx.source.sender.sendMessage(Component.text("formatMessageText set to: $shouldFormat", NamedTextColor.YELLOW)) + ctx.source.sender.sendRichMessage("formatMessageText set to: $shouldFormat") return@executes Command.SINGLE_SUCCESS })) .executes { ctx -> @@ -50,15 +48,9 @@ object CmdFormatChatConfig { val formatMessageText = plugin.config.getBoolean("data.formatChat.formatMessageText", true) ctx.source.sender.sendMessage("FormatChat config:") - - ctx.source.sender.sendMessage(Component.text("serverAlias: ", NamedTextColor.YELLOW) - .append(Component.text(serverAlias, NamedTextColor.WHITE))) - - ctx.source.sender.sendMessage(Component.text("messageFormat: ", NamedTextColor.YELLOW) - .append(Component.text(messageFormat, NamedTextColor.WHITE))) - - ctx.source.sender.sendMessage(Component.text("formatMessageText: ", NamedTextColor.YELLOW) - .append(Component.text(formatMessageText.toString(), NamedTextColor.WHITE))) + ctx.source.sender.sendRichMessage("serverAlias: $serverAlias") + ctx.source.sender.sendRichMessage("messageFormat: $messageFormat") + ctx.source.sender.sendRichMessage("formatMessageText: $formatMessageText") return@executes Command.SINGLE_SUCCESS } diff --git a/src/main/kotlin/com/pobnellion/pobutils/modules/portals/CmdPortal.kt b/src/main/kotlin/com/pobnellion/pobutils/modules/portals/CmdPortal.kt index 0e83fb6..aa23f05 100644 --- a/src/main/kotlin/com/pobnellion/pobutils/modules/portals/CmdPortal.kt +++ b/src/main/kotlin/com/pobnellion/pobutils/modules/portals/CmdPortal.kt @@ -9,8 +9,6 @@ import io.papermc.paper.command.brigadier.Commands import io.papermc.paper.command.brigadier.argument.ArgumentTypes import io.papermc.paper.command.brigadier.argument.resolvers.BlockPositionResolver import io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents -import net.kyori.adventure.text.Component -import net.kyori.adventure.text.format.NamedTextColor import org.bukkit.entity.Player import org.bukkit.plugin.java.JavaPlugin @@ -59,17 +57,17 @@ object CmdPortal { val location2 = ctx.getArgument("location2", BlockPositionResolver::class.java).resolve(ctx.source) if (!serverList.contains(destServer)) { - ctx.source.sender.sendMessage(Component.text("No server named $destServer", NamedTextColor.RED)) + ctx.source.sender.sendRichMessage("No server named $destServer") return@executes Command.SINGLE_SUCCESS } when (action) { - "add" if portals.exists(name) -> ctx.source.sender.sendMessage(Component.text("A portal called $name already exists!", NamedTextColor.RED)) - "update" if !portals.exists(name) -> ctx.source.sender.sendMessage(Component.text("No portal named $name!", NamedTextColor.RED)) + "add" if portals.exists(name) -> ctx.source.sender.sendRichMessage("A portal called $name already exists!") + "update" if !portals.exists(name) -> ctx.source.sender.sendRichMessage("No portal named $name!") else -> { portals.addOrUpdate(name, location1, location2, destServer) val actionVerb = if (action == "add") "Added" else "Updated" - ctx.source.sender.sendMessage(Component.text("$actionVerb portal '$name'", NamedTextColor.YELLOW)) + ctx.source.sender.sendRichMessage("$actionVerb portal '$name'") } } @@ -92,7 +90,7 @@ object CmdPortal { val name = StringArgumentType.getString(ctx, "portal") if (!portals.exists(name)) - ctx.source.sender.sendMessage(Component.text("No portal named $name!", NamedTextColor.RED)) + ctx.source.sender.sendRichMessage("No portal named $name!") else portals.remove(name) @@ -103,10 +101,10 @@ object CmdPortal { private fun listPortals(portals: Portals) : LiteralArgumentBuilder { return Commands.literal("list") .executes { ctx -> - ctx.source.sender.sendMessage(Component.text("There are ${portals.portals.count()} portals:", NamedTextColor.YELLOW)) + ctx.source.sender.sendRichMessage("There are ${portals.portals.count()} portals:") portals.portals.forEach { portal -> - ctx.source.sender.sendMessage(Component.text(portal.toString(), NamedTextColor.YELLOW)) + ctx.source.sender.sendRichMessage("$portal") } return@executes Command.SINGLE_SUCCESS diff --git a/src/main/kotlin/com/pobnellion/pobutils/modules/portals/Portals.kt b/src/main/kotlin/com/pobnellion/pobutils/modules/portals/Portals.kt index 372f359..a3d86bd 100644 --- a/src/main/kotlin/com/pobnellion/pobutils/modules/portals/Portals.kt +++ b/src/main/kotlin/com/pobnellion/pobutils/modules/portals/Portals.kt @@ -85,7 +85,7 @@ class Portals(plugin: JavaPlugin) : ModuleBase(plugin), Listener, PluginMessageL fun remove(name: String) { if (!portals.removeIf { portal -> portal.name == name }) - plugin.componentLogger.error("Failed to remove portal $name") + plugin.logger.severe("Failed to remove portal $name") updateConfig() } diff --git a/src/main/kotlin/com/pobnellion/pobutils/modules/snowballDamage/CmdSnowballDamageConfig.kt b/src/main/kotlin/com/pobnellion/pobutils/modules/snowballDamage/CmdSnowballDamageConfig.kt index 5ca5677..b3006d7 100644 --- a/src/main/kotlin/com/pobnellion/pobutils/modules/snowballDamage/CmdSnowballDamageConfig.kt +++ b/src/main/kotlin/com/pobnellion/pobutils/modules/snowballDamage/CmdSnowballDamageConfig.kt @@ -8,8 +8,6 @@ import io.papermc.paper.command.brigadier.CommandSourceStack import io.papermc.paper.command.brigadier.Commands import io.papermc.paper.command.brigadier.argument.ArgumentTypes import io.papermc.paper.registry.RegistryKey -import net.kyori.adventure.text.Component -import net.kyori.adventure.text.format.NamedTextColor import org.bukkit.NamespacedKey import org.bukkit.entity.EntityType import org.bukkit.plugin.java.JavaPlugin @@ -28,24 +26,15 @@ object CmdSnowballDamageConfig { plugin.config.set("data.snowballDamage.invertDamageList", invert) plugin.saveConfig() snowballDamage.invertDamageList = invert - - ctx.source.sender.sendMessage(Component.text("invertDamageList set to ", NamedTextColor.YELLOW) - .append(Component.text(invert.toString(), NamedTextColor.WHITE))) + ctx.source.sender.sendRichMessage("invertDamageList set to: $invert") return@executes Command.SINGLE_SUCCESS })) .executes { ctx -> ctx.source.sender.sendMessage("SnowballDamage config:") - - ctx.source.sender.sendMessage(Component.text("noClipList: ", NamedTextColor.YELLOW) - .append(Component.text(snowballDamage.noClipList.joinToString(", ") { entityType -> entityType.key.toString() }, NamedTextColor.WHITE))) - - ctx.source.sender.sendMessage(Component.text("damageList: ", NamedTextColor.YELLOW) - .append(Component.text(snowballDamage.damageList.joinToString(", ") { entityType -> entityType.key.toString() }, NamedTextColor.WHITE))) - - ctx.source.sender.sendMessage(Component.text("invertDamageList: ", NamedTextColor.YELLOW) - .append(Component.text(snowballDamage.invertDamageList.toString(), NamedTextColor.WHITE))) - + ctx.source.sender.sendRichMessage("noClipList: ${snowballDamage.noClipList.joinToString(", ") { entityType -> entityType.key.toString() }}") + ctx.source.sender.sendRichMessage("damageList: ${snowballDamage.damageList.joinToString(", ") { entityType -> entityType.key.toString() }}") + ctx.source.sender.sendRichMessage("invertDamageList: ${snowballDamage.invertDamageList}") return@executes Command.SINGLE_SUCCESS } } @@ -64,14 +53,14 @@ object CmdSnowballDamageConfig { } if (list.contains(entityType)) { - ctx.source.sender.sendMessage(Component.text("$listName already contains ${entityType.key}", NamedTextColor.RED)) + ctx.source.sender.sendRichMessage("$listName already contains ${entityType.key}") return@executes Command.SINGLE_SUCCESS } list.add(entityType) plugin.config.set("data.snowballDamage.$listName", list.map { type -> type.key.toString() }) plugin.saveConfig() - ctx.source.sender.sendMessage(Component.text("${entityType.key} added to $listName", NamedTextColor.YELLOW)) + ctx.source.sender.sendRichMessage("${entityType.key} added to $listName") return@executes Command.SINGLE_SUCCESS })) @@ -94,7 +83,7 @@ object CmdSnowballDamageConfig { val entityType = EntityType.fromName(key?.key) if (entityType == null) { - ctx.source.sender.sendMessage(Component.text("Unknown entity type: $entityTypeName", NamedTextColor.RED)) + ctx.source.sender.sendRichMessage("Unknown entity type: $entityTypeName") return@executes Command.SINGLE_SUCCESS } @@ -105,14 +94,14 @@ object CmdSnowballDamageConfig { } if (!list.contains(entityType)) { - ctx.source.sender.sendMessage(Component.text("$listName does not contain ${entityType.key}", NamedTextColor.RED)) + ctx.source.sender.sendRichMessage("$listName does not contain ${entityType.key}") return@executes Command.SINGLE_SUCCESS } list.remove(entityType) plugin.config.set("data.snowballDamage.$listName", list.map { type -> type.key.toString() }) plugin.saveConfig() - ctx.source.sender.sendMessage(Component.text("${entityType.key} removed from $listName", NamedTextColor.YELLOW)) + ctx.source.sender.sendRichMessage("${entityType.key} removed from $listName") return@executes Command.SINGLE_SUCCESS })) @@ -126,7 +115,7 @@ object CmdSnowballDamageConfig { "damageList" -> snowballDamage.damageList.clear() } - ctx.source.sender.sendMessage(Component.text("Cleared $listName", NamedTextColor.YELLOW)) + ctx.source.sender.sendRichMessage("Cleared $listName") return@executes Command.SINGLE_SUCCESS }) } diff --git a/src/main/kotlin/com/pobnellion/pobutils/modules/spawn/CmdSpawn.kt b/src/main/kotlin/com/pobnellion/pobutils/modules/spawn/CmdSpawn.kt index 9421e08..fa51cba 100644 --- a/src/main/kotlin/com/pobnellion/pobutils/modules/spawn/CmdSpawn.kt +++ b/src/main/kotlin/com/pobnellion/pobutils/modules/spawn/CmdSpawn.kt @@ -4,8 +4,6 @@ import com.mojang.brigadier.Command import com.pobnellion.pobutils.Pobutils import io.papermc.paper.command.brigadier.Commands import io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents -import net.kyori.adventure.text.Component -import net.kyori.adventure.text.format.NamedTextColor import org.bukkit.entity.Player import org.bukkit.plugin.java.JavaPlugin @@ -16,7 +14,7 @@ object CmdSpawn { .requires { source -> Pobutils.isEnabled(spawn.name) && source.sender is Player } .executes { ctx -> if (spawn.spawnLocation == null) - ctx.source.sender.sendMessage(Component.text("A spawn location has not been set", NamedTextColor.RED)) + ctx.source.sender.sendRichMessage("A spawn location has not been set") else (ctx.source.sender as Player).teleport(spawn.spawnLocation!!) diff --git a/src/main/kotlin/com/pobnellion/pobutils/modules/spawn/CmdSpawnConfig.kt b/src/main/kotlin/com/pobnellion/pobutils/modules/spawn/CmdSpawnConfig.kt index 438a203..6fe25f2 100644 --- a/src/main/kotlin/com/pobnellion/pobutils/modules/spawn/CmdSpawnConfig.kt +++ b/src/main/kotlin/com/pobnellion/pobutils/modules/spawn/CmdSpawnConfig.kt @@ -7,10 +7,7 @@ import com.mojang.brigadier.builder.LiteralArgumentBuilder import io.papermc.paper.command.brigadier.CommandSourceStack import io.papermc.paper.command.brigadier.Commands import io.papermc.paper.command.brigadier.argument.ArgumentTypes -import io.papermc.paper.command.brigadier.argument.resolvers.BlockPositionResolver import io.papermc.paper.command.brigadier.argument.resolvers.FinePositionResolver -import net.kyori.adventure.text.Component -import net.kyori.adventure.text.format.NamedTextColor import org.bukkit.entity.Player import org.bukkit.plugin.java.JavaPlugin @@ -24,16 +21,9 @@ object CmdSpawnConfig { .executes { ctx -> val location = plugin.config.getLocation("data.spawn.location") ctx.source.sender.sendMessage("Spawn config:") - - ctx.source.sender.sendMessage(Component.text("location: ", NamedTextColor.YELLOW) - .append(Component.text("${location?.x} ${location?.y} ${location?.z}", NamedTextColor.WHITE))) - - ctx.source.sender.sendMessage(Component.text("spawnOnJoin: ", NamedTextColor.YELLOW) - .append(Component.text(plugin.config.getString("data.spawn.spawnOnJoin").orEmpty(), NamedTextColor.WHITE))) - - ctx.source.sender.sendMessage(Component.text("spawnOnDeath: ", NamedTextColor.YELLOW) - .append(Component.text(plugin.config.getString("data.spawn.spawnOnDeath").orEmpty(), NamedTextColor.WHITE))) - + ctx.source.sender.sendRichMessage("location: ${location?.x} ${location?.y} ${location?.z}") + ctx.source.sender.sendRichMessage("spawnOnJoin: ${plugin.config.getString("data.spawn.spawnOnJoin").orEmpty()}") + ctx.source.sender.sendRichMessage("spawnOnDeath: ${plugin.config.getString("data.spawn.spawnOnDeath").orEmpty()}") return@executes Command.SINGLE_SUCCESS } } @@ -62,7 +52,7 @@ object CmdSpawnConfig { "south" -> location.yaw = 0f "west" -> location.yaw = 90f else -> { - ctx.source.sender.sendMessage(Component.text("Unknown direction: $direction", NamedTextColor.RED)) + ctx.source.sender.sendRichMessage("Unknown direction: $direction") return@executes Command.SINGLE_SUCCESS } } @@ -70,7 +60,7 @@ object CmdSpawnConfig { spawn.spawnLocation = location plugin.config.set("data.spawn.location", location) plugin.saveConfig() - ctx.source.sender.sendMessage(Component.text("Set spawn location to ${location.x} ${location.y} ${location.z}", NamedTextColor.YELLOW)) + ctx.source.sender.sendRichMessage("Set spawn location to ${location.x} ${location.y} ${location.z}") return@executes Command.SINGLE_SUCCESS })) } @@ -88,7 +78,7 @@ object CmdSpawnConfig { plugin.saveConfig() plugin.reloadConfig() - ctx.source.sender.sendMessage(Component.text("$variableName set to: $value", NamedTextColor.YELLOW)) + ctx.source.sender.sendRichMessage("$variableName set to: $value") return@executes Command.SINGLE_SUCCESS }) } diff --git a/src/main/kotlin/com/pobnellion/pobutils/modules/warp/CmdWarp.kt b/src/main/kotlin/com/pobnellion/pobutils/modules/warp/CmdWarp.kt index 3f27a19..7da01b4 100644 --- a/src/main/kotlin/com/pobnellion/pobutils/modules/warp/CmdWarp.kt +++ b/src/main/kotlin/com/pobnellion/pobutils/modules/warp/CmdWarp.kt @@ -5,8 +5,6 @@ import com.mojang.brigadier.arguments.StringArgumentType import com.pobnellion.pobutils.Pobutils import io.papermc.paper.command.brigadier.Commands import io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents -import net.kyori.adventure.text.Component -import net.kyori.adventure.text.format.NamedTextColor import org.bukkit.entity.Player import org.bukkit.plugin.java.JavaPlugin @@ -28,7 +26,7 @@ object CmdWarp { val warpLocation = warp.warps[warpName] if (warpLocation == null) - ctx.source.sender.sendMessage(Component.text("No warp named '$warpName'", NamedTextColor.RED)) + ctx.source.sender.sendRichMessage("No warp named '$warpName'") else (ctx.source.sender as Player).teleport(warpLocation) diff --git a/src/main/kotlin/com/pobnellion/pobutils/modules/warp/CmdWarpConfig.kt b/src/main/kotlin/com/pobnellion/pobutils/modules/warp/CmdWarpConfig.kt index 75b5a93..9b6b184 100644 --- a/src/main/kotlin/com/pobnellion/pobutils/modules/warp/CmdWarpConfig.kt +++ b/src/main/kotlin/com/pobnellion/pobutils/modules/warp/CmdWarpConfig.kt @@ -6,10 +6,7 @@ import com.mojang.brigadier.builder.LiteralArgumentBuilder import io.papermc.paper.command.brigadier.CommandSourceStack import io.papermc.paper.command.brigadier.Commands import io.papermc.paper.command.brigadier.argument.ArgumentTypes -import io.papermc.paper.command.brigadier.argument.resolvers.BlockPositionResolver import io.papermc.paper.command.brigadier.argument.resolvers.FinePositionResolver -import net.kyori.adventure.text.Component -import net.kyori.adventure.text.format.NamedTextColor import org.bukkit.entity.Player import org.bukkit.plugin.java.JavaPlugin @@ -31,9 +28,7 @@ object CmdWarpConfig { for (warpName in warpNames) { val location = plugin.config.getLocation("data.warps.$warpName")!! - - ctx.source.sender.sendMessage(Component.text("$warpName:", NamedTextColor.YELLOW) - .append(Component.text("${location.x} ${location.y} ${location.z}"))) + ctx.source.sender.sendRichMessage("$warpName: ${location.x} ${location.y} ${location.z}") } return@executes Command.SINGLE_SUCCESS @@ -50,16 +45,14 @@ object CmdWarpConfig { val location = position.toLocation((ctx.source.sender as Player).world) if (plugin.config.get("data.warps.$name") != null) { - ctx.source.sender.sendMessage(Component.text("A warp called $name already exists!", NamedTextColor.RED)) + ctx.source.sender.sendRichMessage("A warp called $name already exists!") return@executes Command.SINGLE_SUCCESS } plugin.config.set("data.warps.$name", location) plugin.saveConfig() - warp.warps[name] = location - - ctx.source.sender.sendMessage(Component.text("Created warp '$name'", NamedTextColor.YELLOW)) + ctx.source.sender.sendRichMessage("Created warp '$name'") return@executes Command.SINGLE_SUCCESS })) @@ -80,7 +73,7 @@ object CmdWarpConfig { val location = position.toLocation((ctx.source.sender as Player).world) if (plugin.config.get("data.warps.$name") == null) { - ctx.source.sender.sendMessage(Component.text("Could not find a warp called $name!", NamedTextColor.RED)) + ctx.source.sender.sendRichMessage("Could not find a warp called $name!") return@executes Command.SINGLE_SUCCESS } @@ -89,7 +82,7 @@ object CmdWarpConfig { warp.warps[name] = location - ctx.source.sender.sendMessage(Component.text("Updated warp '$name'", NamedTextColor.YELLOW)) + ctx.source.sender.sendRichMessage("Updated warp '$name'") return@executes Command.SINGLE_SUCCESS })) @@ -107,7 +100,7 @@ object CmdWarpConfig { val name = StringArgumentType.getString(ctx, "name") if (plugin.config.get("data.warps.$name") == null) { - ctx.source.sender.sendMessage(Component.text("Could not find a warp called $name!", NamedTextColor.RED)) + ctx.source.sender.sendRichMessage("Could not find a warp called $name!") return@executes Command.SINGLE_SUCCESS } @@ -115,8 +108,7 @@ object CmdWarpConfig { plugin.saveConfig() warp.warps.remove(name) - - ctx.source.sender.sendMessage(Component.text("Removed warp '$name'", NamedTextColor.YELLOW)) + ctx.source.sender.sendRichMessage("Removed warp '$name'") return@executes Command.SINGLE_SUCCESS })