mirror of
https://github.com/GayPizzaSpecifications/foundation.git
synced 2025-08-03 13:31:32 +00:00
Add /setspawn and /spawn.
This commit is contained in:
@ -62,7 +62,9 @@ class FoundationCorePlugin : JavaPlugin(), Listener {
|
|||||||
registerCommandExecutor(listOf("adventure", "a"), GamemodeCommand(GameMode.ADVENTURE))
|
registerCommandExecutor(listOf("adventure", "a"), GamemodeCommand(GameMode.ADVENTURE))
|
||||||
registerCommandExecutor(listOf("spectator", "sp"), GamemodeCommand(GameMode.SPECTATOR))
|
registerCommandExecutor(listOf("spectator", "sp"), GamemodeCommand(GameMode.SPECTATOR))
|
||||||
registerCommandExecutor(listOf("leaderboard", "lb"), LeaderboardCommand())
|
registerCommandExecutor(listOf("leaderboard", "lb"), LeaderboardCommand())
|
||||||
registerCommandExecutor(listOf("pstore"), PersistentStoreCommand(this))
|
registerCommandExecutor("pstore", PersistentStoreCommand(this))
|
||||||
|
registerCommandExecutor("setspawn", SetSpawnCommand())
|
||||||
|
registerCommandExecutor("spawn", SpawnCommand())
|
||||||
|
|
||||||
val log = slF4JLogger
|
val log = slF4JLogger
|
||||||
log.info("Features:")
|
log.info("Features:")
|
||||||
|
@ -0,0 +1,27 @@
|
|||||||
|
package cloud.kubelet.foundation.core.command
|
||||||
|
|
||||||
|
import org.bukkit.command.Command
|
||||||
|
import org.bukkit.command.CommandExecutor
|
||||||
|
import org.bukkit.command.CommandSender
|
||||||
|
import org.bukkit.entity.Player
|
||||||
|
|
||||||
|
class SetSpawnCommand : CommandExecutor {
|
||||||
|
override fun onCommand(
|
||||||
|
sender: CommandSender,
|
||||||
|
command: Command,
|
||||||
|
label: String,
|
||||||
|
args: Array<out String>
|
||||||
|
): Boolean {
|
||||||
|
if (sender !is Player) {
|
||||||
|
sender.sendMessage("You are not a player.")
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
val loc = sender.location
|
||||||
|
sender.world.setSpawnLocation(loc.blockX, loc.blockY, loc.blockZ)
|
||||||
|
|
||||||
|
sender.sendMessage("World spawn point set.")
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
package cloud.kubelet.foundation.core.command
|
||||||
|
|
||||||
|
import org.bukkit.command.Command
|
||||||
|
import org.bukkit.command.CommandExecutor
|
||||||
|
import org.bukkit.command.CommandSender
|
||||||
|
import org.bukkit.entity.Player
|
||||||
|
|
||||||
|
class SpawnCommand : CommandExecutor {
|
||||||
|
override fun onCommand(
|
||||||
|
sender: CommandSender,
|
||||||
|
command: Command,
|
||||||
|
label: String,
|
||||||
|
args: Array<out String>
|
||||||
|
): Boolean {
|
||||||
|
if (sender !is Player) {
|
||||||
|
sender.sendMessage("You are not a player.")
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
sender.teleport(sender.world.spawnLocation)
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
@ -49,3 +49,11 @@ commands:
|
|||||||
description: Persistent Store Manager
|
description: Persistent Store Manager
|
||||||
usage: /pstore
|
usage: /pstore
|
||||||
permission: foundation.command.pstore
|
permission: foundation.command.pstore
|
||||||
|
setspawn:
|
||||||
|
description: Set the spawn of the current world.
|
||||||
|
usage: /setspawn
|
||||||
|
permission: foundation.command.setspawn
|
||||||
|
spawn:
|
||||||
|
description: Teleport to the spawn of the current world.
|
||||||
|
usage: /spawn
|
||||||
|
permission: foundation.command.spawn
|
||||||
|
Reference in New Issue
Block a user