-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2.0.0 - add setorder sub-command to game (it breaks compatibility bec…
…ause the game with old version will not work without leaving any errors)
- Loading branch information
1 parent
5f39ee3
commit 4b34732
Showing
11 changed files
with
83 additions
and
7 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
8 changes: 8 additions & 0 deletions
8
api/src/main/kotlin/xyz/acrylicstyle/dailyranking/api/game/SortOrder.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,8 @@ | ||
package xyz.acrylicstyle.dailyranking.api.game | ||
|
||
import java.util.UUID | ||
|
||
enum class SortOrder(val sorter: Comparator<Map.Entry<UUID, Int>>) { | ||
ASC({ a, b -> a.value - b.value }), | ||
DESC({ a, b -> b.value - a.value }), | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
group = "xyz.acrylicstyle.dailyrankingboard" | ||
version = "1.1.12" | ||
version = "2.0.0" | ||
|
||
plugins { | ||
java | ||
|
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
25 changes: 25 additions & 0 deletions
25
plugin/src/main/kotlin/xyz/acrylicstyle/dailyranking/plugin/argument/OrderArgument.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,25 @@ | ||
package xyz.acrylicstyle.dailyranking.plugin.argument | ||
|
||
import com.mojang.brigadier.arguments.StringArgumentType | ||
import com.mojang.brigadier.context.CommandContext | ||
import com.mojang.brigadier.exceptions.DynamicCommandExceptionType | ||
import com.mojang.brigadier.suggestion.Suggestions | ||
import com.mojang.brigadier.suggestion.SuggestionsBuilder | ||
import net.minecraft.server.v1_16_R3.ChatComponentText | ||
import net.minecraft.server.v1_16_R3.ICompletionProvider | ||
import xyz.acrylicstyle.dailyranking.api.game.SortOrder | ||
import java.util.concurrent.CompletableFuture | ||
|
||
object OrderArgument { | ||
private val INVALID_ORDER = DynamicCommandExceptionType { ChatComponentText("Unknown sort order: '$it'") } | ||
|
||
fun order(): StringArgumentType = StringArgumentType.word() | ||
|
||
fun get(context: CommandContext<*>, name: String): SortOrder = | ||
StringArgumentType.getString(context, name).let { s -> | ||
SortOrder.values().find { it.name == s } ?: throw INVALID_ORDER.create(s) | ||
} | ||
|
||
fun fillSuggestions(builder: SuggestionsBuilder): CompletableFuture<Suggestions> = | ||
ICompletionProvider.b(SortOrder.values().map { it.name }, builder) | ||
} |
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
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