use of gg.projecteden.nexus.models.trust.TrustService in project Nexus by ProjectEdenGG.
the class LWCTrustModule method onAccessRequest.
@Override
public void onAccessRequest(LWCAccessEvent event) {
UUID owner;
try {
owner = UUID.fromString(event.getProtection().getOwner());
} catch (IllegalArgumentException e) {
return;
}
UUID requester = event.getPlayer().getUniqueId();
List<UUID> trusted = new TrustService().get(owner).getLocks();
if (trusted.contains(requester))
event.setAccess(Permission.Access.PLAYER);
if (Rank.of(requester).isStaff() && WorldGroup.of(event.getProtection().getBukkitWorld()) == WorldGroup.STAFF)
event.setAccess(Permission.Access.PLAYER);
}
use of gg.projecteden.nexus.models.trust.TrustService in project Nexus by ProjectEdenGG.
the class TrustProvider method openMenu.
public static void openMenu(Player player, int page, Runnable back, InventoryProvider provider) {
Trust trust = new TrustService().get(player);
int rows = (int) Math.min(6, Math.ceil(trust.getAll().size() / 9) + 3);
SmartInventory.builder().provider(provider == null ? new TrustProvider(trust, back) : provider).size(rows, 9).title("Trusts").build().open(player, page);
}
use of gg.projecteden.nexus.models.trust.TrustService in project Nexus by ProjectEdenGG.
the class PoofCommand method player.
@Path("<player>")
void player(OfflinePlayer target) {
if (isSelf(target))
error("You cannot poof to yourself");
if (!canSee(player(), target))
throw new PlayerNotOnlineException(target);
if (MuteMenuUser.hasMuted(target, MuteMenuItem.TP_REQUESTS))
error(target.getName() + " has teleport requests disabled!");
Location targetLocation = Nerd.of(target).getLocation();
World targetWorld = targetLocation.getWorld();
WorldGroup targetWorldGroup = WorldGroup.of(targetWorld);
if (!isStaff()) {
String cannotTeleport = "Cannot teleport to " + nickname(target);
if (targetWorldGroup.isMinigames())
error(cannotTeleport + ", they are playing minigames");
if (targetWorldGroup.equals(WorldGroup.STAFF) || (targetWorld.equals(BearFair21.getWorld()) && !BearFair21.canWarp()))
error(cannotTeleport + ", they are in a staff world");
}
Trust trust = new TrustService().get(target);
if (trust.trusts(Type.TELEPORTS, player())) {
player().teleportAsync(targetLocation, TeleportCause.COMMAND);
send(PREFIX + "Poofing to &e" + Nickname.of(target) + (target.isOnline() && PlayerUtils.canSee(player(), target) ? "" : " &3(Offline)"));
return;
}
Player targetPlayer = convertToPlayer(target);
Poof request = new Poof(player(), targetPlayer, Poof.PoofType.POOF);
service.save(request);
send(json("&ePoof &3request sent to " + Nickname.of(targetPlayer) + ". ").next("&eClick to cancel").command("poof cancel"));
send(targetPlayer, " &e" + nickname() + " &3is asking to poof &eto you&3.");
send(targetPlayer, json("&3 Click one &3 || &3 ").group().next("&a&lAccept").command("/poof accept").hover("&eClick &3to accept").group().next("&3 &3 || &3 ").group().next("&c&lDeny").command("/poof deny").hover("&eClick &3to deny").group().next("&3 &3 ||"));
}
Aggregations