Skip to content

Commit

Permalink
force rtp command
Browse files Browse the repository at this point in the history
  • Loading branch information
makeevrserg committed Sep 10, 2023
1 parent ac7a8a0 commit 0fc7559
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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|[email protected]
makeevrserg.project.url=https://empireprojekt.ru
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class CommandManager(module: CommandsModule) : CommandsModule by module {
maxOnline()
tellChat()
rtp()
rtpBypassed()
adminPrivate()
adminPrivateCompleter()
menuCompleter()
Expand Down
19 changes: 19 additions & 0 deletions plugin/src/main/kotlin/ru/astrainteractive/aspekt/command/Rtp.kt
Original file line number Diff line number Diff line change
@@ -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)
}
}
3 changes: 2 additions & 1 deletion plugin/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 0fc7559

Please sign in to comment.