Search in sources :

Example 6 with GameEvent

use of com.voxelgameslib.voxelgameslib.event.GameEvent in project VoxelGamesLibv2 by VoxelGamesLib.

the class DuelVictoryCondition method onDeath.

@GameEvent
public void onDeath(@Nonnull PlayerDeathEvent e) {
    if (completed())
        return;
    DuelFeature duelFeature = getPhase().getFeature(DuelFeature.class);
    winner = duelFeature.getOther(e.getEntity().getUniqueId());
}
Also used : DuelFeature(com.voxelgameslib.voxelgameslib.feature.features.DuelFeature) GameEvent(com.voxelgameslib.voxelgameslib.event.GameEvent)

Example 7 with GameEvent

use of com.voxelgameslib.voxelgameslib.event.GameEvent in project VoxelGamesLibv2 by VoxelGamesLib.

the class VoteFeature method openVoteMenu.

@GameEvent
public void openVoteMenu(@Nonnull PlayerInteractEvent event, User user) {
    if ((event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) && openMenuItem.equals(event.getItem())) {
        InventoryMenuBuilder builder = new InventoryMenuBuilder().withSize(9).withTitle("Vote for a map");
        for (int id : availableMaps.keySet()) {
            MapInfo info = availableMaps.get(id);
            ItemStack item = new ItemBuilder(Material.PAPER).amount(id).name(info.getName()).lore(info.getAuthor()).build();
            builder.withItem(id - 1, item, (player, clickType, itemStack) -> confirmVote(user, id), ClickType.LEFT);
        }
        builder.show(user.getPlayer());
    }
}
Also used : ItemBuilder(com.voxelgameslib.voxelgameslib.utils.ItemBuilder) InventoryMenuBuilder(org.inventivetalent.menubuilder.inventory.InventoryMenuBuilder) MapInfo(com.voxelgameslib.voxelgameslib.map.MapInfo) ItemStack(org.bukkit.inventory.ItemStack) GameEvent(com.voxelgameslib.voxelgameslib.event.GameEvent)

Aggregations

GameEvent (com.voxelgameslib.voxelgameslib.event.GameEvent)7 AbstractScoreboard (com.voxelgameslib.voxelgameslib.components.scoreboard.AbstractScoreboard)2 Scoreboard (com.voxelgameslib.voxelgameslib.components.scoreboard.Scoreboard)2 Player (org.bukkit.entity.Player)2 DuelFeature (com.voxelgameslib.voxelgameslib.feature.features.DuelFeature)1 MapInfo (com.voxelgameslib.voxelgameslib.map.MapInfo)1 ItemBuilder (com.voxelgameslib.voxelgameslib.utils.ItemBuilder)1 Sign (org.bukkit.block.Sign)1 ItemStack (org.bukkit.inventory.ItemStack)1 Vector (org.bukkit.util.Vector)1 InventoryMenuBuilder (org.inventivetalent.menubuilder.inventory.InventoryMenuBuilder)1