Add bed command

This commit is contained in:
benwoo1110 2020-12-20 09:19:37 +08:00
parent c6baeea5f9
commit c0b36fefd8
2 changed files with 36 additions and 0 deletions

View File

@ -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.");
}
}

View File

@ -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