use of gg.projecteden.nexus.models.pugmas21.Pugmas21UserService in project Nexus by ProjectEdenGG.
the class Advent method onClickPresent.
@EventHandler
public void onClickPresent(PlayerInteractEvent event) {
final Player player = event.getPlayer();
if (event.getHand() != EquipmentSlot.HAND)
return;
if (!Pugmas21.isAtPugmas(player))
return;
final Block block = event.getClickedBlock();
if (block == null)
return;
if (block.getType() != Material.BARRIER)
return;
if (Pugmas21.isPastPugmas())
return;
final Advent21Config adventConfig = new Advent21ConfigService().get0();
final AdventPresent present = adventConfig.get(block.getLocation());
if (present == null)
return;
new Pugmas21UserService().edit(player, user -> user.advent().tryCollect(present));
}
Aggregations