-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #121 from SpigotBasics/command-factory
Added CommandFactory, refactored command registration
- Loading branch information
Showing
67 changed files
with
776 additions
and
241 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
core/src/main/kotlin/com/github/spigotbasics/core/command/BasicsCommandContextHandler.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
core/src/main/kotlin/com/github/spigotbasics/core/command/BasicsCommandExecutor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 0 additions & 5 deletions
5
core/src/main/kotlin/com/github/spigotbasics/core/command/BasicsTabCompleter.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
core/src/main/kotlin/com/github/spigotbasics/core/command/CommandResult.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
core/src/main/kotlin/com/github/spigotbasics/core/command/factory/CommandFactory.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.github.spigotbasics.core.command.factory | ||
|
||
import com.github.spigotbasics.core.command.BasicsCommandManager | ||
import com.github.spigotbasics.core.messages.CoreMessages | ||
import com.github.spigotbasics.core.messages.MessageFactory | ||
import org.bukkit.permissions.Permission | ||
|
||
class CommandFactory( | ||
private val messageFactory: MessageFactory, | ||
private val coreMessages: CoreMessages, | ||
private val commandManager: BasicsCommandManager, | ||
) { | ||
fun rawCommandBuilder( | ||
name: String, | ||
permission: Permission, | ||
): RawCommandBuilder { | ||
return RawCommandBuilder( | ||
messageFactory = messageFactory, | ||
coreMessages = coreMessages, | ||
commandManager = commandManager, | ||
name = name, | ||
permission = permission, | ||
) | ||
} | ||
|
||
fun parsedCommandBuilder( | ||
name: String, | ||
permission: Permission, | ||
): ParsedCommandBuilderFactory { | ||
return ParsedCommandBuilderFactory( | ||
messageFactory = messageFactory, | ||
coreMessages = coreMessages, | ||
commandManager = commandManager, | ||
name = name, | ||
permission = permission, | ||
) | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
...c/main/kotlin/com/github/spigotbasics/core/command/factory/ParsedCommandBuilderFactory.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.github.spigotbasics.core.command.factory | ||
|
||
import com.github.spigotbasics.core.command.BasicsCommandManager | ||
import com.github.spigotbasics.core.command.ParsedCommandBuilder | ||
import com.github.spigotbasics.core.command.parsed.MapCommandContext | ||
import com.github.spigotbasics.core.command.parsed.ParsedCommandContext | ||
import com.github.spigotbasics.core.messages.CoreMessages | ||
import com.github.spigotbasics.core.messages.MessageFactory | ||
import org.bukkit.permissions.Permission | ||
|
||
class ParsedCommandBuilderFactory( | ||
private val messageFactory: MessageFactory, | ||
private val coreMessages: CoreMessages, | ||
private val commandManager: BasicsCommandManager, | ||
private val name: String, | ||
private val permission: Permission, | ||
) { | ||
fun <T : ParsedCommandContext> context(): ParsedCommandBuilder<T> { | ||
return ParsedCommandBuilder( | ||
messageFactory = messageFactory, | ||
coreMessages = coreMessages, | ||
commandManager = commandManager, | ||
name = name, | ||
permission = permission, | ||
) | ||
} | ||
|
||
fun mapContext(): ParsedCommandBuilder<MapCommandContext> { | ||
return ParsedCommandBuilder( | ||
messageFactory = messageFactory, | ||
coreMessages = coreMessages, | ||
commandManager = commandManager, | ||
name = name, | ||
permission = permission, | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.