Skip to content

Commit

Permalink
refactor: more minor renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
Boy0000 committed Feb 5, 2024
1 parent 94418fb commit c05d37c
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 19 deletions.
2 changes: 1 addition & 1 deletion oraxenlibs-catalog/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ catalog {
val id = name.removeSuffix(".gradle.kts")
plugin(id.removePrefix("com.boy0000.conventions").prefixIfNot("boy"), id).version(version.toString())
}
// Add all idofront projects to the catalog
// Add all oraxenlibs projects to the catalog
rootProject.file(".").list()?.filter { it.startsWith("oraxenlibs") }?.forEach { name ->
library(name, "com.boy0000:$name:$version")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import com.boy0000.oraxenlibs.commands.children.ChildSharing
import com.boy0000.oraxenlibs.commands.children.ChildSharingManager
import com.boy0000.oraxenlibs.commands.children.CommandCreating
import com.boy0000.oraxenlibs.commands.execution.CommandExecutionFailedException
import com.boy0000.oraxenlibs.commands.execution.IdofrontCommandExecutor
import com.boy0000.oraxenlibs.execution.OraxenLibsCommandExecutor
import com.boy0000.oraxenlibs.messaging.error
import org.bukkit.command.CommandSender
import org.bukkit.command.TabCompleter
Expand All @@ -18,14 +18,14 @@ import org.bukkit.plugin.java.JavaPlugin
// and a list of top level commands needs to exist to be registered with plugin.getCommand.setExecutor.
/**
* A class for holding a list of top level commands. One instance is created during plugin startup through
* [IdofrontCommandExecutor.commands].
* [OraxenLibsCommandExecutor.commands].
*
* The class itself is accessed in [IdofrontCommandExecutor.onCommand], which will find the applicable command and
* The class itself is accessed in [OraxenLibsCommandExecutor.onCommand], which will find the applicable command and
* [execute] a new instance of it with the sender and their arguments.
*/
class CommandDSLEntrypoint(
private val plugin: JavaPlugin,
private val commandExecutor: IdofrontCommandExecutor
private val commandExecutor: OraxenLibsCommandExecutor
) : CommandDSLElement,
ChildSharing by ChildSharingManager(),
CommandCreating {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.boy0000.oraxenlibs.commands.execution
package com.boy0000.oraxenlibs.execution

import com.boy0000.oraxenlibs.commands.entrypoint.CommandDSLEntrypoint
import org.bukkit.command.Command
Expand All @@ -9,7 +9,7 @@ import org.bukkit.plugin.java.JavaPlugin
/**
* Manages linking spigot's [CommandExecutor.onCommand] events to a [CommandDSLEntrypoint] inside
*/
abstract class IdofrontCommandExecutor : CommandExecutor {
abstract class OraxenLibsCommandExecutor : CommandExecutor {
abstract val commands: CommandDSLEntrypoint

/** Gets the command or send the player a message if it isn't found */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package com.boy0000.oraxenlibs.config

import kotlinx.serialization.serializer
import org.bukkit.plugin.Plugin
import java.nio.file.Path

typealias IdofrontConfig<T> = Config<T>
typealias IdofrontFormat = Format
typealias IdofrontConfigFormats = ConfigFormats
typealias OraxenLibsConfig<T> = Config<T>
typealias OraxenLibsFormat = Format
typealias OraxenLibsConfigFormat = ConfigFormats

inline fun <reified T> config(
name: String,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.boy0000.oraxenlibs.features

import com.boy0000.oraxenlibs.config.IdofrontConfig
import com.boy0000.oraxenlibs.config.OraxenLibsConfig

interface Configurable<T> {
val configManager: IdofrontConfig<T>
val configManager: OraxenLibsConfig<T>
val config: T get() = configManager.getOrLoad()
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.boy0000.oraxenlibs.features

import com.boy0000.oraxenlibs.commands.arguments.optionArg
import com.boy0000.oraxenlibs.commands.execution.IdofrontCommandExecutor
import com.boy0000.oraxenlibs.execution.OraxenLibsCommandExecutor
import com.boy0000.oraxenlibs.messaging.error
import com.boy0000.oraxenlibs.messaging.logError
import com.boy0000.oraxenlibs.messaging.logSuccess
Expand All @@ -14,8 +14,8 @@ import org.bukkit.command.TabCompleter
abstract class FeatureManager<T : FeatureDSL>(
createContext: () -> T,
) : FeatureWithContext<T>(createContext) {
val commandExecutor: IdofrontCommandExecutor by lazy {
object : IdofrontCommandExecutor(), TabCompleter {
val commandExecutor: OraxenLibsCommandExecutor by lazy {
object : OraxenLibsCommandExecutor(), TabCompleter {
override val commands = commands(context.plugin) {
context.mainCommandProvider(this) {
mainCommandExtras.forEach { it() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ private val mm = MiniMessage.miniMessage()
private val plainComponentSerializer = PlainTextComponentSerializer.plainText()

/** Parses this String to a [Component] with MiniMessage and an optional TagResolver */
fun String.miniMsg(tagResolver: TagResolver = IdofrontTextComponents.globalResolver): Component =
fun String.miniMsg(tagResolver: TagResolver = OraxenTextComponents.globalResolver): Component =
mm.deserialize(this, tagResolver)

/** Serializes this [Component] to a String with MiniMessage */
Expand All @@ -19,5 +19,5 @@ fun Component.serialize(): String = mm.serialize(this)
fun Component.toPlainText(): String = plainComponentSerializer.serialize(this)

/** Removes all supported tags from a string, with an optional TagResolver input */
fun String.stripTags(tagResolver: TagResolver = IdofrontTextComponents.globalResolver): String =
fun String.stripTags(tagResolver: TagResolver = OraxenTextComponents.globalResolver): String =
mm.stripTags(this, tagResolver)
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.boy0000.oraxenlibs.textcomponents

import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver

object IdofrontTextComponents {
object OraxenTextComponents {
private val resolvers = mutableListOf(TagResolver.standard())
var globalResolver = TagResolver.resolver(resolvers)
private set
Expand Down

0 comments on commit c05d37c

Please sign in to comment.