mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2024-06-25 23:40:58 +00:00
9a23f806fe
Gradle is better than Maven, don't @ me. okay but actually it's [faster](https://www.youtube.com/watch?v=atuFSv2bLa8&feature=youtu.be&t=77), compiles and tests in parallel more efficiently, and more epic stuff).
43 lines
1.5 KiB
Java
43 lines
1.5 KiB
Java
package com.earth2me.essentials.commands;
|
|
|
|
import com.earth2me.essentials.RandomTeleport;
|
|
import com.earth2me.essentials.User;
|
|
import org.bukkit.Server;
|
|
|
|
import java.util.Arrays;
|
|
import java.util.Collections;
|
|
import java.util.List;
|
|
|
|
import static com.earth2me.essentials.I18n.tl;
|
|
|
|
public class Commandsettpr extends EssentialsCommand {
|
|
public Commandsettpr() {
|
|
super("settpr");
|
|
}
|
|
|
|
@Override
|
|
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception {
|
|
final RandomTeleport randomTeleport = ess.getRandomTeleport();
|
|
randomTeleport.getCachedLocations().clear();
|
|
if (args.length == 0 || "center".equalsIgnoreCase(args[0])) {
|
|
randomTeleport.setCenter(user.getLocation());
|
|
user.sendMessage(tl("settpr"));
|
|
} else if (args.length > 1) {
|
|
if ("minrange".equalsIgnoreCase(args[0])) {
|
|
randomTeleport.setMinRange(Double.parseDouble(args[1]));
|
|
} else if ("maxrange".equalsIgnoreCase(args[0])) {
|
|
randomTeleport.setMaxRange(Double.parseDouble(args[1]));
|
|
}
|
|
user.sendMessage(tl("settprValue", args[0].toLowerCase(), args[1].toLowerCase()));
|
|
}
|
|
}
|
|
|
|
@Override
|
|
protected List<String> getTabCompleteOptions(final Server server, final User user, final String commandLabel, final String[] args) {
|
|
if (args.length == 1) {
|
|
return Arrays.asList("center", "minrange", "maxrange");
|
|
}
|
|
return Collections.emptyList();
|
|
}
|
|
}
|