diff --git a/gradle.properties b/gradle.properties index 681399f..ce6b310 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ makeevrserg.java.ktarget=17 # Project makeevrserg.project.name=AspeKt makeevrserg.project.group=ru.astrainteractive.aspekt -makeevrserg.project.version.string=2.6.4 +makeevrserg.project.version.string=2.6.5 makeevrserg.project.description=Essentials plugin for EmpireProjekt makeevrserg.project.developers=makeevrserg|Makeev Roman|makeevrserg@gmail.com makeevrserg.project.url=https://empireprojekt.ru diff --git a/plugin/src/main/kotlin/ru/astrainteractive/aspekt/command/CommandManager.kt b/plugin/src/main/kotlin/ru/astrainteractive/aspekt/command/CommandManager.kt index 59b2a86..92800d0 100644 --- a/plugin/src/main/kotlin/ru/astrainteractive/aspekt/command/CommandManager.kt +++ b/plugin/src/main/kotlin/ru/astrainteractive/aspekt/command/CommandManager.kt @@ -12,6 +12,7 @@ class CommandManager(module: CommandsModule) : CommandsModule by module { maxOnline() tellChat() rtp() + rtpBypassed() adminPrivate() adminPrivateCompleter() menuCompleter() diff --git a/plugin/src/main/kotlin/ru/astrainteractive/aspekt/command/Rtp.kt b/plugin/src/main/kotlin/ru/astrainteractive/aspekt/command/Rtp.kt index 4692ca3..7e867e6 100644 --- a/plugin/src/main/kotlin/ru/astrainteractive/aspekt/command/Rtp.kt +++ b/plugin/src/main/kotlin/ru/astrainteractive/aspekt/command/Rtp.kt @@ -1,8 +1,27 @@ package ru.astrainteractive.aspekt.command +import com.earth2me.essentials.Essentials +import com.earth2me.essentials.RandomTeleport +import org.bukkit.Bukkit import ru.astrainteractive.astralibs.commands.registerCommand +import ru.astrainteractive.astralibs.commands.types.PrimitiveArgumentType import ru.astrainteractive.astralibs.utils.hex fun CommandManager.rtp() = plugin.registerCommand("rtp") { sender.sendMessage("#db2c18Возможно, вы хотели ввести /tpr".hex()) } + +fun CommandManager.rtpBypassed() = plugin.registerCommand("rtpbypass") { + val playerName = argument(0, PrimitiveArgumentType.String).resultOrNull() ?: return@registerCommand + val player = Bukkit.getPlayer(playerName) ?: return@registerCommand + val essentials = Bukkit.getPluginManager().getPlugin("Essentials") as Essentials + val randomTeleport = RandomTeleport(essentials) + val completable = randomTeleport.getRandomLocation( + randomTeleport.center, + randomTeleport.minRange, + randomTeleport.maxRange + ) + completable.whenComplete { location, _ -> + player.teleport(location) + } +} diff --git a/plugin/src/main/resources/plugin.yml b/plugin/src/main/resources/plugin.yml index 47d006c..b6cd0dc 100644 --- a/plugin/src/main/resources/plugin.yml +++ b/plugin/src/main/resources/plugin.yml @@ -7,11 +7,12 @@ authors: [ "${authors}" ] author: "${author}" website: "${url}" api-version: 1.18 -softdepend: [ DiscordSRV, LuckPerms, Vault ] +softdepend: [ DiscordSRV, LuckPerms, Vault, Esssentials ] depend: [ ] loadbefore: [ ] #libraries: [ "${libraries}" ] commands: + rtpbypass: sit: tellchat: rtp: