Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
278c51d056 | ||
|
|
caed081f82 | ||
|
|
7276da7665 | ||
|
|
90b8729129 | ||
|
|
c24f198ed0 |
No files matched your search
@@ -1,71 +0,0 @@
|
||||
package org.mvplugins.multiverse.core.commands;
|
||||
|
||||
import co.aikar.commands.BukkitCommandIssuer;
|
||||
import co.aikar.commands.annotation.CommandAlias;
|
||||
import co.aikar.commands.annotation.CommandCompletion;
|
||||
import co.aikar.commands.annotation.CommandPermission;
|
||||
import co.aikar.commands.annotation.Description;
|
||||
import co.aikar.commands.annotation.Flags;
|
||||
import co.aikar.commands.annotation.Optional;
|
||||
import co.aikar.commands.annotation.Subcommand;
|
||||
import co.aikar.commands.annotation.Syntax;
|
||||
import jakarta.inject.Inject;
|
||||
import org.bukkit.Location;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jvnet.hk2.annotations.Service;
|
||||
import org.mvplugins.multiverse.core.api.BlockSafety;
|
||||
import org.mvplugins.multiverse.core.commandtools.MVCommandManager;
|
||||
import org.mvplugins.multiverse.core.commandtools.MultiverseCommand;
|
||||
import org.mvplugins.multiverse.core.world.LoadedMultiverseWorld;
|
||||
import org.mvplugins.multiverse.core.world.WorldManager;
|
||||
|
||||
@Service
|
||||
@CommandAlias("mv")
|
||||
public class SetSpawnCommand extends MultiverseCommand {
|
||||
|
||||
@Inject
|
||||
SetSpawnCommand(@NotNull MVCommandManager commandManager) {
|
||||
super(commandManager);
|
||||
}
|
||||
|
||||
@Subcommand("setspawn")
|
||||
@CommandPermission("multiverse.core.setspawn")
|
||||
@CommandCompletion("@nothing @mvworlds:scope=loaded ") // TODO: Use Brigadier to show <position> above in chat like the vanilla TP command
|
||||
@Syntax("[location] [world]")
|
||||
@Description("{@@mv-core.setspawn.description}")
|
||||
void onSetSpawnCommand(
|
||||
BukkitCommandIssuer issuer,
|
||||
|
||||
@Optional
|
||||
@Flags("resolve=issuerAware")
|
||||
@Syntax("<location>")
|
||||
@Description("{@@mv-core.setspawn.location.description}")
|
||||
Location location,
|
||||
|
||||
@Optional
|
||||
@Flags("resolve=issuerAware")
|
||||
@Syntax("<world>")
|
||||
@Description("{@@mv-core.setspawn.world.description}")
|
||||
LoadedMultiverseWorld world
|
||||
) {
|
||||
|
||||
// TODO: Use a flag to do this, no clue how to edit an inbuilt ACF flag though
|
||||
// Get the Location
|
||||
if (location == null) {
|
||||
if (issuer.isPlayer()) {
|
||||
location = issuer.getPlayer().getLocation();
|
||||
} else {
|
||||
issuer.sendMessage("The console must specify a location");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
issuer.sendMessage("Setting spawn in " + world.getName() + " to " + prettyLocation(location));
|
||||
|
||||
world.setSpawnLocation(location);
|
||||
}
|
||||
|
||||
private String prettyLocation(Location location) {
|
||||
return location.getX() + ", " + location.getY() + ", " + location.getZ();
|
||||
}
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
package org.mvplugins.multiverse.core.commands;
|
||||
|
||||
import co.aikar.commands.BukkitCommandIssuer;
|
||||
import co.aikar.commands.MessageType;
|
||||
import co.aikar.commands.annotation.CommandAlias;
|
||||
import co.aikar.commands.annotation.CommandCompletion;
|
||||
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 co.aikar.commands.annotation.Syntax;
|
||||
import com.dumptruckman.minecraft.util.Logging;
|
||||
import jakarta.inject.Inject;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jvnet.hk2.annotations.Service;
|
||||
import org.mvplugins.multiverse.core.commandtools.MVCommandManager;
|
||||
import org.mvplugins.multiverse.core.commandtools.MultiverseCommand;
|
||||
import org.mvplugins.multiverse.core.teleportation.AsyncSafetyTeleporter;
|
||||
import org.mvplugins.multiverse.core.utils.MVCorei18n;
|
||||
import org.mvplugins.multiverse.core.world.LoadedMultiverseWorld;
|
||||
import org.mvplugins.multiverse.core.world.WorldManager;
|
||||
|
||||
@Service
|
||||
@CommandAlias("mv")
|
||||
class SpawnCommand extends MultiverseCommand {
|
||||
private final WorldManager worldManager;
|
||||
private final AsyncSafetyTeleporter safetyTeleporter;
|
||||
|
||||
@Inject
|
||||
SpawnCommand(@NotNull MVCommandManager commandManager,
|
||||
@NotNull WorldManager worldManager,
|
||||
@NotNull AsyncSafetyTeleporter safetyTeleporter) {
|
||||
super(commandManager);
|
||||
this.worldManager = worldManager;
|
||||
this.safetyTeleporter = safetyTeleporter;
|
||||
}
|
||||
|
||||
@Subcommand("spawn")
|
||||
@CommandPermission("multiverse.core.spawn")
|
||||
@CommandCompletion("@players")
|
||||
@Syntax("[player]")
|
||||
@Description("{@@mv-core.spawn.description}")
|
||||
void onSpawnTpCommand(
|
||||
BukkitCommandIssuer issuer,
|
||||
|
||||
@Flags("resolve=issuerAware")
|
||||
@Syntax("[player]")
|
||||
@Description("{@@mv-core.spawn.player.description}")
|
||||
Player player
|
||||
) {
|
||||
// The player is in the world, so it must be loaded
|
||||
LoadedMultiverseWorld world = worldManager.getLoadedWorld(player.getWorld().getName()).getOrNull();
|
||||
if (world == null) {
|
||||
issuer.sendMessage("The world the player you are trying to teleport is in, is not a multiverse world");
|
||||
}
|
||||
|
||||
// TODO: Log when the player cannot be teleported there. No clue how to detect that
|
||||
// Teleport the player
|
||||
safetyTeleporter.teleportSafely(issuer.getIssuer(), player, world.getSpawnLocation());
|
||||
|
||||
player.sendMessage(commandManager.formatMessage(
|
||||
issuer,
|
||||
MessageType.INFO,
|
||||
MVCorei18n.SPAWN_MESSAGE,
|
||||
"{teleporter}",
|
||||
getTeleporterName(issuer, player)
|
||||
));
|
||||
|
||||
Logging.fine("Teleported " + player.getName() + " to " + world.getSpawnLocation().getX() + ", " + world.getSpawnLocation().getY() + ", " + world.getSpawnLocation().getZ());
|
||||
}
|
||||
|
||||
private String getTeleporterName(BukkitCommandIssuer issuer, Player teleportTo) {
|
||||
if (issuer.getIssuer().getName().equals("CONSOLE")) {
|
||||
return commandManager.formatMessage(issuer, MessageType.INFO, MVCorei18n.SPAWN_CONSOLENAME);
|
||||
}
|
||||
if (issuer.getIssuer().getName().equals(teleportTo.getName())) {
|
||||
return commandManager.formatMessage(issuer, MessageType.INFO, MVCorei18n.SPAWN_YOU);
|
||||
}
|
||||
return issuer.getIssuer().getName();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package org.mvplugins.multiverse.core.commands;
|
||||
|
||||
import co.aikar.commands.BukkitCommandIssuer;
|
||||
import co.aikar.commands.MessageType;
|
||||
import co.aikar.commands.annotation.CommandAlias;
|
||||
import co.aikar.commands.annotation.CommandPermission;
|
||||
import co.aikar.commands.annotation.Description;
|
||||
import co.aikar.commands.annotation.Subcommand;
|
||||
import jakarta.inject.Inject;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jvnet.hk2.annotations.Service;
|
||||
import org.mvplugins.multiverse.core.MultiverseCore;
|
||||
import org.mvplugins.multiverse.core.commandtools.MVCommandManager;
|
||||
import org.mvplugins.multiverse.core.commandtools.MultiverseCommand;
|
||||
import org.mvplugins.multiverse.core.utils.MVCorei18n;
|
||||
|
||||
@Service
|
||||
@CommandAlias("mv")
|
||||
class VersionCommand extends MultiverseCommand {
|
||||
|
||||
private final MultiverseCore plugin;
|
||||
|
||||
@Inject
|
||||
VersionCommand(@NotNull MVCommandManager commandManager, MultiverseCore plugin) {
|
||||
super(commandManager);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Subcommand("version")
|
||||
@CommandPermission("multiverse.core.version")
|
||||
@Description("{@@mv-core.version.description}")
|
||||
void versionCommand(BukkitCommandIssuer issuer) {
|
||||
issuer.sendMessage(MessageType.INFO, MVCorei18n.VERSION_MV, "{version}", plugin.getDescription().getVersion());
|
||||
issuer.sendMessage(MessageType.INFO, MVCorei18n.VERSION_AUTHORS, "{authors}", String.join(", ", plugin.getDescription().getAuthors()));
|
||||
issuer.sendMessage(MessageType.INFO, MVCorei18n.VERSION_SECRETCODE); // An in joke I don't get...
|
||||
}
|
||||
}
|
||||
@@ -94,13 +94,6 @@ public enum MVCorei18n implements MessageKeyProvider {
|
||||
ROOT_TITLE,
|
||||
ROOT_HELP,
|
||||
|
||||
// spawn tp command
|
||||
SPAWN_DESCRIPTION,
|
||||
SPAWN_PLAYER_DESCRIPTION,
|
||||
SPAWN_MESSAGE,
|
||||
SPAWN_CONSOLENAME,
|
||||
SPAWN_YOU,
|
||||
|
||||
// teleport command
|
||||
TELEPORT_SUCCESS,
|
||||
|
||||
@@ -108,6 +101,11 @@ public enum MVCorei18n implements MessageKeyProvider {
|
||||
UNLOAD_UNLOADING,
|
||||
UNLOAD_SUCCESS,
|
||||
|
||||
// version command
|
||||
VERSION_MV,
|
||||
VERSION_AUTHORS,
|
||||
VERSION_SECRETCODE,
|
||||
|
||||
// debug command
|
||||
DEBUG_INFO_OFF,
|
||||
DEBUG_INFO_ON,
|
||||
|
||||
@@ -124,13 +124,6 @@ mv-core.remove.success=&aWorld '{world}' removed!
|
||||
mv-core.root.title=&a{name} version {version}
|
||||
mv-core.root.help=&aSee &f/mv help&a for commands available.
|
||||
|
||||
# /mv spawn
|
||||
mv-core.spawn.description=Teleports the specified player to the spawn of the world they are in
|
||||
mv-core.spawn.player.description=The player
|
||||
mv-core.spawn.message={teleporter} just sent you to spawn!
|
||||
mv-core.spawn.consolename=The console
|
||||
mv-core.spawn.you=You
|
||||
|
||||
# /mv tp
|
||||
mv-core.teleport.description=Allows you to teleport to a location on your server!
|
||||
mv-core.teleport.player.description=Target player to teleport.
|
||||
@@ -146,6 +139,12 @@ mv-core.unload.success=&aWorld '{world}' unloaded!
|
||||
# /mv usage
|
||||
mv-core.usage.description=Show Multiverse-Core command usage.
|
||||
|
||||
# /mv version
|
||||
mv-core.version.description=Displays version and authors
|
||||
mv-core.version.mv=Multiverse Core Version &fv{version}
|
||||
mv-core.version.authors=Multiverse Core Authors &f{authors}
|
||||
mv-core.version.secretcode=Special Code: &fFRN002
|
||||
|
||||
# commands error
|
||||
mv-core.commands.error.playersonly=&cThis command can only be used by players
|
||||
mv-core.commands.error.multiverseworldonly=&cThis can only be used in multiverse worlds
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
name: Multiverse-Core
|
||||
main: org.mvplugins.multiverse.core.MultiverseCore
|
||||
authors: ['dumptruckman', 'Rigby', 'fernferret', 'lithium3141', 'main--']
|
||||
authors: ['dumptruckman', 'Rigby', 'fernferret', 'lithium3141', 'main--', 'benwoo1110', 'Zax71']
|
||||
website: 'https://dev.bukkit.org/projects/multiverse-core'
|
||||
softdepend: ['Vault', 'PlaceholderAPI']
|
||||
api-version: 1.13
|
||||
|
||||
Reference in new issue
Block a user