Skip to content

Commit

Permalink
Add version check for brigadier register event
Browse files Browse the repository at this point in the history
  • Loading branch information
Syrent committed Nov 17, 2023
1 parent 7ca158c commit 3f5903c
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import cloud.commandframework.paper.PaperCommandManager
import ir.syrent.velocityvanish.spigot.command.library.interfaces.ICommand
import ir.syrent.velocityvanish.spigot.command.library.interfaces.ISender
import ir.syrent.velocityvanish.spigot.ruom.Ruom
import ir.syrent.velocityvanish.spigot.utils.ServerVersion
import ir.syrent.velocityvanish.utils.component
import net.kyori.adventure.platform.bukkit.BukkitAudiences
import net.kyori.adventure.text.Component
Expand Down Expand Up @@ -48,10 +49,14 @@ abstract class Command(
Ruom.warn("Failed to enable asynchronous command completions.")
}

try {
manager.registerBrigadier()
} catch (_: BrigadierFailureException) {
Ruom.warn("Failed to enable mojang brigadier commands.")
if (ServerVersion.supports(13)) {
try {
manager.registerBrigadier()
} catch (_: BrigadierFailureException) {
Ruom.warn("Failed to enable mojang brigadier commands.")
}
} else {
Ruom.warn("Ignore mojang brigadier commands, your server version doesn't support this feature!")
}

MinecraftExceptionHandler<ISender>()
Expand Down

0 comments on commit 3f5903c

Please sign in to comment.