mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-03 15:08:18 +01:00
Add /warpinfo command (#3820)
Co-authored-by: Josh Roy <10731363+JRoy@users.noreply.github.com> Co-authored-by: MD <1917406+mdcfe@users.noreply.github.com>
This commit is contained in:
parent
5bb3cc88e5
commit
e1e98f5048
@ -0,0 +1,47 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.CommandSource;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
public class Commandwarpinfo extends EssentialsCommand {
|
||||
|
||||
public Commandwarpinfo() {
|
||||
super("warpinfo");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception {
|
||||
if (args.length == 0) {
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
final String name = args[0];
|
||||
final Location loc = ess.getWarps().getWarp(name);
|
||||
sender.sendMessage(tl("warpInfo", name));
|
||||
sender.sendMessage(tl("whoisLocation", loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> getTabCompleteOptions(final Server server, final CommandSource sender, final String commandLabel, final String[] args) {
|
||||
if (args.length == 1) {
|
||||
if (ess.getSettings().getPerWarpPermission() && sender.isPlayer()) {
|
||||
final List<String> list = new ArrayList<>();
|
||||
for (String curWarp : ess.getWarps().getList()) {
|
||||
if (sender.isAuthorized("essentials.warps." + curWarp, ess)) {
|
||||
list.add(curWarp);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
return new ArrayList<>(ess.getWarps().getList());
|
||||
} else {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
}
|
@ -933,6 +933,9 @@ walking=walking
|
||||
warpCommandDescription=List all warps or warp to the specified location.
|
||||
warpCommandUsage=/<command> <pagenumber|warp> [player]
|
||||
warpDeleteError=\u00a74Problem deleting the warp file.
|
||||
warpInfo=\u00a76Information for warp\u00a7c {0}\u00a76:
|
||||
warpinfoCommandDescription=Finds location information for a specified warp.
|
||||
warpinfoCommandUsage=/<command> <warp>
|
||||
warpingTo=\u00a76Warping to\u00a7c {0}\u00a76.
|
||||
warpList={0}
|
||||
warpListPermission=\u00a74You do not have permission to list warps.
|
||||
|
@ -568,6 +568,10 @@ commands:
|
||||
description: List all warps or warp to the specified location.
|
||||
usage: /<command> <pagenumber|warp> [player]
|
||||
aliases: [ewarp,warps,ewarps]
|
||||
warpinfo:
|
||||
description: Finds location information for a specified warp.
|
||||
usage: /<command> <warp>
|
||||
aliases: [ewarpinfo]
|
||||
weather:
|
||||
description: Sets the weather.
|
||||
usage: /<command> <storm/sun> [duration]
|
||||
|
Loading…
Reference in New Issue
Block a user