Search in sources :

Example 1 with Pugmas21

use of gg.projecteden.nexus.features.events.y2021.pugmas21.Pugmas21 in project Nexus by ProjectEdenGG.

the class AdventMenu method init.

@Override
public void init() {
    int row = 1;
    int column = Pugmas21.EPOCH.getDayOfWeek().getValue() + 1;
    final SlotIterator slotIterator = innerSlotIterator(contents, SlotPos.of(row, column));
    for (int day = 1; day <= 25; day++) {
        final int _day = day;
        final LocalDate date = Pugmas21.EPOCH.plusDays(_day - 1);
        final Icon icon = getIcon(date);
        final ItemBuilder item = new ItemBuilder(icon.getItem(_day));
        ClickableItem clickableItem = ClickableItem.empty(item.build());
        if (user.advent().hasFound(_day)) {
            item.lore("", "&aShow Waypoint");
            clickableItem = ClickableItem.of(item.build(), e -> {
                player.closeInventory();
                Advent.glow(user, _day);
            });
        }
        slotIterator.next().set(clickableItem);
    }
    updateTask(player, contents);
}
Also used : ItemBuilder(gg.projecteden.nexus.utils.ItemBuilder) AdventPresent(gg.projecteden.nexus.models.pugmas21.Advent21Config.AdventPresent) NonNull(lombok.NonNull) RequiredArgsConstructor(lombok.RequiredArgsConstructor) Tasks(gg.projecteden.nexus.utils.Tasks) InventoryContents(gg.projecteden.nexus.features.menus.api.content.InventoryContents) Player(org.bukkit.entity.Player) ClickableItem(gg.projecteden.nexus.features.menus.api.ClickableItem) SlotIterator(gg.projecteden.nexus.features.menus.api.content.SlotIterator) IteratableEnum(gg.projecteden.utils.EnumUtils.IteratableEnum) Advent21Config(gg.projecteden.nexus.models.pugmas21.Advent21Config) Pugmas21User(gg.projecteden.nexus.models.pugmas21.Pugmas21User) SlotPos(gg.projecteden.nexus.features.menus.api.content.SlotPos) LocalDate(java.time.LocalDate) InventoryProvider(gg.projecteden.nexus.features.menus.api.content.InventoryProvider) StringUtils.colorize(gg.projecteden.nexus.utils.StringUtils.colorize) Pugmas21(gg.projecteden.nexus.features.events.y2021.pugmas21.Pugmas21) AllArgsConstructor(lombok.AllArgsConstructor) NotNull(org.jetbrains.annotations.NotNull) Material(org.bukkit.Material) MenuUtils.innerSlotIterator(gg.projecteden.nexus.features.menus.MenuUtils.innerSlotIterator) ItemBuilder(gg.projecteden.nexus.utils.ItemBuilder) SlotIterator(gg.projecteden.nexus.features.menus.api.content.SlotIterator) MenuUtils.innerSlotIterator(gg.projecteden.nexus.features.menus.MenuUtils.innerSlotIterator) ClickableItem(gg.projecteden.nexus.features.menus.api.ClickableItem) LocalDate(java.time.LocalDate)

Example 2 with Pugmas21

use of gg.projecteden.nexus.features.events.y2021.pugmas21.Pugmas21 in project Nexus by ProjectEdenGG.

the class Pugmas21Command method advent.

@Path("advent")
@Description("Open the advent calender")
void advent(@Arg(value = "0", permission = Group.ADMIN) @Switch int day, @Arg(value = "30", permission = Group.ADMIN) @Switch int frameTicks) {
    verifyDate();
    LocalDate date = Pugmas21.TODAY;
    if (date.isBefore(Pugmas21.EPOCH) || day > 0)
        date = Pugmas21.EPOCH.plusDays(day - 1);
    new AdventMenu(user, date, frameTicks).open(player());
}
Also used : AdventMenu(gg.projecteden.nexus.features.events.y2021.pugmas21.advent.AdventMenu) LocalDate(java.time.LocalDate) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Description(gg.projecteden.nexus.framework.commands.models.annotations.Description)

Example 3 with Pugmas21

use of gg.projecteden.nexus.features.events.y2021.pugmas21.Pugmas21 in project Nexus by ProjectEdenGG.

the class Advent method onDistrictEnter.

@EventHandler
public void onDistrictEnter(PlayerEnteredRegionEvent event) {
    Player player = event.getPlayer();
    if (!Pugmas21.isAtPugmas(player))
        return;
    District district = District.of(player.getLocation());
    if (district != null && district != District.UNKNOWN)
        ActionBarUtils.sendActionBar(player, "&a&lEntering " + district.getFullName());
}
Also used : Player(org.bukkit.entity.Player) District(gg.projecteden.nexus.features.events.y2021.pugmas21.models.District) EventHandler(org.bukkit.event.EventHandler)

Example 4 with Pugmas21

use of gg.projecteden.nexus.features.events.y2021.pugmas21.Pugmas21 in project Nexus by ProjectEdenGG.

the class Advent method onDistrictExit.

@EventHandler
public void onDistrictExit(PlayerLeavingRegionEvent event) {
    Player player = event.getPlayer();
    if (!Pugmas21.isAtPugmas(player))
        return;
    District district = District.of(player.getLocation());
    if (district != null && district != District.UNKNOWN)
        ActionBarUtils.sendActionBar(player, "&c&lExiting " + district.getFullName());
}
Also used : Player(org.bukkit.entity.Player) District(gg.projecteden.nexus.features.events.y2021.pugmas21.models.District) EventHandler(org.bukkit.event.EventHandler)

Aggregations

Player (org.bukkit.entity.Player)3 District (gg.projecteden.nexus.features.events.y2021.pugmas21.models.District)2 LocalDate (java.time.LocalDate)2 EventHandler (org.bukkit.event.EventHandler)2 Pugmas21 (gg.projecteden.nexus.features.events.y2021.pugmas21.Pugmas21)1 AdventMenu (gg.projecteden.nexus.features.events.y2021.pugmas21.advent.AdventMenu)1 MenuUtils.innerSlotIterator (gg.projecteden.nexus.features.menus.MenuUtils.innerSlotIterator)1 ClickableItem (gg.projecteden.nexus.features.menus.api.ClickableItem)1 InventoryContents (gg.projecteden.nexus.features.menus.api.content.InventoryContents)1 InventoryProvider (gg.projecteden.nexus.features.menus.api.content.InventoryProvider)1 SlotIterator (gg.projecteden.nexus.features.menus.api.content.SlotIterator)1 SlotPos (gg.projecteden.nexus.features.menus.api.content.SlotPos)1 Description (gg.projecteden.nexus.framework.commands.models.annotations.Description)1 Path (gg.projecteden.nexus.framework.commands.models.annotations.Path)1 Advent21Config (gg.projecteden.nexus.models.pugmas21.Advent21Config)1 AdventPresent (gg.projecteden.nexus.models.pugmas21.Advent21Config.AdventPresent)1 Pugmas21User (gg.projecteden.nexus.models.pugmas21.Pugmas21User)1 ItemBuilder (gg.projecteden.nexus.utils.ItemBuilder)1 StringUtils.colorize (gg.projecteden.nexus.utils.StringUtils.colorize)1 Tasks (gg.projecteden.nexus.utils.Tasks)1