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