mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-22 17:18:37 +01:00
Add /bottom command (#5292)
Co-authored-by: Josh Roy <10731363+JRoy@users.noreply.github.com>
This commit is contained in:
parent
c716fc8236
commit
77dc87bb8e
@ -0,0 +1,36 @@
|
|||||||
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import com.earth2me.essentials.Trade;
|
||||||
|
import com.earth2me.essentials.User;
|
||||||
|
import com.earth2me.essentials.utils.LocationUtil;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Server;
|
||||||
|
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||||
|
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n.tl;
|
||||||
|
|
||||||
|
public class Commandbottom extends EssentialsCommand {
|
||||||
|
|
||||||
|
public Commandbottom() {
|
||||||
|
super("bottom");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception {
|
||||||
|
final int bottomX = user.getLocation().getBlockX();
|
||||||
|
final int bottomZ = user.getLocation().getBlockZ();
|
||||||
|
final float pitch = user.getLocation().getPitch();
|
||||||
|
final float yaw = user.getLocation().getYaw();
|
||||||
|
final Location unsafe = new Location(user.getWorld(), bottomX, ess.getWorldInfoProvider().getMinHeight(user.getWorld()), bottomZ, yaw, pitch);
|
||||||
|
final Location safe = LocationUtil.getSafeDestination(ess, unsafe);
|
||||||
|
final CompletableFuture<Boolean> future = getNewExceptionFuture(user.getSource(), commandLabel);
|
||||||
|
future.thenAccept(success -> {
|
||||||
|
if (success) {
|
||||||
|
user.sendMessage(tl("teleportBottom", safe.getWorld().getName(), safe.getBlockX(), safe.getBlockY(), safe.getBlockZ()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
user.getAsyncTeleport().teleport(safe, new Trade(this.getName(), ess), PlayerTeleportEvent.TeleportCause.COMMAND, future);
|
||||||
|
}
|
||||||
|
}
|
@ -100,6 +100,8 @@ bookCommandUsage3=/<command> title <title>
|
|||||||
bookCommandUsage3Description=Sets the title of a signed book
|
bookCommandUsage3Description=Sets the title of a signed book
|
||||||
bookLocked=\u00a76This book is now locked.
|
bookLocked=\u00a76This book is now locked.
|
||||||
bookTitleSet=\u00a76Title of the book set to {0}.
|
bookTitleSet=\u00a76Title of the book set to {0}.
|
||||||
|
bottomCommandDescription=Teleport to the lowest block at your current position.
|
||||||
|
bottomCommandUsage=/<command>
|
||||||
breakCommandDescription=Breaks the block you are looking at.
|
breakCommandDescription=Breaks the block you are looking at.
|
||||||
breakCommandUsage=/<command>
|
breakCommandUsage=/<command>
|
||||||
broadcast=\u00a76[\u00a74Broadcast\u00a76]\u00a7a {0}
|
broadcast=\u00a76[\u00a74Broadcast\u00a76]\u00a7a {0}
|
||||||
@ -1253,6 +1255,7 @@ teleportationDisabledWarning=\u00a76You must enable teleportation before other p
|
|||||||
teleportationEnabled=\u00a76Teleportation \u00a7cenabled\u00a76.
|
teleportationEnabled=\u00a76Teleportation \u00a7cenabled\u00a76.
|
||||||
teleportationEnabledFor=\u00a76Teleportation \u00a7cenabled \u00a76for \u00a7c{0}\u00a76.
|
teleportationEnabledFor=\u00a76Teleportation \u00a7cenabled \u00a76for \u00a7c{0}\u00a76.
|
||||||
teleportAtoB=\u00a7c{0}\u00a76 teleported you to \u00a7c{1}\u00a76.
|
teleportAtoB=\u00a7c{0}\u00a76 teleported you to \u00a7c{1}\u00a76.
|
||||||
|
teleportBottom=\u00a76Teleporting to bottom.
|
||||||
teleportDisabled=\u00a7c{0} \u00a74has teleportation disabled.
|
teleportDisabled=\u00a7c{0} \u00a74has teleportation disabled.
|
||||||
teleportHereRequest=\u00a7c{0}\u00a76 has requested that you teleport to them.
|
teleportHereRequest=\u00a7c{0}\u00a76 has requested that you teleport to them.
|
||||||
teleportHome=\u00a76Teleporting to \u00a7c{0}\u00a76.
|
teleportHome=\u00a76Teleporting to \u00a7c{0}\u00a76.
|
||||||
|
@ -53,6 +53,10 @@ commands:
|
|||||||
description: Allows reopening and editing of sealed books.
|
description: Allows reopening and editing of sealed books.
|
||||||
usage: /<command> [title|author [name]]
|
usage: /<command> [title|author [name]]
|
||||||
aliases: [ebook]
|
aliases: [ebook]
|
||||||
|
bottom:
|
||||||
|
description: Teleport to the lowest block at your current position.
|
||||||
|
usage: /<command>
|
||||||
|
aliases: [ ebottom ]
|
||||||
break:
|
break:
|
||||||
description: Breaks the block you are looking at.
|
description: Breaks the block you are looking at.
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
|
Loading…
Reference in New Issue
Block a user