Search in sources :

Example 1 with Setting

use of gg.projecteden.nexus.models.setting.Setting in project Nexus by ProjectEdenGG.

the class TeleportCommand method disable.

@Path("toggle")
@Permission("ladder.builder")
void disable() {
    SettingService settingService = new SettingService();
    Setting setting = settingService.get(player(), "tpDisable");
    boolean enable = setting.getBoolean();
    setting.setBoolean(!enable);
    settingService.save(setting);
    send(PREFIX + "Teleports to you have been " + (enable ? "&aenabled" : "&cdisabled"));
}
Also used : SettingService(gg.projecteden.nexus.models.setting.SettingService) Setting(gg.projecteden.nexus.models.setting.Setting) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Permission(gg.projecteden.nexus.framework.commands.models.annotations.Permission)

Example 2 with Setting

use of gg.projecteden.nexus.models.setting.Setting in project Nexus by ProjectEdenGG.

the class TeleportCommand method checkTeleportDisabled.

private boolean checkTeleportDisabled(Player from, OfflinePlayer to) {
    SettingService settingService = new SettingService();
    Setting setting = settingService.get(to, "tpDisable");
    if (setting.getBoolean()) {
        Rank fromRank = Rank.of(from);
        Rank toRank = Rank.of(to);
        if (fromRank.ordinal() > toRank.ordinal())
            if (!(Arrays.asList(Rank.BUILDER, Rank.ARCHITECT).contains(toRank) && fromRank == Rank.MODERATOR))
                return false;
        PlayerUtils.send(to, PREFIX + "&c" + from.getName() + " tried to teleport to you, but you have teleports disabled");
        send(PREFIX + "&cThat player has teleports disabled. Sending a request instead");
        runCommand(from, "tpa " + argsString());
        return true;
    }
    return false;
}
Also used : SettingService(gg.projecteden.nexus.models.setting.SettingService) Setting(gg.projecteden.nexus.models.setting.Setting) Rank(gg.projecteden.nexus.models.nerd.Rank)

Example 3 with Setting

use of gg.projecteden.nexus.models.setting.Setting in project Nexus by ProjectEdenGG.

the class Pride20Command method leaveParade.

@Path("parade leave [player]")
void leaveParade(@Arg(value = "self", permission = Group.STAFF) OfflinePlayer player) {
    boolean isSelf = isSelf(player);
    String playerText = isSelf ? "You have" : Nickname.of(player) + " has";
    Setting setting = service.get(player, "pride20Parade");
    if (!setting.getBoolean())
        error(playerText + " not joined the parade");
    WorldGuardUtils worldguard = new WorldGuardUtils(Bukkit.getWorld("safepvp"));
    for (Entity entity : worldguard.getEntitiesInRegion("pride20_parade")) {
        if (!entity.hasMetadata("NPC"))
            continue;
        if (entity.getName().equalsIgnoreCase(player.getName()))
            CitizensAPI.getNPCRegistry().getNPC(entity).destroy();
    }
    setting.setBoolean(false);
    service.save(setting);
    send(PREFIX + playerText + " left the pride parade");
}
Also used : Entity(org.bukkit.entity.Entity) Setting(gg.projecteden.nexus.models.setting.Setting) WorldGuardUtils(gg.projecteden.nexus.utils.WorldGuardUtils) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path)

Example 4 with Setting

use of gg.projecteden.nexus.models.setting.Setting in project Nexus by ProjectEdenGG.

the class Pride20Listener method onSecretCatClick.

@EventHandler
public void onSecretCatClick(NPCRightClickEvent event) {
    if (event.getNPC().getId() != 2776)
        return;
    Player player = event.getClicker();
    SettingService service = new SettingService();
    Setting setting = service.get(player, "pride20Secret");
    if (setting.getBoolean()) {
        CooldownService cooldownService = new CooldownService();
        if (!cooldownService.check(player, "pride20Cat", TickTime.SECOND.x(10)))
            return;
        player.playSound(player.getLocation(), Sound.ENTITY_CAT_PURREOW, 5f, .08f);
        return;
    }
    player.playSound(player.getLocation(), Sound.ENTITY_CAT_PURREOW, 5f, .08f);
    PlayerUtils.giveItem(player, new ItemBuilder(Material.ORANGE_BANNER).pattern(DyeColor.RED, PatternType.STRIPE_TOP).pattern(DyeColor.YELLOW, PatternType.STRIPE_MIDDLE).pattern(DyeColor.LIME, PatternType.HALF_HORIZONTAL_MIRROR).pattern(DyeColor.YELLOW, PatternType.STRIPE_MIDDLE).pattern(DyeColor.BLUE, PatternType.STRIPE_BOTTOM).build());
    setting.setBoolean(true);
    service.save(setting);
    PlayerUtils.send(player, "&eHow did you even get here? I mean.... meow");
}
Also used : Player(org.bukkit.entity.Player) ItemBuilder(gg.projecteden.nexus.utils.ItemBuilder) SettingService(gg.projecteden.nexus.models.setting.SettingService) Setting(gg.projecteden.nexus.models.setting.Setting) CooldownService(gg.projecteden.nexus.models.cooldown.CooldownService) EventHandler(org.bukkit.event.EventHandler)

Example 5 with Setting

use of gg.projecteden.nexus.models.setting.Setting in project Nexus by ProjectEdenGG.

the class Easter20Command method onSignClick.

@EventHandler
public void onSignClick(PlayerInteractEvent event) {
    if (!ActionGroup.CLICK_BLOCK.applies(event))
        return;
    if (!MaterialTag.SIGNS.isTagged(event.getClickedBlock().getType()))
        return;
    if (event.getHand() == null || !event.getHand().equals(EquipmentSlot.HAND))
        return;
    Sign sign = (Sign) event.getClickedBlock().getState();
    if (!header.equals(sign.getLine(0)))
        return;
    SettingService service = new SettingService();
    Player player = event.getPlayer();
    Setting setting = service.get(player, "easter2020");
    Setting found = service.get(player, "easter2020Found");
    String name = sign.getLine(1);
    if (found.getValue() != null && found.getValue().contains(name)) {
        send(player, PREFIX + "You have already found this egg. Go search around warps for more");
        return;
    }
    int clicked = 0;
    if (Utils.isInt(setting.getValue()))
        clicked = Integer.parseInt(setting.getValue());
    clicked++;
    if (clicked == 19) {
        send(player, PREFIX + "You have found all the eggs! You have won &e$10,000");
        new BankerService().deposit(player, 10000, ShopGroup.SURVIVAL, TransactionCause.EVENT);
    } else if (clicked % 3 == 0) {
        ItemStack headPaper = new ItemBuilder(Material.PAPER).name("&3Coupon for 1 HDB head").lore("&eThis coupon is valid for one head from the head database. " + "Claim it with a staff member").build();
        PlayerUtils.giveItem(player, headPaper);
        send(player, PREFIX + "You have found &e" + name + "'s &3easter egg. You have been given &eone head database coupon");
    } else {
        send(player, PREFIX + "You have found &e" + name + "'s &3easter egg. You have been given &e$500");
        new BankerService().deposit(player, 500, ShopGroup.SURVIVAL, TransactionCause.EVENT);
    }
    setting.setValue(clicked + "");
    service.save(setting);
    if (found.getValue() == null)
        found.setValue(name);
    else
        found.setValue(found.getValue() + name);
    service.save(found);
}
Also used : Player(org.bukkit.entity.Player) OfflinePlayer(org.bukkit.OfflinePlayer) ItemBuilder(gg.projecteden.nexus.utils.ItemBuilder) SettingService(gg.projecteden.nexus.models.setting.SettingService) Setting(gg.projecteden.nexus.models.setting.Setting) Sign(org.bukkit.block.Sign) BankerService(gg.projecteden.nexus.models.banker.BankerService) ItemStack(org.bukkit.inventory.ItemStack) EventHandler(org.bukkit.event.EventHandler)

Aggregations

Setting (gg.projecteden.nexus.models.setting.Setting)11 SettingService (gg.projecteden.nexus.models.setting.SettingService)7 Path (gg.projecteden.nexus.framework.commands.models.annotations.Path)6 WorldGuardUtils (gg.projecteden.nexus.utils.WorldGuardUtils)4 Permission (gg.projecteden.nexus.framework.commands.models.annotations.Permission)2 ItemBuilder (gg.projecteden.nexus.utils.ItemBuilder)2 NPC (net.citizensnpcs.api.npc.NPC)2 Location (org.bukkit.Location)2 World (org.bukkit.World)2 Player (org.bukkit.entity.Player)2 EventHandler (org.bukkit.event.EventHandler)2 ProtectedRegion (com.sk89q.worldguard.protection.regions.ProtectedRegion)1 Async (gg.projecteden.annotations.Async)1 Command (gg.projecteden.discord.appcommands.annotations.Command)1 RequiredRole (gg.projecteden.discord.appcommands.annotations.RequiredRole)1 NexusAppCommand (gg.projecteden.nexus.features.discord.appcommands.NexusAppCommand)1 BadgeUserService (gg.projecteden.nexus.models.badge.BadgeUserService)1 BankerService (gg.projecteden.nexus.models.banker.BankerService)1 CooldownService (gg.projecteden.nexus.models.cooldown.CooldownService)1 DiscordUser (gg.projecteden.nexus.models.discord.DiscordUser)1