Skip to content

Commit

Permalink
Update SurvivalSlimefunGuide.java
Browse files Browse the repository at this point in the history
  • Loading branch information
JustAHuman-xD authored Nov 19, 2024
1 parent d12ae85 commit 2dff0fb
Showing 1 changed file with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -367,10 +367,27 @@ public void openSearch(PlayerProfile profile, String input, boolean addToHistory
menu.addItem(index, itemstack);
menu.addMenuClickHandler(index, (pl, slot, itm, action) -> {
try {
if (!isSurvivalMode()) {
pl.getInventory().addItem(slimefunItem.getItem().clone());
} else {
if (isSurvivalMode()) {
displayItem(profile, slimefunItem, true);
} else if (pl.hasPermission("slimefun.cheat.items")) {
if (sfitem instanceof MultiBlockMachine) {
Slimefun.getLocalization().sendMessage(pl, "guide.cheat.no-multiblocks");
} else {
ItemStack clonedItem = sfitem.getItem().clone();

if (action.isShiftClicked()) {
clonedItem.setAmount(clonedItem.getMaxStackSize());
}

pl.getInventory().addItem(clonedItem);
}
} else {
/*
* Fixes #3548 - If for whatever reason,
* an unpermitted players gets access to this guide,
* this will be our last line of defense to prevent any exploit.
*/
Slimefun.getLocalization().sendMessage(pl, "messages.no-permission", true);
}
} catch (Exception | LinkageError x) {
printErrorMessage(pl, slimefunItem, x);
Expand Down

0 comments on commit 2dff0fb

Please sign in to comment.