夜雨晨风丶
本帖最后由 夜雨晨风丶 于 2022-5-26 16:53 编辑
  1. 槽位z:
  2.   attribute: true
  3.   limit:
  4.     - "lorecontains|药水"
  5.     - "lorecontains|道具"
  6.     - "lorecontains|食物"
复制代码
  1. Script:
  2.   # 用于判断物品的某行lore里是否包含了xxx
  3.   lorecontains: |-
  4.     function execute(player, itemStack, slotIdentifier, limitString){
  5.       limitString = limitString.replaceAll("&","§");
  6.       var lore = itemStack.getItemMeta().getLore();
  7.       if(lore!=null){
  8.         for(var i=0;i<lore.size();i++){
  9.           var line = lore.get(i).replaceAll(" ","");
  10.           if(line!=null && line.contains(limitString)){
  11.              return true;
  12.           }
  13.         }
  14.       }
  15.       player.sendMessage("§c§l该槽位只能放置: "+limitString);
  16.       return false;
  17.     }
复制代码


我想让某个槽位只要有 药水道具食物任意一个lore就可以放在该槽位。但是这个脚本是让物品必须同时拥有 药水道具 、食物三个lore才能放进槽位里。想让大佬改成只需要有任意一个lore就能放

==========================================
已解决,某知识星球(付费)内有大佬给出

第一页 上一页 下一页 最后一页