mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Better autocompletions
This commit is contained in:
parent
bc53cd1aa4
commit
154aea7a61
@ -10,10 +10,12 @@ import com.volmit.iris.util.plugin.MortarCommand;
|
|||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
import com.volmit.iris.util.plugin.VolmitSender;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.checkerframework.checker.units.qual.K;
|
|
||||||
|
|
||||||
public class CommandIrisPregenCreate extends MortarCommand {
|
public class CommandIrisPregenCreate extends MortarCommand {
|
||||||
|
|
||||||
|
private static final KList<String> argus = new KList<>("radius=<radius>", "width=<width>", "height=<height>", "x=<centerX>", "z=<centerZ>");
|
||||||
|
|
||||||
public CommandIrisPregenCreate() {
|
public CommandIrisPregenCreate() {
|
||||||
super("create", "c", "new", "+");
|
super("create", "c", "new", "+");
|
||||||
requiresPermission(Iris.perm);
|
requiresPermission(Iris.perm);
|
||||||
@ -39,13 +41,41 @@ public class CommandIrisPregenCreate extends MortarCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
||||||
|
|
||||||
list.add("5000");
|
// Add arguments
|
||||||
list.add("size=5000 world=IrisWorld x=500 z=-1000");
|
argus.forEach(p -> {
|
||||||
list.add("5000 world=IrisWorld x=500 z=-1000");
|
boolean hasArg = false;
|
||||||
list.add("world=IrisWorld x=500 z=-1000");
|
for (String arg : args) {
|
||||||
for (World w : Bukkit.getServer().getWorlds()) {
|
if (!arg.contains("=") || !p.contains("=")){
|
||||||
list.add(w.getName());
|
continue;
|
||||||
|
}
|
||||||
|
if (arg.split("=")[0].equals(p.split("=")[0])) {
|
||||||
|
hasArg = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!hasArg){
|
||||||
|
list.add(p);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add -here
|
||||||
|
boolean hasHere = false;
|
||||||
|
for (String arg : args) {
|
||||||
|
if (arg.equals("-here")) {
|
||||||
|
hasHere = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (!hasHere){
|
||||||
|
list.add("-here");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add Iris worlds
|
||||||
|
Bukkit.getWorlds().forEach(w -> {
|
||||||
|
if (IrisToolbelt.isIrisWorld(w)){
|
||||||
|
list.add("world=" + w.getName());
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user