ru.cwcode.commands.paperplatform.argument.WorldArg Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of PaperCommands Show documentation
Show all versions of PaperCommands Show documentation
Commands library for Paper (Minecraft)
The newest version!
package ru.cwcode.commands.paperplatform.argument;
import org.bukkit.Bukkit;
import org.bukkit.World;
import ru.cwcode.commands.Argument;
import ru.cwcode.commands.api.Sender;
import java.util.ArrayList;
import java.util.List;
import static ru.cwcode.commands.api.CommandsAPI.l10n;
public class WorldArg extends Argument {
@Override
public boolean valid(String raw) {
return Bukkit.getWorld(raw) != null;
}
@Override
public List completions(Sender sender) {
List list = new ArrayList<>();
for (World world : Bukkit.getWorlds()) {
list.add(world.getName());
}
return list;
}
@Override
public String argumentName() {
return l10n.get("argument.world.name");
}
@Override
public Object map() {
return Bukkit.getWorld(raw);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy