Skip to content

Commit

Permalink
Update VisitorDropProtection.java
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamKracker authored Nov 25, 2024
1 parent f3755ef commit 383a401
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ private void updateSlots(Slot slot) {

protected final ItemStack disabledItem = new ItemBuilder(Items.BARRIER).hideAdditionalTooltips().set(CookiesDataComponentTypes.ITEM_CLICK_RUNNABLE, Runnables.doNothing()).setName(Text.of("Refusing temporarily disabled due to rare drop")).set(DataComponentTypes.RARITY, Rarity.COMMON).build();

private void handleRejectButton(ItemStack rejectButton, boolean visitorItemLore)
{
private void handleRejectButton(ItemStack rejectButton, boolean visitorItemLore) {
if(rejectButton.isEmpty() || !rejectButton.isOf(Items.RED_TERRACOTTA) || !visitorItemLore) {
return;
}
Expand All @@ -62,16 +61,14 @@ public void run() {
);
}

private boolean handleAcceptItem(ItemStack visitorItem)
{
private boolean handleAcceptItem(ItemStack visitorItem) {
if(visitorItem == null || visitorItem.isEmpty() || !visitorItem.isOf(Items.GREEN_TERRACOTTA) || !visitorItem.contains(DataComponentTypes.LORE)) {
return false;
}
var lore = String.join("\n", visitorItem.get(DataComponentTypes.LORE).lines().stream().map(Text::getString).toArray(String[]::new));
Pattern pattern = Pattern.compile("Rewards:([\\S\\s]*)(?:Click|Missing)");
Matcher matcher = pattern.matcher(lore);
if (!matcher.find())
{
if (!matcher.find()) {
return false;
}

Expand Down

0 comments on commit 383a401

Please sign in to comment.