Search in sources :

Example 1 with Halloween20Service

use of gg.projecteden.nexus.models.halloween20.Halloween20Service in project Nexus by ProjectEdenGG.

the class CombinationLockProvider method init.

@Override
public void init(Player player, InventoryContents contents) {
    contents.fill(ClickableItem.empty(new ItemBuilder(Material.YELLOW_STAINED_GLASS_PANE).name(" ").build()));
    contents.fillRow(1, ClickableItem.empty(new ItemStack(Material.AIR)));
    contents.fillRow(4, ClickableItem.empty(new ItemStack(Material.AIR)));
    contents.set(2, 3, ClickableItem.empty(new ItemStack(Material.AIR)));
    contents.set(2, 5, ClickableItem.empty(new ItemStack(Material.AIR)));
    contents.set(5, 7, ClickableItem.from(new ItemBuilder(Material.LIME_WOOL).name("&aSubmit Code").build(), e -> {
        parseCode(player, contents);
    }));
    contents.set(5, 8, ClickableItem.from(new ItemBuilder(Material.RED_WOOL).name("&cReset").build(), e -> Halloween20Menus.openComboLock(player)));
    int[] numberSlots = { 9, 10, 11, 12, 13, 14, 15, 16, 17, 21, 23 };
    Halloween20Service service = new Halloween20Service();
    Halloween20User user = service.get(player);
    for (int i = 0; i < user.getFoundComboLockNumbers().size(); i++) {
        int j = i;
        contents.set(numberSlots[i], ClickableItem.from(new ItemBuilder(user.getFoundComboLockNumbers().get(i).getItem()).name("&e" + user.getFoundComboLockNumbers().get(i).getNumericalValue()).build(), e -> {
            if (foundIndex == 9)
                return;
            contents.set(numberSlots[j], ClickableItem.empty(new ItemStack(Material.AIR)));
            contents.set(4, foundIndex++, ClickableItem.empty(new ItemBuilder(user.getFoundComboLockNumbers().get(j).getItem()).name("&e" + user.getFoundComboLockNumbers().get(j).getNumericalValue()).build()));
            playerCode += user.getFoundComboLockNumbers().get(j).getNumericalValue();
        }));
    }
}
Also used : ItemBuilder(gg.projecteden.nexus.utils.ItemBuilder) ShopGroup(gg.projecteden.nexus.models.shop.Shop.ShopGroup) Gate(gg.projecteden.nexus.features.events.y2020.halloween20.quest.Gate) SmartInventory(fr.minuskube.inv.SmartInventory) Tasks(gg.projecteden.nexus.utils.Tasks) Sound(org.bukkit.Sound) Player(org.bukkit.entity.Player) Halloween20(gg.projecteden.nexus.features.events.y2020.halloween20.Halloween20) ItemStack(org.bukkit.inventory.ItemStack) Nullables.isNullOrEmpty(gg.projecteden.nexus.utils.Nullables.isNullOrEmpty) PlayerUtils(gg.projecteden.nexus.utils.PlayerUtils) TickTime(gg.projecteden.utils.TimeUtils.TickTime) TransactionCause(gg.projecteden.nexus.models.banker.Transaction.TransactionCause) Halloween20User(gg.projecteden.nexus.models.halloween20.Halloween20User) InventoryProvider(fr.minuskube.inv.content.InventoryProvider) InventoryContents(fr.minuskube.inv.content.InventoryContents) QuestStage(gg.projecteden.nexus.features.events.y2020.halloween20.models.QuestStage) MenuUtils(gg.projecteden.nexus.features.menus.MenuUtils) SmartInvsPlugin(fr.minuskube.inv.SmartInvsPlugin) BankerService(gg.projecteden.nexus.models.banker.BankerService) Halloween20Service(gg.projecteden.nexus.models.halloween20.Halloween20Service) Material(org.bukkit.Material) ClickableItem(fr.minuskube.inv.ClickableItem) Halloween20User(gg.projecteden.nexus.models.halloween20.Halloween20User) ItemBuilder(gg.projecteden.nexus.utils.ItemBuilder) Halloween20Service(gg.projecteden.nexus.models.halloween20.Halloween20Service) ItemStack(org.bukkit.inventory.ItemStack)

Example 2 with Halloween20Service

use of gg.projecteden.nexus.models.halloween20.Halloween20Service in project Nexus by ProjectEdenGG.

the class PicturePuzzleProvider method complete.

public void complete(Player player) {
    player.closeInventory();
    Halloween20Service service = new Halloween20Service();
    Halloween20User user = service.get(player);
    if (user.getFoundComboLockNumbers().contains(number)) {
        PlayerUtils.send(player, Halloween20.PREFIX + "You already know of this number. Maybe there's some more.");
        return;
    }
    user.getFoundComboLockNumbers().add(number);
    PlayerUtils.send(player, Halloween20.PREFIX + "The number &e" + number.getNumericalValue() + "&3 can now be used on the combination lock at the entrance to the city.");
    service.save(user);
    if (user.getFoundComboLockNumbers().size() == 11)
        PlayerUtils.send(player, Halloween20.PREFIX + "You have found all the numbers for the combination lock. Return to see if you can crack the code!");
}
Also used : Halloween20User(gg.projecteden.nexus.models.halloween20.Halloween20User) Halloween20Service(gg.projecteden.nexus.models.halloween20.Halloween20Service)

Example 3 with Halloween20Service

use of gg.projecteden.nexus.models.halloween20.Halloween20Service in project Nexus by ProjectEdenGG.

the class Halloween20 method onButtonClick.

@EventHandler
public void onButtonClick(PlayerInteractEvent event) {
    if (!ActionGroup.CLICK_BLOCK.applies(event))
        return;
    if (event.getHand() != EquipmentSlot.HAND)
        return;
    SoundButton button = SoundButton.getByLocation(event.getClickedBlock().getLocation());
    if (button == null)
        return;
    new SoundBuilder(button.getSound()).receiver(event.getPlayer()).play();
    Halloween20Service service = new Halloween20Service();
    Halloween20User user = service.get(event.getPlayer());
    if (user.getFoundButtons().contains(button)) {
        if (new CooldownService().check(event.getPlayer(), "halloween20-button-alreadyfound", TickTime.SECOND.x(10)))
            user.sendMessage(PREFIX + "You've already found this button!");
        return;
    }
    user.getFoundButtons().add(button);
    service.save(user);
    user.sendMessage(PREFIX + "You have found a spooky button! &e(" + user.getFoundButtons().size() + "/" + SoundButton.values().length + ")");
    if (user.getFoundButtons().size() != SoundButton.values().length)
        return;
    PermissionChange.set().player(event.getPlayer()).permissions("powder.powder.spookyscaryskeletons").runAsync();
    user.sendMessage(PREFIX + "You have unlocked the Spooky Scary Skeletons song! &c/songs");
}
Also used : SoundBuilder(gg.projecteden.nexus.utils.SoundBuilder) Halloween20User(gg.projecteden.nexus.models.halloween20.Halloween20User) Halloween20Service(gg.projecteden.nexus.models.halloween20.Halloween20Service) CooldownService(gg.projecteden.nexus.models.cooldown.CooldownService) SoundButton(gg.projecteden.nexus.features.events.y2020.halloween20.models.SoundButton) EventHandler(org.bukkit.event.EventHandler)

Example 4 with Halloween20Service

use of gg.projecteden.nexus.models.halloween20.Halloween20Service in project Nexus by ProjectEdenGG.

the class Halloween20 method onEnterGateRegion.

@EventHandler
public void onEnterGateRegion(PlayerEnteredRegionEvent event) {
    if (!event.getRegion().getId().equalsIgnoreCase(region + "_gate_open"))
        return;
    Halloween20User user = new Halloween20Service().get(event.getPlayer());
    if (user.getCombinationStage() != QuestStage.Combination.NOT_STARTED)
        return;
    Gate gate = new Gate(event.getPlayer());
    gate.open();
    Tasks.wait(TickTime.SECOND.x(4), gate::teleportIn);
    Tasks.wait(TickTime.SECOND.x(5), gate::close);
    Tasks.wait(TickTime.SECOND.x(8), () -> PlayerUtils.send(event.getPlayer(), "&7&oYou enter the land of the dead, and the large gate shuts behind you. You try to open it, but it appears to be locked."));
    Tasks.wait(TickTime.SECOND.x(14), () -> QuestNPC.DIEGO.sendScript(event.getPlayer()));
    Tasks.wait(TickTime.SECOND.x(15) + 300, () -> sendInstructions(event.getPlayer()));
}
Also used : Halloween20User(gg.projecteden.nexus.models.halloween20.Halloween20User) Halloween20Service(gg.projecteden.nexus.models.halloween20.Halloween20Service) Gate(gg.projecteden.nexus.features.events.y2020.halloween20.quest.Gate) EventHandler(org.bukkit.event.EventHandler)

Example 5 with Halloween20Service

use of gg.projecteden.nexus.models.halloween20.Halloween20Service in project Nexus by ProjectEdenGG.

the class Halloween20Command method reset.

@Path("reset [player]")
@Permission(Group.ADMIN)
void reset(@Arg("self") OfflinePlayer player) {
    Halloween20Service service = new Halloween20Service();
    Halloween20User user = service.get(player);
    user.setLostPumpkinsStage(QuestStage.LostPumpkins.NOT_STARTED);
    user.setFoundPumpkins(new ArrayList<>());
    user.setCombinationStage(QuestStage.Combination.NOT_STARTED);
    user.setFoundComboLockNumbers(new ArrayList<>());
    service.save(user);
}
Also used : Halloween20User(gg.projecteden.nexus.models.halloween20.Halloween20User) Halloween20Service(gg.projecteden.nexus.models.halloween20.Halloween20Service) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Permission(gg.projecteden.nexus.framework.commands.models.annotations.Permission)

Aggregations

Halloween20Service (gg.projecteden.nexus.models.halloween20.Halloween20Service)13 Halloween20User (gg.projecteden.nexus.models.halloween20.Halloween20User)13 Gate (gg.projecteden.nexus.features.events.y2020.halloween20.quest.Gate)5 Path (gg.projecteden.nexus.framework.commands.models.annotations.Path)5 EventHandler (org.bukkit.event.EventHandler)4 Pumpkin (gg.projecteden.nexus.features.events.y2020.halloween20.models.Pumpkin)3 Permission (gg.projecteden.nexus.framework.commands.models.annotations.Permission)3 QuestStage (gg.projecteden.nexus.features.events.y2020.halloween20.models.QuestStage)2 SoundButton (gg.projecteden.nexus.features.events.y2020.halloween20.models.SoundButton)2 BankerService (gg.projecteden.nexus.models.banker.BankerService)2 Player (org.bukkit.entity.Player)2 ClickableItem (fr.minuskube.inv.ClickableItem)1 SmartInventory (fr.minuskube.inv.SmartInventory)1 SmartInvsPlugin (fr.minuskube.inv.SmartInvsPlugin)1 InventoryContents (fr.minuskube.inv.content.InventoryContents)1 InventoryProvider (fr.minuskube.inv.content.InventoryProvider)1 Halloween20 (gg.projecteden.nexus.features.events.y2020.halloween20.Halloween20)1 ComboLockNumber (gg.projecteden.nexus.features.events.y2020.halloween20.models.ComboLockNumber)1 Combination (gg.projecteden.nexus.features.events.y2020.halloween20.models.QuestStage.Combination)1 Halloween20Menus (gg.projecteden.nexus.features.events.y2020.halloween20.quest.menus.Halloween20Menus)1