mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2025-02-16 20:41:59 +01:00
Add bed command
This commit is contained in:
parent
c6baeea5f9
commit
c0b36fefd8
@ -0,0 +1,34 @@
|
||||
package com.onarandombox.MultiverseCore.commands_acf;
|
||||
|
||||
import co.aikar.commands.annotation.CommandAlias;
|
||||
import co.aikar.commands.annotation.CommandPermission;
|
||||
import co.aikar.commands.annotation.Description;
|
||||
import co.aikar.commands.annotation.Flags;
|
||||
import co.aikar.commands.annotation.Subcommand;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@CommandAlias("mv")
|
||||
public class BedCommand extends MultiverseCommand {
|
||||
|
||||
public BedCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Subcommand("bed")
|
||||
@CommandPermission("multiverse.core.bed")
|
||||
@Description("Takes your current respawn point.")
|
||||
public void onBedCommand(@NotNull @Flags("onlyself") Player player) {
|
||||
Location bedLocation = player.getBedSpawnLocation();
|
||||
if (bedLocation == null) {
|
||||
player.sendMessage("You do have a respawn point set!");
|
||||
return;
|
||||
}
|
||||
player.sendMessage((player.teleport(bedLocation))
|
||||
? "You have been teleported to your respawn point!"
|
||||
: ChatColor.RED + "There was an error teleporting you to your respawn point.");
|
||||
}
|
||||
}
|
@ -10,6 +10,7 @@ import co.aikar.commands.ConditionFailedException;
|
||||
import co.aikar.commands.PaperCommandManager;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
||||
import com.onarandombox.MultiverseCore.commands_acf.BedCommand;
|
||||
import com.onarandombox.MultiverseCore.commands_acf.CheckCommand;
|
||||
import com.onarandombox.MultiverseCore.commands_acf.CloneCommand;
|
||||
import com.onarandombox.MultiverseCore.commands_acf.ConfigCommand;
|
||||
@ -100,6 +101,7 @@ public class MVCommandManager extends PaperCommandManager {
|
||||
registerCommand(new SetSpawnCommand(plugin));
|
||||
registerCommand(new ModifyCommand(plugin));
|
||||
registerCommand(new VersionCommand(plugin));
|
||||
registerCommand(new BedCommand(plugin));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user