use of gg.projecteden.nexus.utils.PlayerUtils in project Nexus by ProjectEdenGG.
the class TrustProvider method init.
@Override
public void init(Player player, InventoryContents contents) {
if (back == null)
addCloseItem(contents);
else
addBackItem(contents, e -> back.run());
List<ClickableItem> items = new ArrayList<>();
trust.getAll().stream().map(PlayerUtils::getPlayer).sorted(Comparator.comparing(Nickname::of)).collect(Collectors.toList()).forEach(_player -> {
if (filterType.get() != null)
if (!trust.trusts(filterType.get(), _player))
return;
ItemBuilder builder = new ItemBuilder(Material.PLAYER_HEAD).skullOwner(_player).name("&e" + Nickname.of(_player));
for (Trust.Type type : Trust.Type.values()) {
// TODO Decorations
if (type.equals(Type.DECORATIONS) && !Rank.of(player).isStaff())
continue;
if (trust.trusts(type, _player))
builder.lore("&a" + type.camelCase());
else
builder.lore("&c" + type.camelCase());
}
builder.lore("").lore("&fClick to edit");
items.add(ClickableItem.from(builder.build(), e -> TrustPlayerProvider.open(player, _player)));
});
paginator(player, contents, items);
ItemBuilder add = new ItemBuilder(Material.LIME_CONCRETE_POWDER).name("&aAdd Trust");
contents.set(0, 8, ClickableItem.from(add.build(), e -> Nexus.getSignMenuFactory().lines("", ARROWS, "Enter a", "player's name").prefix(Features.get(TrustFeature.class).getPrefix()).response(lines -> {
if (lines[0].length() > 0) {
OfflinePlayer trusted = PlayerUtils.getPlayer(lines[0]);
TrustPlayerProvider.open(player, trusted);
} else
openMenu(player);
}).open(player)));
Trust.Type previous = filterType.get() == null ? Type.values()[0].previousWithLoop() : filterType.get().previous();
Trust.Type current = filterType.get();
Trust.Type next = filterType.get() == null ? Type.values()[0] : filterType.get().next();
if (current == previous)
previous = null;
if (current == next)
next = null;
ItemBuilder item = new ItemBuilder(Material.HOPPER).name("&6Filter by:").lore("&7⬇ " + (previous == null ? "All" : previous.camelCase())).lore("&e⬇ " + (current == null ? "All" : current.camelCase())).lore("&7⬇ " + (next == null ? "All" : next.camelCase()));
Trust.Type finalNext = next;
contents.set(contents.inventory().getRows() - 1, 4, ClickableItem.from(item.build(), e -> {
filterType.set(finalNext);
refresh();
}));
}
use of gg.projecteden.nexus.utils.PlayerUtils in project Nexus by ProjectEdenGG.
the class EndermanFarmCommand method list.
@Path("list [owner]")
void list(@Arg(value = "self", permission = Group.MODERATOR) OfflinePlayer owner) {
final ProtectedRegion region = getRegion(world(), owner.getUniqueId());
final DefaultDomain members = region.getMembers();
final Set<UUID> uuids = members.getUniqueIds();
if (uuids.isEmpty())
error("No one has access to your enderman farm");
final String names = uuids.stream().map(PlayerUtils::getPlayer).map(OfflinePlayer::getName).collect(Collectors.joining(", "));
send(PREFIX + "Access list: &7" + names);
}
Aggregations