Skip to content

Commit

Permalink
Fix protection issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Sefiraat committed Mar 8, 2023
1 parent d67a92c commit 0d532d3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.libraries.dough.protection.Interaction;
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
import me.mrCookieSlime.Slimefun.api.BlockStorage;
import org.bukkit.Bukkit;
Expand Down Expand Up @@ -41,6 +43,11 @@ public void onRightClick(PlayerRightClickEvent e) {
e.cancel();

final Block blockClicked = optionalBlock.get();

if (!Slimefun.getProtectionManager().hasPermission(player, blockClicked, Interaction.BREAK_BLOCK)) {
return;
}

final UUID currentItemUuid = itemMap.get(blockClicked.getLocation());

if (currentItemUuid != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
import io.github.thebusybiscuit.slimefun4.core.handlers.BlockUseHandler;
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.libraries.dough.protection.Interaction;
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
import me.mrCookieSlime.Slimefun.api.BlockStorage;
import org.bukkit.Bukkit;
Expand Down Expand Up @@ -63,6 +65,11 @@ public void onRightClick(PlayerRightClickEvent e) {
e.cancel();

final Block blockClicked = optionalBlock.get();

if (!Slimefun.getProtectionManager().hasPermission(player, blockClicked, Interaction.BREAK_BLOCK)) {
return;
}

final UUID currentItemUuid = itemMap.get(blockClicked.getLocation());

// Stand already has an item, we try to remove this then return;
Expand Down

0 comments on commit 0d532d3

Please sign in to comment.