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();
}));
}
}
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!");
}
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");
}
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()));
}
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);
}
Aggregations