Skip to content

Commit

Permalink
Deobfuscate blocks when gold panning (#3921)
Browse files Browse the repository at this point in the history
Co-authored-by: Jeroen <j.teriele1@students.uu.nl>
  • Loading branch information
iTwins and Jeroen authored Jul 31, 2023
1 parent fe99cbd commit ede45dd
Showing 1 changed file with 10 additions and 0 deletions.
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.items.tools.GoldPan;

import net.imprex.orebfuscator.api.OrebfuscatorService;

Expand Down Expand Up @@ -61,4 +64,11 @@ 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() && event.getSlimefunItem().get() instanceof GoldPan) {
this.service.deobfuscate(List.of(event.getClickedBlock().get()));
}
}
}

0 comments on commit ede45dd

Please sign in to comment.