Advertisement
L0v0lup

Skript📷Custom Craftingrezepte 2.0 #140 Tutorial

Oct 2nd, 2020
3,794
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. on script load:
  2.     load yaml "plugins/Systeme/Rezeptemessages.yml" as "Recipemessage"
  3.    
  4. on script load:
  5.     load yaml "plugins/Systeme/RezepteIDS.yml" as "RecipesIDS"
  6.     set {_RecipeitemIDs::*} to yaml nodes with keys "Items.All." from "RecipesIDS"
  7.     loop {_RecipeitemIDs::*}:
  8.         set {_id} to loop-value
  9.         load yaml "plugins/Systeme/Rezepte/%{_id}%.yml" as "%{_id}%"
  10.         set {_shape} to yaml value "Items.All.%{_id}%.Shape" in "%{_id}%"
  11.         set {_group} to yaml value "Items.All.%{_id}%.Group" in "%{_id}%"
  12.         if {_shape} is "Ofen", "Smoker" or "Campfire":
  13.             set {_resulte} to yaml value "Items.All.%{_id}%.Result" in "%{_id}%"
  14.             set {_needed} to yaml value "Items.All.%{_id}%.Needed" in "%{_id}%"
  15.             set {_exp} to yaml value "Items.All.%{_id}%.Exp" in "%{_id}%"
  16.             set {_kochzeit} to yaml value "Items.All.%{_id}%.Kochzeit" in "%{_id}%"
  17.             if {_shape} is "Ofen":
  18.                 register new furnace recipe for {_resulte} using {_needed} with id "%{_id}%" and with exp {_exp} and with cook time {_kochzeit}
  19.             else if {_shape} is "Campfire":
  20.                 register new Campfire recipe for {_resulte} using {_needed} with id "%{_id}%" and with exp {_exp} and with cook time {_kochzeit}
  21.             else if {_shape} is "Smoker":
  22.                 register new smoker recipe for {_resulte} using {_needed} with id "%{_id}%" and with exp {_exp} and with cook time {_kochzeit}
  23.         if {_shape} is "Stonecutter":
  24.             set {_result} to yaml value "Items.All.%{_id}%.Result" in "%{_id}%"
  25.             set {_needed} to yaml value "Items.All.%{_id}%.Needed" in "%{_id}%"
  26.             register stone cutter recipe for {_result} using {_needed} with id {_id} in group {_group}
  27.         set {_result} to yaml value "Items.All.%{_id}%.Result" from "%{_id}%"
  28.         set {_needed::*} to yaml nodes with keys "Items.All.%{_id}%.Slots." from "%{_id}%"
  29.         set {_shape} to yaml value "Items.All.%{_id}%.Shape" in "%{_id}%"
  30.         loop {_needed::*}:
  31.             set {_slots::%loop-index-2 parsed as integer%} to yaml value "Items.All.%{_id}%.Slots.%loop-value-2%" from "%{_id}%"
  32.         if {_shape} is "Shaped":
  33.             register new shaped recipe for {_result} using {_slots::*} with id "%{_id}%" in group "%{_group}%"
  34.         else if {_shape} is "Shapeless":
  35.             register new shapeless recipe for {_result} using {_slots::*} with id "%{_id}%" in group "%{_group}%"
  36.         wait a tick
  37.         unload yaml "%{_id}%"
  38.  
  39. import:
  40.     org.bukkit.event.inventory.InventoryType
  41.     org.bukkit.Bukkit
  42.    
  43. function RecipeMenu(p: player):
  44.     set metadata tag "RezepteMenĂź" of {_p} to chest inventory with 3 rows named "&cRezepte-MenĂź"
  45.     open metadata tag "RezepteMenĂź" of {_p} to {_p}
  46.     set slot (integers from 0 to 27) of {_p}'s current inventory to gray stained glass pane named " "
  47.     set slot 10 of {_p}'s current inventory to crafting table named "&cShape/Shaped Erstellen" 
  48.     set slot 11 of {_p}'s current inventory to furnace named "&6Ofen Rezepte"
  49.     set slot 12 of {_p}'s current inventory to smoker named "&bSmoker Rezepte"
  50.     set slot 13 of {_p}'s current inventory to campfire named "&eCampfire Rezepte"
  51.     set slot 14 of {_p}'s current inventory to stonecutter named "&3Stonecutter Rezepte"
  52.     set slot 17 of {_p}'s current inventory to feather named "&cAuflisten"
  53. function CraftingRecipe(p: player):
  54.     set slot (integers from 0 to 54) of {_p}'s current inventory to gray stained glass pane named " "
  55.     set slot 10,11,12,19,20,21,28,29 and 30 of {_p}'s current inventory to air
  56.     set slot 24 of {_p}'s current inventory to air
  57.     set slot 42 of {_p}'s current inventory to lime dye named "&eBestätigen"
  58.     set slot 49 of {_p}'s current inventory to name tag named "&cID: &6-" with lore "&7Mich anklicken, um eine ID zu erstellen!"
  59.     set slot 50 of {_p}'s current inventory to chest named "&6Gruppe: &6-" with lore "&7Mich anklicken, um eine Gruppe auszuwählen!"
  60.     set slot 36 of {_p}'s current inventory to bucket named "&eShaped"
  61.     set slot 37 of {_p}'s current inventory to grass block named "&eShapeless"
  62. function FireCreationGui(p: player):
  63.     set slot (integers from 0 to 54) of {_p}'s current inventory to gray stained glass pane named " "
  64.     set slot 20 of {_p}'s current inventory to air
  65.     set slot 24 of {_p}'s current inventory to air
  66.     set slot 42 of {_p}'s current inventory to lime dye named "&eBestätigen"
  67.     set slot 49 of {_p}'s current inventory to anvil named "&cID: &6-" with lore "&7Mich anklicken, um eine ID zu erstellen!"  
  68.     set slot 36 of {_p}'s current inventory to bottle o' enchanting named "&eErfahrung"
  69.     set slot 37 of {_p}'s current inventory to furnace named "&eKochzeit &c(in Sekunden)"
  70. #------------------------------------------------
  71. expression id of recipe for %player%:
  72.     return type: string
  73.     get:
  74.         set {_id::*} to split uncoloured name of slot 49 of expr-1's current inventory at " "
  75.         return {_id::2}
  76. expression group of recipe for %player%:
  77.     return type: string
  78.     get:
  79.         set {_id::*} to split uncoloured name of slot 50 of expr-1's current inventory at " "
  80.         return {_id::2}
  81. expression current recipe page of %player%:
  82.     return type: integer
  83.     get:
  84.         set {_page::*} to split uncoloured line 1 of lore of slot 49 of expr-1's current inventory at " "
  85.         set {_page::*} to split {_page::2} at "/"
  86.         return {_page::1} parsed as integer
  87. expression ingredient list for recipe %string% for %player%:
  88.     return type: item
  89.     get:
  90.         if expr-1 is "Shape/Shaped":
  91.             set {_list::*} to slot 10,11,12,19,20,21,28,29 and 30 of expr-2's current inventory
  92.             return {_list::*}
  93. expression cooking time of recipe for %player%:
  94.     return type: string
  95.     get:
  96.         set {_id::*} to split uncoloured name of slot 37 of expr-1's current inventory at " "
  97.         return {_id::2}
  98. expression experience of recipe for %player%:
  99.     return type: string
  100.     get:
  101.         set {_id::*} to split uncoloured name of slot 36 of expr-1's current inventory at " "
  102.         return {_id::2}
  103. #------------------------------------------------
  104. effect save oldgui of %player%:
  105.     trigger:
  106.         set metadata tag "OldGUI" of expr-1 to expr-1's current inventory
  107.         loop integers from 0 to 54:
  108.             set {_d} to slot loop-number of expr-1's current inventory
  109.             set slot loop-number of metadata tag "OldGUI" of expr-1 to {_d}
  110. effect open anvil ID inventory for %player%:
  111.     trigger:
  112.         set metadata tag "AnvilID" of expr-1 to true
  113.         set {_inv} to Bukkit.createInventory(expr-1 and InventoryType.ANVIL)
  114.         expr-1.openInventory({_inv})
  115.         wait a tick
  116.         set {_packet} to new play_server_set_slot packet
  117.         set int field 0 of {_packet} to expr-1.getHandle().activeContainer.windowId
  118.         set int field 1 of {_packet} to 0
  119.         set itemstack field 0 of {_packet} to paper named " "
  120.         send packet {_packet} to expr-1
  121.         delete {packet::cInv.%expr-1%}
  122. effect save recipe with result %item% and ingredients %items% and shape %string% and id %string% [in group %-string%]:
  123.     trigger:
  124.         load yaml "plugins/Systeme/RezepteIDS.yml" as "RecipesIDS"
  125.         load yaml "plugins/Systeme/Rezepte/%expr-4%.yml" as "%expr-4%"
  126.         set yaml value "Items.All.%expr-4%" in "RecipesIDS" to expr-4
  127.         set yaml value "Items.All.%expr-4%.Shape" in "%expr-4%" to expr-3
  128.         set yaml value "Items.All.%expr-4%.Group" in "%expr-4%" to expr-5 if expr-5 is not "-"
  129.         set {_ingredients::*} to exprs-2
  130.         loop {_ingredients::*}:
  131.             set yaml value "Items.All.%expr-4%.Slots.%loop-index parsed as integer%" in "%expr-4%" to loop-value
  132.         set yaml value "Items.All.%expr-4%.Result" in "%expr-4%" to expr-1
  133.         save yaml "%expr-4%"
  134.         save yaml "RecipesIDS"
  135. effect open recipe gui with id %string% to %player% [edit mode %-boolean%]:
  136.     trigger:
  137.         set {_id} to expr-1
  138.         set {_player} to expr-2
  139.         set {_editmode} to expr-3 ? false
  140.         load yaml "plugins/Systeme/Rezepte/%{_id}%.yml" as "%{_id}%"
  141.         set {_result} to yaml value "Items.All.%{_id}%.Result" from "%{_id}%"
  142.         set {_shape} to yaml value "Items.All.%{_id}%.Shape" from "%{_id}%"
  143.         if {_shape} is "shaped" or "shapeless":
  144.             loop 9 times:
  145.                 set {_Ingredients::%loop-number%} to yaml value "Items.All.%{_id}%.Slots.%loop-number%" from "%{_id}%"
  146.             if {_editmode} is false:
  147.                 set metadata tag "ShowRecipe" of {_player} to chest inventory with 6 rows named "&cRezepte"
  148.                 set slot (integers from 0 to 54) of metadata tag "ShowRecipe" of {_player} to gray stained glass pane named " "
  149.                 set slot 24 of metadata tag "ShowRecipe" of {_player} to {_result}
  150.                 set {_slots::*} to 10,11,12,19,20,21,28,29 and 30
  151.                 loop {_slots::*}:
  152.                     set slot loop-value of metadata tag "ShowRecipe" of {_player} to {_Ingredients::%loop-index parsed as integer%}
  153.                 open metadata tag "ShowRecipe" of {_player} to {_player}
  154.             else:
  155.                 set metadata tag "&cShape/Shaped Erstellen" of {_player} to chest inventory with 6 rows named "&cShape/Shaped Erstellen"
  156.                 open metadata tag "&cShape/Shaped Erstellen" of {_player} to {_player}
  157.                 CraftingRecipe({_player})
  158.                 set {_group} to yaml value "Items.All.%{_id}%.Group" from "%{_id}%"
  159.                 set slot 24 of {_player}'s current inventory to {_result}
  160.                 set slot 49 of {_player}'s current inventory to name tag named "&cID: &6%{_id}%"
  161.                 set slot 50 of {_player}'s current inventory to chest named "&6Gruppe: &6%{_group}%"
  162.                 set {_slots::*} to 10,11,12,19,20,21,28,29 and 30
  163.                 loop {_slots::*}:
  164.                     set slot loop-value of {_player}'s current inventory to {_Ingredients::%loop-index parsed as integer%}
  165.                 if {_shape} is "shaped":
  166.                     set {_slot} to 36
  167.                 else:
  168.                     set {_slot} to 37
  169.                 enchant slot {_slot} of {_player}'s current inventory with unbreaking 1
  170.         else:
  171.             set {_c} to "&6" if {_shape} is "Ofen"
  172.             set {_c} to "&b" if {_shape} is "Smoker"
  173.             set {_c} to "&e" if {_shape} is "Campfire"
  174.             set {_c} to "&3" if {_shape} is "Stonecutter"
  175.             open chest inventory with 6 rows named colored "%{_c}%%{_shape}% Rezepte" to {_player}
  176.             if {_shape} is not "Stonecutter":
  177.                 FireCreationGui({_player})
  178.                 set {_ingredient} to yaml value "Items.All.%{_id}%.Needed" in "%{_id}%"
  179.                 set {_exp} to yaml value "Items.All.%{_id}%.Exp" in "%{_id}%"
  180.                 set {_koch} to yaml value "Items.All.%{_id}%.Kochzeit" in "%{_id}%"
  181.                 set slot 24 of {_player}'s current inventory to {_result}
  182.                 set slot 20 of {_player}'s current inventory to {_ingredient}
  183.                 set slot 49 of {_player}'s current inventory to name tag named "&cID: &6%{_id}%"
  184.                 set name of slot 37 of {_player}'s current inventory to "&6Kochzeit: %{_koch}%"
  185.                 set name of slot 36 of {_player}'s current inventory to "&aErfahrung: %{_exp}%"
  186.             else:
  187.                 StoneCutterCreationGui({_player})
  188.                 set {_ingredient} to yaml value "Items.All.%{_id}%.Needed" in "%{_id}%"
  189.                 set {_exp} to yaml value "Items.All.%{_id}%.Exp" in "%{_id}%"  
  190.                 set {_ingredient} to yaml value "Items.All.%{_id}%.Needed" in "%{_id}%"
  191.                 set {_result} to yaml value "Items.All.%{_id}%.Result" in "%{_id}%"
  192.                 set {_group} to yaml value "Items.All.%{_id}%.Group" in "%{_id}%"
  193.                 set slot 20 of {_player}'s current inventory to {_ingredient}
  194.                 set slot 24 of {_player}'s current inventory to {_result}
  195.                 set slot 49 of {_player}'s current inventory to name tag named "&cID: &6%{_id}%"
  196.                 set slot 50 of {_player}'s current inventory to chest named "&6Gruppe: &6%{_group}%"
  197.                
  198.         set slot 43 of {_player}'s current inventory to lava bucket
  199.         unload yaml "%{_id}%"
  200.                
  201.  
  202.    
  203.            
  204. effect open recipes for %player% at page %string%:
  205.     trigger:
  206.         set {_expr2} to expr-2 parsed as integer
  207.         set {_page} to 36*{_expr2}
  208.         set {_from} to {_page}-36
  209.         set {_NextPageItem} to yaml value "GUI.ItemNextPage" from "Recipemessage"
  210.         set {_NextPreviousItem} to yaml value "GUI.ItemPreviousPage" from "Recipemessage"
  211.         set {_NextMainItem} to yaml value "GUI.ItemMainPage" from "Recipemessage"
  212.         load yaml "plugins/Systeme/RezepteIDS.yml" as "RecipesIDS"
  213.         set {_RecipeitemIDs::*} to yaml nodes with keys "Items.All." from "RecipesIDS"
  214.         set {_size} to size of {_RecipeitemIDs::*}
  215.         set {_maxPage} to ceil({_size}/36)
  216.         loop {_RecipeitemIDs::*}:
  217.             set {_id} to uncoloured loop-value
  218.             load yaml "plugins/Systeme/Rezepte/%{_id}%.yml" as "%{_id}%"
  219.             set {_shape} to yaml value "Items.All.%{_id}%.Shape" in "%{_id}%"
  220.             set {_group} to yaml value "Items.All.%{_id}%.Group" in "%{_id}%" ? """"
  221.             set {_Itesms::%loop-index parsed as integer%} to yaml value "Items.All.%{_id}%.Result" from "%{_id}%"
  222.             add "{ID:%{_id}%}" to nbt of {_Itesms::%loop-index parsed as integer%}
  223.             add "{Group:%{_group}%}" to nbt of {_Itesms::%loop-index parsed as integer%}
  224.             add "{Shape:%{_shape}%}" to nbt of {_Itesms::%loop-index parsed as integer%}
  225.             unload yaml "%{_id}%"
  226.         if metadata tag "Auflisten" of expr-1 is set:
  227.             set {_x} to -1
  228.             loop integers from 0 to 35:
  229.                 set slot loop-number of expr-1's current inventory to air
  230.             loop integers between {_from} and {_page}:
  231.                 set slot {_x} of current inventory of expr-1 to {_Itesms::%loop-number%}
  232.                 add 1 to {_x}
  233.             set line 1 of lore of slot 49 of expr-1's current inventory to "&6Seite: &c%{_expr2}%&7/&6%{_maxPage}%"
  234.         else:
  235.             set metadata tag "Auflisten" of expr-1 to chest inventory with 6 rows named "&cAuflisten"
  236.             open metadata tag "Auflisten" of expr-1 to expr-1
  237.             set slot 36,37,38,39,40,41,42,43, and 44 of expr-1's current inventory to red stained glass pane named " "
  238.             set {_x} to -1
  239.             loop integers between {_from} and {_page}:
  240.                 set slot {_x} of current inventory of expr-1 to {_Itesms::%loop-number%}
  241.                 add 1 to {_x}
  242.             set line 1 of lore of slot 49 of expr-1's current inventory to "&6Seite: &c%{_expr2}%&7/&6%{_maxPage}%"
  243.         set slot 49 of expr-1's current inventory to {_NextMainItem} with lore "&6Seite: &c%{_expr2}%&7/&6%{_maxPage}%"
  244.         set slot 50 of expr-1's current inventory to {_NextPageItem} if {_maxPage} > {_expr2}
  245.         set slot 48 of expr-1's current inventory to {_NextPreviousItem} if {_expr2} > 1
  246. on inventory click:
  247.     metadata tag "Auflisten" of player is set
  248.     slot 49 of event-inventory = a cake
  249.     cancel event
  250.     if index of event-slot = 50:
  251.         set {_page} to (current recipe page of player)+1
  252.         open recipes for player at page "%{_page}%"
  253.     else if index of event-slot = 49:
  254.         open recipes for player at page "1"
  255.     else if index of event-slot = 48:
  256.         {_page::1} != 1
  257.         set {_page} to (current recipe page of player)-1
  258.         open recipes for player at page "%{_page}%"
  259.     else:
  260.         if index of event-slot != 36,37,38,39,40,41,42,43 or 44:
  261.             set {_id} to tag "ID" of nbt of event-slot
  262.             open recipe gui with id {_id} to player edit mode true
  263. #------------------------------------------------
  264. on packet event play_client_item_name:
  265.     metadata tag "AnvilID" of event-player is true
  266.     set {ID::%player%} to string field 0 of event-packet
  267.  
  268. on inventory click:
  269.     type of event-inventory = anvil inventory
  270.     index of event-slot = 2
  271.     metadata tag "AnvilID" of player is true
  272.     delete metadata tag "AnvilID" of player
  273.     open metadata tag "OldGUI" of player to player
  274.     set slot {slot} of player's current inventory to {slotitem} named "%{text}% %{ID::%player%}%"
  275.     delete {slot} and {slotitem}, {text} and {ID::%player%}
  276.     delete metadata tag "OldGUI" of player
  277. #-------------------------------------------------
  278.    
  279. command rezepte [<text>]:
  280.     permission: *
  281.     trigger:
  282.         RecipeMenu(player)
  283.        
  284. function StoneCutterCreationGui(p: player):
  285.     set slot (integers from 0 to 54) of {_p}'s current inventory to gray stained glass pane named " "
  286.     set slot 20 of {_p}'s current inventory to air
  287.     set slot 24 of {_p}'s current inventory to air
  288.     set slot 42 of {_p}'s current inventory to lime dye named "&eBestätigen"
  289.     set slot 49 of {_p}'s current inventory to name tag named "&cID: &6-" with lore "&7Mich anklicken, um eine ID zu erstellen!"
  290.     set slot 50 of {_p}'s current inventory to chest named "&6Gruppe: &6-" with lore "&7Mich anklicken, um eine Gruppe auszuwählen"
  291.    
  292.    
  293. on inventory click:
  294.     #RezepteMenĂźAuswahlWelchesRezept
  295.     if event-inventory is metadata tag "RezepteMenĂź" of player:
  296.         cancel event
  297.         if index of event-slot is 10,11,12,13,14 or 17:
  298.             set {_guiName} to name of event-slot
  299.             set metadata tag "%{_guiName}%" of player to chest inventory with 6 rows named "%{_guiName}%"
  300.             open metadata tag "%{_guiName}%" of player to player
  301.             delete metadata tag "RezepteMenĂź" of player
  302.             if {_guiName} is "&cShape/Shaped Erstellen":
  303.                 CraftingRecipe(player)
  304.             else if {_guiName} is "&cAuflisten":
  305.                 open recipes for player at page "1"
  306.             else if {_guiName} is "&6Ofen Rezepte", "&bSmoker Rezepte" or "&eCampfire Rezepte":
  307.                 FireCreationGui(player)
  308.             else if {_guiName} is "&3Stonecutter Rezepte":
  309.                 StoneCutterCreationGui(player)
  310.     #CraftingRecipe
  311.     else if event-inventory is metadata tag "&cShape/Shaped Erstellen" of player:
  312.         cancel event if index of event-slot is not 10,11,12,19,20,21,28,29,30 or 24
  313.         #setshape/shapeless
  314.         if index of event-slot is 36 or 37:
  315.             disenchant slot 36 of event-inventory
  316.             disenchant slot 37 of event-inventory
  317.             enchant event-slot with unbreaking 1
  318.         else if index of event-slot is 49:
  319.             save oldgui of player
  320.             set {text} to colored "&cID:"
  321.             set {slot} to 49
  322.             set {slotitem} to name tag
  323.             open anvil ID inventory for player
  324.         else if index of event-slot = 42:
  325.             #get shape
  326.             if slot 36 of event-inventory is enchanted with unbreaking 1:
  327.                 set {_shape} to "shaped"
  328.             else:
  329.                 set {_shape} to "shapeless"
  330.             #getingredients
  331.             set {_ingredients::*} to ingredient list for recipe "Shape/Shaped" for player
  332.             #getresult
  333.             set {_result} to slot 24 of event-inventory
  334.             #getid
  335.             set {_id} to id of recipe for player
  336.             #getgroup
  337.             set {_group} to group of recipe for player
  338.             save recipe with result {_result} and ingredients {_ingredients::*} and shape {_shape} and id {_id} in group {_group}
  339.             close player's inventory
  340.         else if index of event-slot = 50:
  341.             save oldgui of player
  342.             set {slot} to 50
  343.             set {slotitem} to chest
  344.             set {text} to colored "&6Gruppe:"
  345.             open anvil ID inventory for player
  346.         else if index of event-slot = 43:
  347.             set {_id} to id of recipe for player
  348.             load yaml "plugins/Systeme/RezepteIDS.yml" as "RecipesIDS"
  349.             delete yaml value "Items.All.%{_id}%" from "RecipesIDS"
  350.             load yaml "plugins/Systeme/Rezepte/%{_id}%.yml" as "%{_id}%"
  351.             delete yaml "%{_id}%"
  352.             save yaml "plugins/Systeme/Rezepte/"
  353.             save yaml "RecipesIDS"
  354.             unload yaml "%{_id}%"
  355.             unload yaml "RecipesIDS"
  356.             open recipes for player at page "1"
  357.     else if event.getView().getTitle() is "&6Ofen Rezepte", "&bSmoker Rezepte" or "&eCampfire Rezepte":
  358.         event-inventory != player's inventory
  359.         event-slot != air
  360.         index of event-slot != 20 or 24
  361.         cancel event
  362.         if index of event-slot is 49:
  363.             save oldgui of player
  364.             set {text} to colored "&cID:"
  365.             set {slot} to 49
  366.             set {slotitem} to name tag
  367.             open anvil ID inventory for player
  368.         else if index of event-slot is 36:
  369.             save oldgui of player
  370.             set {text} to colored "&aErfahrung:"
  371.             set {slot} to 36
  372.             set {slotitem} to bottle o' enchanting
  373.             open anvil ID inventory for player
  374.         else if index of event-slot is 37:
  375.             save oldgui of player
  376.             set {text} to colored "&6Kochzeit:"
  377.             set {slot} to 37
  378.             set {slotitem} to furnace
  379.             open anvil ID inventory for player         
  380.         else if index of event-slot is 42:
  381.             set {_ingredient} to slot 20 of event-inventory
  382.             set {_result} to slot 24 of event-inventory
  383.             set {_id} to id of recipe for player
  384.             set {_kochzeit} to cooking time of recipe for player
  385.             set {_erfahrung} to experience of recipe for player
  386.             set {_shape::*} to uncoloured event.getView().getTitle() split at " "
  387.             set {_shape} to {_shape::1}
  388.             load yaml "plugins/Systeme/RezepteIDS.yml" as "RecipesIDS"
  389.             set yaml value "Items.All.%{_id}%" in "RecipesIDS" to {_id}
  390.             load yaml "plugins/Systeme/Rezepte/%{_id}%.yml" as "%{_id}%"
  391.             set yaml value "Items.All.%{_id}%.Result" in "%{_id}%" to {_result}
  392.             set yaml value "Items.All.%{_id}%.Shape" in "%{_id}%" to {_shape}
  393.             set yaml value "Items.All.%{_id}%.Needed" in "%{_id}%" to {_ingredient}
  394.             set yaml value "Items.All.%{_id}%.Exp" in "%{_id}%" to {_erfahrung}
  395.             set yaml value "Items.All.%{_id}%.Kochzeit" in "%{_id}%" to "%{_kochzeit}% seconds" parsed as timespan
  396.             save yaml "%{_id}%"
  397.             save yaml "RecipesIDS"
  398.             unload yaml "%{_id}%"
  399.             close player's inventory
  400.         else if index of event-slot = 43:
  401.             set {_id} to id of recipe for player
  402.             load yaml "plugins/Systeme/RezepteIDS.yml" as "RecipesIDS"
  403.             delete yaml value "Items.All.%{_id}%" from "RecipesIDS"
  404.             load yaml "plugins/Systeme/Rezepte/%{_id}%.yml" as "%{_id}%"
  405.             delete yaml "%{_id}%"
  406.             save yaml "plugins/Systeme/Rezepte/"
  407.             save yaml "RecipesIDS"
  408.             unload yaml "%{_id}%"
  409.             unload yaml "RecipesIDS"
  410.             open recipes for player at page "1"
  411.     else if event.getView().getTitle() is "&3Stonecutter Rezepte":
  412.         event-inventory != player's inventory
  413.         event-slot != air
  414.         index of event-slot != 20 or 24
  415.         cancel event
  416.         if index of event-slot is 49:
  417.             save oldgui of player
  418.             set {text} to colored "&cID:"
  419.             set {slot} to 49
  420.             set {slotitem} to name tag
  421.             open anvil ID inventory for player
  422.         else if index of event-slot = 50:
  423.             save oldgui of player
  424.             set {slot} to 50
  425.             set {slotitem} to chest
  426.             set {text} to colored "&6Gruppe:"
  427.             open anvil ID inventory for player
  428.         else if index of event-slot is 42:
  429.             set {_ingredient} to slot 20 of event-inventory
  430.             set {_result} to slot 24 of event-inventory
  431.             set {_id} to id of recipe for player
  432.             set {_group} to group of recipe for player
  433.             set {_shape::*} to uncoloured event.getView().getTitle() split at " "
  434.             set {_shape} to {_shape::1}
  435.             load yaml "plugins/Systeme/RezepteIDS.yml" as "RecipesIDS"
  436.             set yaml value "Items.All.%{_id}%" in "RecipesIDS" to {_id}
  437.             load yaml "plugins/Systeme/Rezepte/%{_id}%.yml" as "%{_id}%"
  438.             set yaml value "Items.All.%{_id}%.Result" in "%{_id}%" to {_result}
  439.             set yaml value "Items.All.%{_id}%.Shape" in "%{_id}%" to {_shape}
  440.             set yaml value "Items.All.%{_id}%.Needed" in "%{_id}%" to {_ingredient}
  441.             set yaml value "Items.All.%{_id}%.Group" in "%{_id}%" to {_group}
  442.             save yaml "%{_id}%"
  443.             save yaml "RecipesIDS"
  444.             unload yaml "%{_id}%"
  445.             close player's inventory
  446.         else if index of event-slot = 43:
  447.             set {_id} to id of recipe for player
  448.             load yaml "plugins/Systeme/RezepteIDS.yml" as "RecipesIDS"
  449.             delete yaml value "Items.All.%{_id}%" from "RecipesIDS"
  450.             load yaml "plugins/Systeme/Rezepte/%{_id}%.yml" as "%{_id}%"
  451.             delete yaml "%{_id}%"
  452.             save yaml "plugins/Systeme/Rezepte/"
  453.             save yaml "RecipesIDS"
  454.             unload yaml "%{_id}%"
  455.             unload yaml "RecipesIDS"
  456.             close player's inventory
  457.             open recipes for player at page "1"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement