@@ -367,10 +367,27 @@ public void openSearch(PlayerProfile profile, String input, boolean addToHistory
367
367
menu .addItem (index , itemstack );
368
368
menu .addMenuClickHandler (index , (pl , slot , itm , action ) -> {
369
369
try {
370
- if (!isSurvivalMode ()) {
371
- pl .getInventory ().addItem (slimefunItem .getItem ().clone ());
372
- } else {
370
+ if (isSurvivalMode ()) {
373
371
displayItem (profile , slimefunItem , true );
372
+ } else if (pl .hasPermission ("slimefun.cheat.items" )) {
373
+ if (sfitem instanceof MultiBlockMachine ) {
374
+ Slimefun .getLocalization ().sendMessage (pl , "guide.cheat.no-multiblocks" );
375
+ } else {
376
+ ItemStack clonedItem = sfitem .getItem ().clone ();
377
+
378
+ if (action .isShiftClicked ()) {
379
+ clonedItem .setAmount (clonedItem .getMaxStackSize ());
380
+ }
381
+
382
+ pl .getInventory ().addItem (clonedItem );
383
+ }
384
+ } else {
385
+ /*
386
+ * Fixes #3548 - If for whatever reason,
387
+ * an unpermitted players gets access to this guide,
388
+ * this will be our last line of defense to prevent any exploit.
389
+ */
390
+ Slimefun .getLocalization ().sendMessage (pl , "messages.no-permission" , true );
374
391
}
375
392
} catch (Exception | LinkageError x ) {
376
393
printErrorMessage (pl , slimefunItem , x );
0 commit comments