1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-19 19:25:48 +00:00

Deobfuscate blocks when gold panning (#3921)

Co-authored-by: Jeroen <j.teriele1@students.uu.nl>
This commit is contained in:
Jeroen 2023-08-01 01:48:11 +02:00 committed by GitHub
parent fe99cbd451
commit ede45dd379
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,7 @@ package io.github.thebusybiscuit.slimefun4.integrations;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.annotation.Nonnull;
@ -14,8 +15,10 @@ import org.bukkit.event.Listener;
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;
@ -61,4 +64,11 @@ class OrebfuscatorIntegration implements Listener {
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()));
}
}
}