Search in sources :

Example 86 with Permission

use of gg.projecteden.nexus.framework.commands.models.annotations.Permission in project Nexus by ProjectEdenGG.

the class HallOfHistoryCommand method create.

@Permission(Group.STAFF)
@Path("create <player>")
void create(@Arg(tabCompleter = Nerd.class) String player) {
    runCommand("blockcenter");
    String name;
    String skin;
    try {
        Nerd nerd = Nerd.of(convertToOfflinePlayer(player));
        name = nerd.getColoredName();
        skin = nerd.getName();
    } catch (PlayerNotFoundException e) {
        // probably a veteran
        name = Rank.VETERAN.colored().getHex() + player;
        skin = player;
    }
    // is there a better workaround for this? :P
    final String name1 = name;
    final String skin1 = skin;
    Tasks.wait(5, () -> runCommand("npc create " + name1));
    Tasks.wait(10, () -> runCommand("npc skin " + skin1));
}
Also used : PlayerNotFoundException(gg.projecteden.nexus.framework.exceptions.postconfigured.PlayerNotFoundException) Nerd(gg.projecteden.nexus.models.nerd.Nerd) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Permission(gg.projecteden.nexus.framework.commands.models.annotations.Permission)

Example 87 with Permission

use of gg.projecteden.nexus.framework.commands.models.annotations.Permission in project Nexus by ProjectEdenGG.

the class ItemInfoCommand method extended.

@Path("extended [material]")
@Permission(Group.STAFF)
void extended(Material material) {
    ItemStack tool = material == null ? getToolRequired() : new ItemStack(material);
    material = tool.getType();
    line(5);
    sendJson(tool);
    line();
    send("Namespaced key: " + material.getKey());
    send("Blast resistance: " + material.getBlastResistance());
    send("Hardness: " + material.getHardness());
    send("Max durability: " + material.getMaxDurability());
    send("Max stack size: " + material.getMaxStackSize());
    line();
    send("Has gravity: " + StringUtils.bool(material.hasGravity()));
    send("Is air: " + StringUtils.bool(material.isAir()));
    send("Is block: " + StringUtils.bool(material.isBlock()));
    send("Is burnable: " + StringUtils.bool(material.isBurnable()));
    send("Is edible: " + StringUtils.bool(material.isEdible()));
    send("Is empty: " + StringUtils.bool(material.isEmpty()));
    send("Is flammable: " + StringUtils.bool(material.isFlammable()));
    send("Is fuel: " + StringUtils.bool(material.isFuel()));
    send("Is interactable: " + StringUtils.bool(material.isInteractable()));
    send("Is item: " + StringUtils.bool(material.isItem()));
    send("Is occluding: " + StringUtils.bool(material.isOccluding()));
    send("Is record: " + StringUtils.bool(material.isRecord()));
    send("Is solid: " + StringUtils.bool(material.isSolid()));
    send("Is transparent: " + StringUtils.bool(material.isTransparent()));
    line();
    send("Applicable tags: " + String.join(", ", MaterialTag.getApplicable(material).keySet()));
    line();
    BlockData blockData = material.createBlockData();
    send("BlockData: " + material.data.getSimpleName());
    dump(blockData).forEach((method, output) -> send(method + "(): " + output));
    line();
}
Also used : ItemStack(org.bukkit.inventory.ItemStack) BlockData(org.bukkit.block.data.BlockData) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Permission(gg.projecteden.nexus.framework.commands.models.annotations.Permission)

Example 88 with Permission

use of gg.projecteden.nexus.framework.commands.models.annotations.Permission in project Nexus by ProjectEdenGG.

the class RanksCommand method bookMenu.

// TODO: Maybe use 1.16 colors to make this look better?
@Path("book")
@Permission(Group.STAFF)
public void bookMenu() {
    BookBuilder.WrittenBookMenu bookBuilder = new BookBuilder.WrittenBookMenu();
    AtomicReference<JsonBuilder> jsonBuilder = new AtomicReference<>(new JsonBuilder());
    jsonBuilder.get().next("Click a rank to view more information.").line();
    Arrays.asList(Rank.values()).forEach(rank -> {
        if (!rank.isActive())
            return;
        String formattedRank = rank.getColoredName();
        if (rank.equals(Rank.GUEST))
            formattedRank = colorize("&8" + rank.getName());
        else if (rank.equals(Rank.MEMBER))
            formattedRank = colorize("&7" + rank.getName());
        jsonBuilder.get().next("&3[+] " + formattedRank);
        jsonBuilder.get().command("/" + rank.name().toLowerCase());
        if (Rank.of(player()) == rank)
            jsonBuilder.get().next("  &0&o<-- You");
        jsonBuilder.get().newline().group();
    });
    bookBuilder.addPage(jsonBuilder.get());
    bookBuilder.open(player());
}
Also used : JsonBuilder(gg.projecteden.nexus.utils.JsonBuilder) BookBuilder(gg.projecteden.nexus.features.menus.BookBuilder) AtomicReference(java.util.concurrent.atomic.AtomicReference) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Permission(gg.projecteden.nexus.framework.commands.models.annotations.Permission)

Example 89 with Permission

use of gg.projecteden.nexus.framework.commands.models.annotations.Permission in project Nexus by ProjectEdenGG.

the class MinigamesCommand method mastermindShowAnswer.

@Path("mastermind showAnswer")
@Permission(Group.ADMIN)
void mastermindShowAnswer() {
    if (!minigamer.isPlaying(Mastermind.class))
        error("You must be playing Mastermind to use this command");
    MastermindMatchData matchData = minigamer.getMatch().getMatchData();
    send(matchData.getAnswer().toString());
}
Also used : Mastermind(gg.projecteden.nexus.features.minigames.mechanics.Mastermind) MastermindMatchData(gg.projecteden.nexus.features.minigames.models.matchdata.MastermindMatchData) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Permission(gg.projecteden.nexus.framework.commands.models.annotations.Permission)

Example 90 with Permission

use of gg.projecteden.nexus.framework.commands.models.annotations.Permission in project Nexus by ProjectEdenGG.

the class MinigamesCommand method refreshNameColors.

@Path("refreshNameColors")
@Permission(PERMISSION_MANAGE)
void refreshNameColors() {
    MatchManager.getAll().forEach(match -> {
        MinigameScoreboard sb = match.getScoreboard();
        if (sb != null) {
            sb.update();
            send(PREFIX + "Refreshed " + match.getArena().getDisplayName());
        }
    });
}
Also used : MinigameScoreboard(gg.projecteden.nexus.features.minigames.models.scoreboards.MinigameScoreboard) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Permission(gg.projecteden.nexus.framework.commands.models.annotations.Permission)

Aggregations

Permission (gg.projecteden.nexus.framework.commands.models.annotations.Permission)94 Path (gg.projecteden.nexus.framework.commands.models.annotations.Path)93 Async (gg.projecteden.annotations.Async)15 JsonBuilder (gg.projecteden.nexus.utils.JsonBuilder)13 ItemStack (org.bukkit.inventory.ItemStack)13 List (java.util.List)10 CustomCommand (gg.projecteden.nexus.framework.commands.models.CustomCommand)9 Group (gg.projecteden.nexus.framework.commands.models.annotations.Permission.Group)9 CommandEvent (gg.projecteden.nexus.framework.commands.models.events.CommandEvent)9 Arg (gg.projecteden.nexus.framework.commands.models.annotations.Arg)8 Description (gg.projecteden.nexus.framework.commands.models.annotations.Description)8 ArrayList (java.util.ArrayList)8 Nerd (gg.projecteden.nexus.models.nerd.Nerd)7 NerdService (gg.projecteden.nexus.models.nerd.NerdService)7 Utils (gg.projecteden.nexus.utils.Utils)7 HashMap (java.util.HashMap)7 BiFunction (java.util.function.BiFunction)7 Map (java.util.Map)6 Location (org.bukkit.Location)6 Aliases (gg.projecteden.nexus.framework.commands.models.annotations.Aliases)5