Skip to content
Open
Changes from all commits
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 @@ -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 (slimefunItem instanceof MultiBlockMachine) {
Slimefun.getLocalization().sendMessage(pl, "guide.cheat.no-multiblocks");
} else {
ItemStack clonedItem = slimefunItem.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
Loading