Skip to content

Commit 5dff542

Browse files
committed
PermissionResolutionStrategy implemented.
Changed documentation since version format. Signed-off-by: Pavel Erokhin (MairwunNx) <MairwunNx@gmail.com>
1 parent c0f6e3a commit 5dff542

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+289
-234
lines changed

src/main/kotlin/com/mairwunnx/projectessentials/core/api/v1/InternalConstants.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,50 +4,50 @@ package com.mairwunnx.projectessentials.core.api.v1
44

55
/**
66
* Configuration processor loading index order.
7-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
7+
* @since 2.0.0-SNAPSHOT.1.
88
*/
99
const val CONFIGURATION_PROCESSOR_INDEX = 0u
1010

1111
/**
1212
* Module processor loading index order.
13-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
13+
* @since 2.0.0-SNAPSHOT.1.
1414
*/
1515
const val MODULE_PROCESSOR_INDEX = 1u
1616

1717
/**
1818
* Localization processor loading index order.
19-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
19+
* @since 2.0.0-SNAPSHOT.1.
2020
*/
2121
const val LOCALIZATION_PROCESSOR_INDEX = 2u
2222

2323
/**
2424
* Command processor loading index order.
25-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
25+
* @since 2.0.0-SNAPSHOT.1.
2626
*/
2727
const val COMMAND_PROCESSOR_INDEX = 3u
2828

2929
/**
3030
* Initial fall back language, uses before
3131
* configuration loading.
32-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
32+
* @since 2.0.0-SNAPSHOT.1.
3333
*/
3434
const val INITIAL_FALLBACK_LANGUAGE = "en_us"
3535

3636
/**
3737
* Prefix for localized messages for core module.
38-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
38+
* @since 2.0.0-SNAPSHOT.1.
3939
*/
4040
const val MESSAGE_CORE_PREFIX = "project_essentials_core"
4141

4242
/**
4343
* Prefix for localized messages for other modules.
44-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
44+
* @since 2.0.0-SNAPSHOT.1.
4545
*/
4646
const val MESSAGE_MODULE_PREFIX = "project_essentials_"
4747

4848
/**
4949
* Prefix for localized messages for main module (`Project Essentials`).
50-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
50+
* @since 2.0.0-SNAPSHOT.1.
5151
*/
5252
const val MESSAGE_MAIN_MODULE_PREFIX = "project_essentials"
5353

src/main/kotlin/com/mairwunnx/projectessentials/core/api/v1/commands/Command.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,26 @@ package com.mairwunnx.projectessentials.core.api.v1.commands
1515
* @param override override already registered command.
1616
* If value true then already registered command by
1717
* other mod will be replaced.
18-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
18+
* @since 2.0.0-SNAPSHOT.1.
1919
*/
2020

2121
@Target(AnnotationTarget.CLASS)
2222
annotation class Command(
2323
/**
2424
* Command name without `/`.
25-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
25+
* @since 2.0.0-SNAPSHOT.1.
2626
*/
2727
val name: String,
2828
/**
2929
* Command aliases as array.
30-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
30+
* @since 2.0.0-SNAPSHOT.1.
3131
*/
3232
val aliases: Array<String> = [],
3333
/**
3434
* Override already command. If value
3535
* true then already registered command by
3636
* other mod will be replaced.
37-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
37+
* @since 2.0.0-SNAPSHOT.1.
3838
*/
3939
val override: Boolean = false
4040
)

src/main/kotlin/com/mairwunnx/projectessentials/core/api/v1/commands/CommandAPI.kt

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import net.minecraft.entity.player.ServerPlayerEntity
1515

1616
/**
1717
* Class for interacting with command api.
18-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
18+
* @since 2.0.0-SNAPSHOT.1.
1919
*/
2020
object CommandAPI {
2121
private lateinit var registeredCommands: RootCommandNode<CommandSource>
@@ -27,7 +27,7 @@ object CommandAPI {
2727
* for removing command. Must be called before
2828
* any processor initializing.
2929
* @param dispatcher command dispatcher.
30-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
30+
* @since 2.0.0-SNAPSHOT.1.
3131
*/
3232
/*
3333
This is a crutch to replace vanilla commands,
@@ -45,7 +45,7 @@ object CommandAPI {
4545
/**
4646
* Assign dispatcher for command registering.
4747
* @param dispatcher command dispatcher.
48-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
48+
* @since 2.0.0-SNAPSHOT.1.
4949
*/
5050
fun assignDispatcher(
5151
dispatcher: CommandDispatcher<CommandSource>
@@ -58,19 +58,19 @@ object CommandAPI {
5858

5959
/**
6060
* @return server command dispatcher.
61-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
61+
* @since 2.0.0-SNAPSHOT.1.
6262
*/
6363
fun getDispatcher() = dispatcher
6464

6565
/**
6666
* @return true if dispatcher assigned.
67-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
67+
* @since 2.0.0-SNAPSHOT.1.
6868
*/
6969
fun isAssignedDispatcher() = dispatcherAssigned
7070

7171
/**
7272
* @return all installed and checked commands.
73-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
73+
* @since 2.0.0-SNAPSHOT.1.
7474
*/
7575
fun getAllCommands() = CommandProcessor.getCommands()
7676

@@ -79,7 +79,7 @@ object CommandAPI {
7979
* specified name.
8080
* @param command command name to remove without `/`.
8181
* @return true if command removed, false otherwise.
82-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
82+
* @since 2.0.0-SNAPSHOT.1.
8383
*/
8484
fun removeCommand(command: String): Boolean =
8585
registeredCommands.children.removeIf { it.name == command }
@@ -88,7 +88,7 @@ object CommandAPI {
8888
* @param context command context.
8989
* @param argumentName argument name.
9090
* @return true if string exist.
91-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
91+
* @since 2.0.0-SNAPSHOT.1.
9292
*/
9393
fun getStringExisting(
9494
context: CommandContext<CommandSource>,
@@ -104,7 +104,7 @@ object CommandAPI {
104104
* @param context command context.
105105
* @param argumentName argument name.
106106
* @return string from command.
107-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
107+
* @since 2.0.0-SNAPSHOT.1.
108108
*/
109109
fun getString(
110110
context: CommandContext<CommandSource>,
@@ -115,7 +115,7 @@ object CommandAPI {
115115
* @param context command context.
116116
* @param argumentName argument name.
117117
* @return true if int exist.
118-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
118+
* @since 2.0.0-SNAPSHOT.1.
119119
*/
120120
fun getIntExisting(
121121
context: CommandContext<CommandSource>,
@@ -131,7 +131,7 @@ object CommandAPI {
131131
* @param context command context.
132132
* @param argumentName argument name.
133133
* @return int from command.
134-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
134+
* @since 2.0.0-SNAPSHOT.1.
135135
*/
136136
fun getInt(
137137
context: CommandContext<CommandSource>,
@@ -142,7 +142,7 @@ object CommandAPI {
142142
* @param context command context.
143143
* @param argumentName argument name.
144144
* @return true if bool exist.
145-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
145+
* @since 2.0.0-SNAPSHOT.1.
146146
*/
147147
fun getBoolExisting(
148148
context: CommandContext<CommandSource>,
@@ -158,7 +158,7 @@ object CommandAPI {
158158
* @param context command context.
159159
* @param argumentName argument name.
160160
* @return bool from command.
161-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
161+
* @since 2.0.0-SNAPSHOT.1.
162162
*/
163163
fun getBool(
164164
context: CommandContext<CommandSource>,
@@ -169,7 +169,7 @@ object CommandAPI {
169169
* @param context command context.
170170
* @param argumentName argument name.
171171
* @return true if entity exist.
172-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
172+
* @since 2.0.0-SNAPSHOT.1.
173173
*/
174174
fun getEntityExisting(
175175
context: CommandContext<CommandSource>,
@@ -185,7 +185,7 @@ object CommandAPI {
185185
* @param context command context.
186186
* @param argumentName argument name.
187187
* @return entity from command.
188-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
188+
* @since 2.0.0-SNAPSHOT.1.
189189
*/
190190
fun getEntity(
191191
context: CommandContext<CommandSource>,
@@ -196,7 +196,7 @@ object CommandAPI {
196196
* @param context command context.
197197
* @param argumentName argument name.
198198
* @return true if entities exist.
199-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
199+
* @since 2.0.0-SNAPSHOT.1.
200200
*/
201201
fun getEntitiesExisting(
202202
context: CommandContext<CommandSource>,
@@ -212,7 +212,7 @@ object CommandAPI {
212212
* @param context command context.
213213
* @param argumentName argument name.
214214
* @return entities from command.
215-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
215+
* @since 2.0.0-SNAPSHOT.1.
216216
*/
217217
fun getEntities(
218218
context: CommandContext<CommandSource>,
@@ -223,7 +223,7 @@ object CommandAPI {
223223
* @param context command context.
224224
* @param argumentName argument name.
225225
* @return true if player exist.
226-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
226+
* @since 2.0.0-SNAPSHOT.1.
227227
*/
228228
fun getPlayerExisting(
229229
context: CommandContext<CommandSource>,
@@ -239,7 +239,7 @@ object CommandAPI {
239239
* @param context command context.
240240
* @param argumentName argument name.
241241
* @return player from command.
242-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
242+
* @since 2.0.0-SNAPSHOT.1.
243243
*/
244244
fun getPlayer(
245245
context: CommandContext<CommandSource>,
@@ -250,7 +250,7 @@ object CommandAPI {
250250
* @param context command context.
251251
* @param argumentName argument name.
252252
* @return true if players exist.
253-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
253+
* @since 2.0.0-SNAPSHOT.1.
254254
*/
255255
fun getPlayersExisting(
256256
context: CommandContext<CommandSource>,
@@ -266,7 +266,7 @@ object CommandAPI {
266266
* @param context command context.
267267
* @param argumentName argument name.
268268
* @return players from command.
269-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
269+
* @since 2.0.0-SNAPSHOT.1.
270270
*/
271271
fun getPlayers(
272272
context: CommandContext<CommandSource>,

src/main/kotlin/com/mairwunnx/projectessentials/core/api/v1/commands/CommandBase.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ import org.apache.logging.log4j.MarkerManager
1414
/**
1515
* Base abstract class for commands. Has common
1616
* logic for registering commands.
17-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
17+
* @since 2.0.0-SNAPSHOT.1.
1818
*/
1919
abstract class CommandBase(
2020
/**
2121
* Command literal for working with command.
22-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
22+
* @since 2.0.0-SNAPSHOT.1.
2323
*/
2424
var literal: LiteralArgumentBuilder<CommandSource>,
2525
/**
2626
* If value true then action for command will added
2727
* automatically with reference on method [process].
28-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
28+
* @since 2.0.0-SNAPSHOT.1.
2929
*/
3030
val actionNeed: Boolean = true
3131
) : ICommand {
@@ -35,14 +35,14 @@ abstract class CommandBase(
3535
/**
3636
* Command data, stores data of `Command`
3737
* annotation type.
38-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
38+
* @since 2.0.0-SNAPSHOT.1.
3939
*/
4040
lateinit var data: Command
4141

4242
/**
4343
* Initializing command. For this case, just
4444
* remove already registered command if needed.
45-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
45+
* @since 2.0.0-SNAPSHOT.1.
4646
*/
4747
override fun initialize() {
4848
if (data.override) CommandAPI.removeCommand(data.name)
@@ -51,7 +51,7 @@ abstract class CommandBase(
5151
/**
5252
* Register command.
5353
* @param dispatcher command dispatcher.
54-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
54+
* @since 2.0.0-SNAPSHOT.1.
5555
*/
5656
override fun register(dispatcher: CommandDispatcher<CommandSource>) {
5757
if (ModuleAPI.isModuleExist("cooldown")) {
@@ -75,7 +75,7 @@ abstract class CommandBase(
7575
* Process command, i.e execute command.
7676
* @param context command context.
7777
* @return int. Command execution result.
78-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
78+
* @since 2.0.0-SNAPSHOT.1.
7979
*/
8080
override fun process(context: CommandContext<CommandSource>): Int {
8181
logger.debug(
@@ -87,7 +87,7 @@ abstract class CommandBase(
8787
/**
8888
* @param clazz from what need take data.
8989
* @return Command annotation data class.
90-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
90+
* @since 2.0.0-SNAPSHOT.1.
9191
*/
9292
override fun getData(clazz: Class<*>): Command = clazz.getAnnotation(Command::class.java)
9393
}

src/main/kotlin/com/mairwunnx/projectessentials/core/api/v1/commands/ICommand.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,34 @@ import net.minecraft.command.CommandSource
66

77
/**
88
* Base interface for all command classes.
9-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
9+
* @since 2.0.0-SNAPSHOT.1.
1010
*/
1111
interface ICommand {
1212
/**
1313
* Initialize command, assign data and other.
14-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
14+
* @since 2.0.0-SNAPSHOT.1.
1515
*/
1616
fun initialize()
1717

1818
/**
1919
* Register command.
2020
* @param dispatcher command dispatcher.
21-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
21+
* @since 2.0.0-SNAPSHOT.1.
2222
*/
2323
fun register(dispatcher: CommandDispatcher<CommandSource>)
2424

2525
/**
2626
* Process command, i.e execute command.
2727
* @param context command context.
2828
* @return int. Command execution result.
29-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
29+
* @since 2.0.0-SNAPSHOT.1.
3030
*/
3131
fun process(context: CommandContext<CommandSource>): Int
3232

3333
/**
3434
* @param clazz from what need take data.
3535
* @return Command annotation data class.
36-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
36+
* @since 2.0.0-SNAPSHOT.1.
3737
*/
3838
fun getData(clazz: Class<*>): Command
3939
}

0 commit comments

Comments
 (0)