Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deobfuscate blocks when gold panning #3921

Merged
merged 3 commits into from
Jul 31, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.annotation.Nonnull;
Expand All @@ -14,8 +15,10 @@

import io.github.thebusybiscuit.slimefun4.api.events.BlockPlacerPlaceEvent;
import io.github.thebusybiscuit.slimefun4.api.events.ExplosiveToolBreakBlocksEvent;
import io.github.thebusybiscuit.slimefun4.api.events.PlayerRightClickEvent;
import io.github.thebusybiscuit.slimefun4.api.events.ReactorExplodeEvent;
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;

import net.imprex.orebfuscator.api.OrebfuscatorService;

Expand Down Expand Up @@ -61,4 +64,14 @@ public void onExplosiveToolBreakBlocks(ExplosiveToolBreakBlocksEvent event) {
public void onReactorExplode(ReactorExplodeEvent event) {
this.service.deobfuscate(Arrays.asList(event.getLocation().getBlock()));
}

@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onGoldPanUse(PlayerRightClickEvent event) {
if (event.getSlimefunItem().isPresent() && event.getClickedBlock().isPresent()) {
String id = event.getSlimefunItem().get().getId();
if (id.equals(SlimefunItems.GOLD_PAN.getItemId()) || id.equals(SlimefunItems.NETHER_GOLD_PAN.getItemId())) {
this.service.deobfuscate(List.of(event.getClickedBlock().get()));
}
}
}
iTwins marked this conversation as resolved.
Show resolved Hide resolved
}
Loading