Fix teleport and set spawn command.

This commit is contained in:
benwoo1110 2020-12-19 23:38:32 +08:00
parent 7b2a14c31f
commit 28304baa6e
2 changed files with 48 additions and 34 deletions

View File

@ -1,5 +1,6 @@
package com.onarandombox.MultiverseCore.commands_acf;
import co.aikar.commands.BaseCommand;
import co.aikar.commands.annotation.CommandAlias;
import co.aikar.commands.annotation.CommandCompletion;
import co.aikar.commands.annotation.CommandPermission;
@ -24,29 +25,35 @@ public class SetSpawnCommand extends MultiverseCommand {
super(plugin);
}
//TODO: For some reason this doesnt work with coord args.
@CommandAlias("mvsetspawn")
@CommandPermission("multiverse.core.spawn.set")
@Syntax("[world x y z [yaw pitch]]")
@CommandCompletion("@MVWorlds")
@Description("Sets the spawn for the current world.")
public void onAliasSetSpawnCommand(@NotNull CommandSender sender,
@NotNull @Flags("other,defaultself,fallbackself") Location location) {
@CommandAlias("mv")
public class SetSpawn extends BaseCommand {
doSpawnSet(sender, location);
@Subcommand("setspawn")
@CommandPermission("multiverse.core.spawn.set")
@Syntax("[world x y z [yaw pitch]]")
//TODO: Location tab complete doesnt work.
@CommandCompletion("@MVWorlds")
@Description("Sets the spawn for the current world.")
public void onSetSpawnCommand(@NotNull CommandSender sender,
@NotNull @Flags("other,defaultself,fallbackself") Location location) {
doSpawnSet(sender, location);
}
}
@CommandAlias("mv")
@Subcommand("setspawn")
@CommandPermission("multiverse.core.spawn.set")
@Syntax("[world x y z [yaw pitch]]")
//TODO: Location tab complete doesnt work.
@CommandCompletion("@MVWorlds")
@Description("Sets the spawn for the current world.")
public void onSetSpawnCommand(@NotNull CommandSender sender,
@NotNull @Flags("other,defaultself,fallbackself") Location location) {
doSpawnSet(sender, location);
public class AliasSetSpawn extends BaseCommand {
@CommandAlias("mvsetspawn")
@CommandPermission("multiverse.core.spawn.set")
@Syntax("[world x y z [yaw pitch]]")
@CommandCompletion("@MVWorlds")
@Description("Sets the spawn for the current world.")
public void onAliasSetSpawnCommand(@NotNull CommandSender sender,
@NotNull @Flags("other,defaultself,fallbackself") Location location) {
doSpawnSet(sender, location);
}
}
private void doSpawnSet(@NotNull CommandSender sender, @NotNull Location location) {

View File

@ -1,5 +1,6 @@
package com.onarandombox.MultiverseCore.commands_acf;
import co.aikar.commands.BaseCommand;
import co.aikar.commands.annotation.CommandAlias;
import co.aikar.commands.annotation.CommandCompletion;
import co.aikar.commands.annotation.Description;
@ -34,27 +35,33 @@ public class TeleportCommand extends MultiverseCommand {
this.playerTeleporter = this.plugin.getSafeTTeleporter();
}
@CommandAlias("mvtp")
@Syntax("[player] <destination>")
@CommandCompletion("@players|@MVWorlds @MVWorlds")
@Description("Alias for /mv tp")
public void doTeleportCommand(@NotNull CommandSender sender,
@NotNull @Flags("other,defaultself,fallbackself") Player player,
@NotNull @Single String destinationName) {
@CommandAlias("mv")
public class Teleport extends BaseCommand {
@Subcommand("tp|teleport")
@Syntax("[player] <destination>")
@CommandCompletion("@players|@MVWorlds @MVWorlds")
@Description("Allows you to the teleport to a location on your server!")
public void doSameTeleportCommand(@NotNull CommandSender sender,
@NotNull @Flags("other,defaultself,fallbackself") Player player,
@NotNull @Single String destinationName) {
doTeleport(sender, player, destinationName);
doTeleport(sender, player, destinationName);
}
}
@CommandAlias("mv")
@Subcommand("tp|teleport")
@Syntax("[player] <destination>")
@CommandCompletion("@players|@MVWorlds @MVWorlds")
@Description("Allows you to the teleport to a location on your server!")
public void doSameTeleportCommand(@NotNull CommandSender sender,
public class AliasTeleport extends BaseCommand {
@CommandAlias("mvtp")
@Syntax("[player] <destination>")
//TODO: playerOnly flag
@CommandCompletion("@players|@MVWorlds @MVWorlds")
@Description("Alias for /mv tp")
public void doTeleportCommand(@NotNull CommandSender sender,
@NotNull @Flags("other,defaultself,fallbackself") Player player,
@NotNull @Single String destinationName) {
doTeleport(sender, player, destinationName);
doTeleport(sender, player, destinationName);
}
}
private void doTeleport(@NotNull CommandSender teleporter,