Вопрос DeluxeMenus - Магазин книг зачарований. Покупка и продажа.

saxonov80

Пользователь
Сообщения
68
Решения
8
Плагин
DeluxMenus
Ядро сервера
  1. Purpur
Версия сервера
  1. 1.21
Ссылка
https://www.spigotmc.org/resources/deluxemenus.11734/
Хочу создать магазин книг зачарований. Нужно чтобы можно было как купить книгу, так и продать. Нужен пример с кодом. Заранее благодарю.
YAML:
  '1':
    material: book
    enchantments:
    - 'DURABILITY;5'
    slot: 1
    amount: 1
    display_name: '&bEnchanted book'
    lore:
    - ''
    - '&aleft click buy &eх1 - &610$'
    - '&cright click sell &eх1 - &60.1$'
    - ''
    - '&2Your balance: &e%vault_eco_balance_fixed%$'
    left_click_requirement:
      requirements:
        balance:
         type: has money
         amount: 10
         deny_commands:
         - '[sound] BLOCK_NOTE_BLOCK_IRON_XYLOPHONE'
         - '[message]'
         - '[message]&6&l(&e$&6&l) &cYou do not have enough funds to purchase this item!'
         - '[message]'
    right_click_requirement:
      requirements:
        item_check:
         type: has item
         material: book
         enchantments:
         - 'DURABILITY;5'
         amount: 1
         deny_commands:
         - '[sound] BLOCK_NOTE_BLOCK_IRON_XYLOPHONE'
         - '[message]'
         - '[message]&6&l(&e!&6&l) &cYou do not have enough items to sell this item!'
         - '[message]'
    left_click_commands:
      - '[takemoney] 10'
      - '[refresh]'
      - '[message]'
      - '[message]&6&l(&e$&6&l) &2Thank you for your purchase, your current balance is: &e%vault_eco_balance_fixed%$'
      - '[message]'
      - '[console] cmi give %player_name% enchanted_book e unbreaking:5 1 -s'
    right_click_commands:
      - '[givemoney] 0.1'
      - '[refresh]'
      - '[message]'
      - '[message]&6&l(&e$&6&l) &2Thank you for selling this product. Your current balance: &e%vault_eco_balance_fixed%$'
      - '[message]'
      - '[console] clear %player_name% enchanted_book e unbreaking:5 1 -s'
 
Решение
Все я решил свой вопрос!!!
YAML:
  '1':
    material: book
    enchantments:
    - 'DURABILITY;5'
    slot: 1
    amount: 1
    display_name: '&bEnchanted book'
    lore:
    - ''
    - '&aleft click buy &eх1 - &610$'
    - '&cright click sell &eх1 - &60.1$'
    - ''
    - '&2Your balance: &e%vault_eco_balance_fixed%$'
    left_click_requirement:
      requirements:
        balance:
         type: has money
         amount: 10
         deny_commands:
         - '[sound] BLOCK_NOTE_BLOCK_IRON_XYLOPHONE'
         - '[message]'
         - '[message]&6&l(&e$&6&l) &cYou do not have enough funds to purchase this item!'
         - '[message]'
    right_click_requirement:
      requirements:
        item_check:
         type: string equals
         input...
Все я решил свой вопрос!!!
YAML:
  '1':
    material: book
    enchantments:
    - 'DURABILITY;5'
    slot: 1
    amount: 1
    display_name: '&bEnchanted book'
    lore:
    - ''
    - '&aleft click buy &eх1 - &610$'
    - '&cright click sell &eх1 - &60.1$'
    - ''
    - '&2Your balance: &e%vault_eco_balance_fixed%$'
    left_click_requirement:
      requirements:
        balance:
         type: has money
         amount: 10
         deny_commands:
         - '[sound] BLOCK_NOTE_BLOCK_IRON_XYLOPHONE'
         - '[message]'
         - '[message]&6&l(&e$&6&l) &cYou do not have enough funds to purchase this item!'
         - '[message]'
    right_click_requirement:
      requirements:
        item_check:
         type: string equals
         input: '%checkitem_mat:enchanted_book,enchantments:unbreaking=5,amt:1%'
         output: 'yes'
         amount: 1
         deny_commands:
         - '[sound] BLOCK_NOTE_BLOCK_IRON_XYLOPHONE'
         - '[message]'
         - '[message]&6&l(&e!&6&l) &cYou do not have enough items to sell this item!'
         - '[message]'
    left_click_commands:
      - '[takemoney] 10'
      - '[refresh]'
      - '[message]'
      - '[message]&6&l(&e$&6&l) &2Thank you for your purchase, your current balance is: &e%vault_eco_balance_fixed%$'
      - '[message]'
      - '[console] cmi give %player_name% enchanted_book e unbreaking:5 1 -s'
    right_click_commands:
      - '[givemoney] 0.1'
      - '[refresh]'
      - '[message]'
      - '[message]&6&l(&e$&6&l) &2Thank you for selling this product. Your current balance: &e%vault_eco_balance_fixed%$'
      - '[message]'
      - '[console] clear %player_name% enchanted_book e unbreaking:5 1 -s'
Короче:
1. плейсхолдер checkitem_mat: - проверяет предмет в инвентаре, у меня enchanted_book
2. enchantments:unbreaking=5 - проверяет тип зачарования и уровень, у меня unbreaking, уровень 5
3. amt:1 - количество предметов 1, один потому что мне нужно чтоб продажа была по одному и покупка так же по одному.
 
Последнее редактирование:
щас скину как у меня это сделано, там как надо будет сам подредактируешь
Объединено

Код:
items:
  '1':
    material: IRON_SWORD
    slot: 11
    amount: 1
    display_name: '&6• Железный меч &7(x1)'
    lore:
    - ''
    - '&aЛКМ &7- Купить за &e$165'
    - '&cПКМ &7- Продать за &e$100'
    - ''
    - '&8» &fВаш баланс: &6$%vault_eco_balance_fixed%'
    left_click_requirement:
      requirements:
        balance:
          type: has money
          amount: 165
          deny_commands:
          - '[message]'
          - '[message]&c (&7$&c) У вас недостаточно средств для покупки!'
          - '[message]'
          - '[console] playsound entity.dolphin.attack player %player_name% ~ ~ ~ 1 2 1'
    right_click_requirement:
      requirements:
        item_check:
          type: has item
          material: IRON_SWORD
          amount: 1
          deny_commands:
          - '[message]'
          - '[message]&c (&7!&c) Нет необходимого предмета, либо кол-ва предметов для продажи!'
          - '[message]'
    left_click_commands:
      - '[takemoney] 165'
      - '[refresh]'
      - '[message]'
      - '[message]&a&l Магазин &8» &fВы успешно приобрели &eЖелезный меч'
      - '[message]'
      - '[console] give %player_name% iron_sword 1'
      - '[console] playsound minecraft:entity.villager.trade player %player_name% ~ ~ ~ 0.5 1 0.5'
    right_click_commands:
      - '[givemoney] 100'
      - '[refresh]'
      - '[message]'
      - '[message]&a&l Магазин &8» &fВы успешно продали &6Железный меч'
      - '[message]'
      - '[console] clear %player_name% iron_sword 1 '

тут можно и купить и продать
Объединено

щас скину как у меня это сделано, там как надо будет сам подредактируешь
Объединено

Код:
items:
  '1':
    material: IRON_SWORD
    slot: 11
    amount: 1
    display_name: '&6• Железный меч &7(x1)'
    lore:
    - ''
    - '&aЛКМ &7- Купить за &e$165'
    - '&cПКМ &7- Продать за &e$100'
    - ''
    - '&8» &fВаш баланс: &6$%vault_eco_balance_fixed%'
    left_click_requirement:
      requirements:
        balance:
          type: has money
          amount: 165
          deny_commands:
          - '[message]'
          - '[message]&c (&7$&c) У вас недостаточно средств для покупки!'
          - '[message]'
          - '[console] playsound entity.dolphin.attack player %player_name% ~ ~ ~ 1 2 1'
    right_click_requirement:
      requirements:
        item_check:
          type: has item
          material: IRON_SWORD
          amount: 1
          deny_commands:
          - '[message]'
          - '[message]&c (&7!&c) Нет необходимого предмета, либо кол-ва предметов для продажи!'
          - '[message]'
    left_click_commands:
      - '[takemoney] 165'
      - '[refresh]'
      - '[message]'
      - '[message]&a&l Магазин &8» &fВы успешно приобрели &eЖелезный меч'
      - '[message]'
      - '[console] give %player_name% iron_sword 1'
      - '[console] playsound minecraft:entity.villager.trade player %player_name% ~ ~ ~ 0.5 1 0.5'
    right_click_commands:
      - '[givemoney] 100'
      - '[refresh]'
      - '[message]'
      - '[message]&a&l Магазин &8» &fВы успешно продали &6Железный меч'
      - '[message]'
      - '[console] clear %player_name% iron_sword 1 '

тут можно и купить и продать
а уже все, не заметил форум прологал
 
щас скину как у меня это сделано, там как надо будет сам подредактируешь
Объединено

Код:
items:
  '1':
    material: IRON_SWORD
    slot: 11
    amount: 1
    display_name: '&6• Железный меч &7(x1)'
    lore:
    - ''
    - '&aЛКМ &7- Купить за &e$165'
    - '&cПКМ &7- Продать за &e$100'
    - ''
    - '&8» &fВаш баланс: &6$%vault_eco_balance_fixed%'
    left_click_requirement:
      requirements:
        balance:
          type: has money
          amount: 165
          deny_commands:
          - '[message]'
          - '[message]&c (&7$&c) У вас недостаточно средств для покупки!'
          - '[message]'
          - '[console] playsound entity.dolphin.attack player %player_name% ~ ~ ~ 1 2 1'
    right_click_requirement:
      requirements:
        item_check:
          type: has item
          material: IRON_SWORD
          amount: 1
          deny_commands:
          - '[message]'
          - '[message]&c (&7!&c) Нет необходимого предмета, либо кол-ва предметов для продажи!'
          - '[message]'
    left_click_commands:
      - '[takemoney] 165'
      - '[refresh]'
      - '[message]'
      - '[message]&a&l Магазин &8» &fВы успешно приобрели &eЖелезный меч'
      - '[message]'
      - '[console] give %player_name% iron_sword 1'
      - '[console] playsound minecraft:entity.villager.trade player %player_name% ~ ~ ~ 0.5 1 0.5'
    right_click_commands:
      - '[givemoney] 100'
      - '[refresh]'
      - '[message]'
      - '[message]&a&l Магазин &8» &fВы успешно продали &6Железный меч'
      - '[message]'
      - '[console] clear %player_name% iron_sword 1 '

тут можно и купить и продать
Объединено


а уже все, не заметил форум прологал
Спасибо тебе)))
 
Назад
Сверху Снизу