use of gg.projecteden.nexus.features.events.y2020.halloween20.models.SoundButton 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");
}
Aggregations