survival.txt 53 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475
  1. event.load("entity_click");
  2. event.load("inv_click");
  3. event.load("player_pre_respawn");
  4. event.load("player_post_respawn");
  5. event.load("player_login");
  6. event.load("player_move");
  7. event.load("block_break");
  8. event.load("block_click");
  9. event.load("living_death");
  10. event.load("living_pre_hurt");
  11. event.load("player_toss");
  12. event.load("pre_explosion");
  13. event.load("mob_griefing");
  14. event.load("item_air_click");
  15. event.load("projectile_hit");
  16. setScriptVar("skills", list.new());
  17. skill.add("Keep Inventory", "skill.subcu_inv", "minecraft:chest", "Keeps the inventory on death", 100, false, false, true);
  18. skill.add("Comeback", "skill.comeback", "km:skill55", "Respawn at your death location", 100, false, false, true);
  19. skill.add("Head Hunter", "skill.head_human", "minecraft:player_head", "Drops a player's head with a 20% chance if you kill a player (5% if a staff member is killed)", 1000, true, false, false);
  20. skill.add("Mobheads", "skill.head_monster", "minecraft:zombie_head", "Drops a mobs's head with a 20% chance (zombie / skeleton / creeper)", 500, true, false, false);
  21. skill.add("Fly 10min", "skill.fly10min", "minecraft:elytra", "You can fly for 10 minutes", 500, false, true, false);
  22. skill.add("Grow", "skill.grow", "minecraft:farmland", "Grow seeds in radius 5", 25, false, true, false);
  23. skill.add("Haste", "skill.haste", "minecraft:iron_pickaxe", "Haste for 2 minutes", 25, false, true, false);
  24. skill.add("Speed", "skill.speed", "minecraft:iron_boots", "Speed for 2 minutes", 25, false, true, false);
  25. skill.add("Jump Boost", "skill.jump_boost", "minecraft:rabbit_foot", "JumpBoost Lvl.2 for 2 minutes", 25, false, true, false);
  26. skill.add("Dolphin", "skill.dolphin", "minecraft:fire_coral", "Swim like a dolphin for a minute", 25, false, true, false);
  27. skill.add("Block Up", "skill.block_up", "minecraft:diamond_pickaxe", "Break a block and the block above for a minute", 25, false, true, false);
  28. skill.add("Block Down", "skill.block_down", "minecraft:diamond_pickaxe", "Break a block and the block below for a minute", 25, false, true, false);
  29. skill.add("Timber", "skill.timber", "minecraft:iron_axe", "Break whole trees with an axe for a minute", 128, false, true, false);
  30. skill.add("Fire Arrow", "skill.fire_arrow", "minecraft:arrow", "For a minute with an flame enchanted bow your arrows ignite hit blocks", 50, false, true, false);
  31. skill.add("Better Shears", "skill.better_shears", "minecraft:shears", "Sharpness enchanted shears increase the radius for destruction of leaves", 500, true, false, true);
  32. skill.add("Cobweb Miner", "skill.cobweb_miner", "minecraft:cobweb", "Swords increase the radius for destruction of cobwebs", 250, true, false, true);
  33. clan.loadData();
  34. items_list = list.new(); //Array-List: Alle Items mit Rezepten
  35. recipe_site_map = map.new();
  36. tp_list = list.new();
  37. tp_map = map.new();
  38. afk_loop_map = map.new();
  39. death_loc_map = map.new();
  40. survival_respawn = set.new();
  41. overworld = world.getOverWorld();
  42. moveid_storyspawn = event.addMoveData(loc.new(overworld, 167, 70, 241), loc.new(overworld, 169, 72, 243), 5, -1);
  43. moveid_gamesspawn = event.addMoveData(loc.new(overworld, 219, 66, 253), loc.new(overworld, 223, 69, 258), 5, -1);
  44. move_id_afk_loop = event.addMoveData(loc.new(overworld, 208, 69, 226), loc.new(overworld, 209, 69.5, 227), 5, -1);
  45. config = getScriptVar("server_config");
  46. survival_spawn = read.location(config.getString(config, "surv_spawn", "games:0:0:0"));
  47. adventure_chest_loc = loc.new(overworld, 177, 74, 237);
  48. adventure_aim_loc = loc.new(overworld, 180, 70, 241);
  49. lottery_loc_1 = loc.new(overworld, 186, 69, 227);
  50. lottery_loc_2 = loc.new(overworld, 186, 69, 223);
  51. gambler_loc = loc.new(overworld, 185, 68, 225);
  52. prefix_money = "§2Money";
  53. prefix_skill = "§2Skill";
  54. max_ench_lvl = map.new();
  55. map.add(max_ench_lvl, enchantment.get("efficiency"), 10);
  56. map.add(max_ench_lvl, enchantment.get("smite"), 10);
  57. map.add(max_ench_lvl, enchantment.get("bane_of_arthropods"), 10);
  58. map.add(max_ench_lvl, enchantment.get("loyalty"), 5);
  59. map.add(max_ench_lvl, enchantment.get("piercing"), 5);
  60. map.add(max_ench_lvl, enchantment.get("lure"), 5);
  61. map.add(max_ench_lvl, enchantment.get("luck_of_the_sea"), 5);
  62. map.add(max_ench_lvl, enchantment.get("riptide"), 5);
  63. map.add(max_ench_lvl, enchantment.get("unbreaking"), 5);
  64. map.add(max_ench_lvl, enchantment.get("quick_charge"), 5);
  65. map.add(max_ench_lvl, enchantment.get("protection"), 5);
  66. map.add(max_ench_lvl, enchantment.get("fire_protection"), 5);
  67. map.add(max_ench_lvl, enchantment.get("blast_protection"), 5);
  68. map.add(max_ench_lvl, enchantment.get("projectile_protection"), 5);
  69. map.add(max_ench_lvl, enchantment.get("feather_falling"), 5);
  70. map.add(max_ench_lvl, enchantment.get("respiration"), 5);
  71. map.add(max_ench_lvl, enchantment.get("thorns"), 5);
  72. map.add(max_ench_lvl, enchantment.get("depth_strider"), 5);
  73. map.add(max_ench_lvl, enchantment.get("frost_walker"), 2);
  74. map.add(max_ench_lvl, enchantment.get("soul_speed"), 3);
  75. map.add(max_ench_lvl, enchantment.get("sharpness"), 10);
  76. map.add(max_ench_lvl, enchantment.get("knockback"), 5);
  77. map.add(max_ench_lvl, enchantment.get("fire_aspect"), 2);
  78. map.add(max_ench_lvl, enchantment.get("looting"), 5);
  79. map.add(max_ench_lvl, enchantment.get("sweeping_edge"), 5);
  80. map.add(max_ench_lvl, enchantment.get("power"), 5);
  81. map.add(max_ench_lvl, enchantment.get("punch"), 5);
  82. map.add(max_ench_lvl, enchantment.get("impaling"), 5);
  83. map.add(max_ench_lvl, enchantment.get("fortune"), 5);
  84. air = "minecraft:air";
  85. air_item = read.item(air);
  86. leather = "minecraft:leather";
  87. string = "minecraft:string";
  88. iron_ingot = "minecraft:iron_ingot";
  89. bronze_ingot = "km:bronze_ingot";
  90. copper_ingot = "km:copper_ingot";
  91. tin_ingot = "km:tin_ingot";
  92. silver_ingot = "km:silver_ingot";
  93. stick = "minecraft:stick";
  94. planks = "minecraft:oak_planks";
  95. cobblestone = "minecraft:cobblestone";
  96. iron_ingot = "minecraft:iron_ingot";
  97. gold_ingot = "minecraft:gold_ingot";
  98. diamond = "minecraft:diamond";
  99. book = "minecraft:book";
  100. birch_planks = "minecraft:birch_planks";
  101. dark_oak_planks = "minecraft:dark_oak_planks";
  102. jungle_planks = "minecraft:jungle_planks";
  103. spruce_planks = "minecraft:spruce_planks";
  104. acacia_planks = "minecraft:acacia_planks";
  105. coarse_dirt = "minecraft:coarse_dirt";
  106. gravel = "minecraft:gravel";
  107. wheat = "minecraft:wheat";
  108. grass = "minecraft:grass";
  109. iron_nugget = "minecraft:iron_nugget";
  110. hay_bundle = "km:hay_bundle";
  111. real_hay_block = "km:real_hay_block";
  112. sword_tag = item.getTag("km:sword");
  113. dye_tag = item.getTag("km:dye");
  114. leaves_tag = block.getTag("minecraft:leaves");
  115. sign_tag = block.getTag("minecraft:signs");
  116. prop_persistent = block.getProperty("persistent");
  117. recipe.add(1, "minecraft:saddle", leather, leather, leather, leather, string, leather, air, iron_ingot, air);
  118. recipe.add(1, "km:bronze_helmet", bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, air, bronze_ingot, air, air, air);
  119. recipe.add(1, "km:bronze_chestplate", bronze_ingot, air, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot);
  120. recipe.add(1, "km:bronze_leggings", bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, air, bronze_ingot, bronze_ingot, air, bronze_ingot);
  121. recipe.add(1, "km:bronze_boots", bronze_ingot, air, bronze_ingot, bronze_ingot, air, bronze_ingot, air, air, air);
  122. recipe.add(1, "km:copper_helmet", copper_ingot, copper_ingot, copper_ingot, copper_ingot, air, copper_ingot, air, air, air);
  123. recipe.add(1, "km:copper_chestplate", copper_ingot, air, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot);
  124. recipe.add(1, "km:copper_leggings", copper_ingot, copper_ingot, copper_ingot, copper_ingot, air, copper_ingot, copper_ingot, air, copper_ingot);
  125. recipe.add(1, "km:copper_boots", copper_ingot, air, copper_ingot, copper_ingot, air, copper_ingot, air, air, air);
  126. recipe.add(1, "km:bookshelf_acacia", acacia_planks, acacia_planks, acacia_planks, book, book, book, acacia_planks, acacia_planks, acacia_planks);
  127. recipe.add(1, "km:bookshelf_birch", birch_planks, birch_planks, birch_planks, book, book, book, birch_planks, birch_planks, birch_planks);
  128. recipe.add(1, "km:bookshelf_dark_oak", dark_oak_planks, dark_oak_planks, dark_oak_planks, book, book, book, dark_oak_planks, dark_oak_planks, dark_oak_planks);
  129. recipe.add(1, "km:bookshelf_jungle", jungle_planks, jungle_planks, jungle_planks, book, book, book, jungle_planks, jungle_planks, jungle_planks);
  130. recipe.add(1, "km:bookshelf_spruce", spruce_planks, spruce_planks, spruce_planks, book, book, book, spruce_planks, spruce_planks, spruce_planks);
  131. recipe.add(1, "km:copper_block", copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot);
  132. recipe.add(1, "km:bronze_block", bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot);
  133. recipe.add(1, "km:tin_block", tin_ingot, tin_ingot, tin_ingot, tin_ingot, tin_ingot, tin_ingot, tin_ingot, tin_ingot, tin_ingot);
  134. recipe.add(1, "km:silver_block", silver_ingot, silver_ingot, silver_ingot, silver_ingot, silver_ingot, silver_ingot, silver_ingot, silver_ingot, silver_ingot);
  135. recipe.add(1, "km:cooking_pot_copper", copper_ingot, air, copper_ingot, copper_ingot, air, copper_ingot, copper_ingot, copper_ingot, copper_ingot);
  136. recipe.add(1, bronze_ingot, tin_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot);
  137. recipe.add(1, copper_ingot, air, air, air, air, "km:copper_ore", air, air, air, air);
  138. recipe.add(1, tin_ingot, air, air, air, air, "km:tin_ore", air, air, air, air);
  139. recipe.add(1, silver_ingot, air, air, air, air, "km:silver_ore", air, air, air, air);
  140. recipe.add(1, "km:spikes_bronze", air, bronze_ingot, air, bronze_ingot, bronze_ingot, bronze_ingot, air, air, air);
  141. recipe.add(1, "km:spikes_copper", air, copper_ingot, air, copper_ingot, copper_ingot, copper_ingot, air, air, air);
  142. recipe.add(1, "km:spikes_gold", air, gold_ingot, air, gold_ingot, gold_ingot, gold_ingot, air, air, air);
  143. recipe.add(1, "km:spikes_iron", air, iron_ingot, air, iron_ingot, iron_ingot, iron_ingot, air, air, air);
  144. recipe.add(1, "km:wooden_battleaxe", air, planks, planks, air, stick, planks, stick, air, air);
  145. recipe.add(1, "km:stone_battleaxe", air, cobblestone, cobblestone, air, stick, cobblestone, stick, air, air);
  146. recipe.add(1, "km:iron_battleaxe", air, iron_ingot, iron_ingot, air, stick, iron_ingot, stick, air, air);
  147. recipe.add(1, "km:golden_battleaxe", air, gold_ingot, gold_ingot, air, stick, gold_ingot, stick, air, air);
  148. recipe.add(1, "km:diamond_battleaxe", air, diamond, diamond, air, stick, diamond, stick, air, air);
  149. recipe.add(1, "km:copper_battleaxe", air, copper_ingot, copper_ingot, air, stick, copper_ingot, stick, air, air);
  150. recipe.add(1, "km:bronze_battleaxe", air, bronze_ingot, bronze_ingot, air, stick, bronze_ingot, stick, air, air);
  151. recipe.add(1, "km:copper_axe", air, copper_ingot, copper_ingot, air, copper_ingot, stick, air, air, stick);
  152. recipe.add(1, "km:bronze_axe", air, bronze_ingot, bronze_ingot, air, bronze_ingot, stick, air, air, stick);
  153. recipe.add(1, "km:wooden_dagger", air, air, planks, air, stick, air, air, air, air);
  154. recipe.add(1, "km:stone_dagger", air, air, cobblestone, air, stick, air, air, air, air);
  155. recipe.add(1, "km:iron_dagger", air, air, iron_ingot, air, stick, air, air, air, air);
  156. recipe.add(1, "km:golden_dagger", air, air, gold_ingot, air, stick, air, air, air, air);
  157. recipe.add(1, "km:diamond_dagger", air, air, diamond, air, stick, air, air, air, air);
  158. recipe.add(1, "km:copper_dagger", air, air, copper_ingot, air, stick, air, air, air, air);
  159. recipe.add(1, "km:bronze_dagger", air, air, bronze_ingot, air, stick, air, air, air, air);
  160. recipe.add(1, "km:copper_hoe", air, copper_ingot, copper_ingot, air, air, stick, air, air, stick);
  161. recipe.add(1, "km:bronze_hoe", air, bronze_ingot, bronze_ingot, air, air, stick, air, air, stick);
  162. recipe.add(1, "km:wooden_hammer", planks, planks, planks, planks, stick, planks, air, stick, air);
  163. recipe.add(1, "km:stone_hammer", cobblestone, cobblestone, cobblestone, cobblestone, stick, cobblestone, air, stick, air);
  164. recipe.add(1, "km:iron_hammer", iron_ingot, iron_ingot, iron_ingot, iron_ingot, stick, iron_ingot, air, stick, air);
  165. recipe.add(1, "km:golden_hammer", gold_ingot, gold_ingot, gold_ingot, gold_ingot, stick, gold_ingot, air, stick, air);
  166. recipe.add(1, "km:diamond_hammer", diamond, diamond, diamond, diamond, stick, diamond, air, stick, air);
  167. recipe.add(1, "km:copper_hammer", copper_ingot, copper_ingot, copper_ingot, copper_ingot, stick, copper_ingot, air, stick, air);
  168. recipe.add(1, "km:bronze_hammer", bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, stick, bronze_ingot, air, stick, air);
  169. recipe.add(1, "km:copper_shovel", air, copper_ingot, air, air, stick, air, air, stick, air);
  170. recipe.add(1, "km:bronze_shovel", air, bronze_ingot, air, air, stick, air, air, stick, air);
  171. recipe.add(1, "km:wooden_scepter", air, stick, planks, air, stick, stick, stick, air, air);
  172. recipe.add(1, "km:stone_scepter", air, stick, cobblestone, air, stick, stick, stick, air, air);
  173. recipe.add(1, "km:iron_scepter", air, stick, iron_ingot, air, stick, stick, stick, air, air);
  174. recipe.add(1, "km:golden_scepter", air, stick, gold_ingot, air, stick, stick, stick, air, air);
  175. recipe.add(1, "km:diamond_scepter", air, stick, diamond, air, stick, stick, stick, air, air);
  176. recipe.add(1, "km:copper_scepter", air, stick, copper_ingot, air, stick, stick, stick, air, air);
  177. recipe.add(1, "km:bronze_scepter", air, stick, bronze_ingot, air, stick, stick, stick, air, air);
  178. recipe.add(1, "km:copper_pickaxe", copper_ingot, copper_ingot, copper_ingot, air, stick, air, air, stick, air);
  179. recipe.add(1, "km:bronze_pickaxe", bronze_ingot, bronze_ingot, bronze_ingot, air, stick, air, air, stick, air);
  180. recipe.add(1, "km:wooden_stick", air, air, planks, air, stick, air, planks, air, air);
  181. recipe.add(1, "km:stone_stick", air, air, cobblestone, air, stick, air, cobblestone, air, air);
  182. recipe.add(1, "km:iron_stick", air, air, iron_ingot, air, stick, air, iron_ingot, air, air);
  183. recipe.add(1, "km:golden_stick", air, air, gold_ingot, air, stick, air, gold_ingot, air, air);
  184. recipe.add(1, "km:diamond_stick", air, air, diamond, air, stick, air, diamond, air, air);
  185. recipe.add(1, "km:copper_stick", air, air, copper_ingot, air, stick, air, copper_ingot, air, air);
  186. recipe.add(1, "km:bronze_stick", air, air, bronze_ingot, air, stick, air, bronze_ingot, air, air);
  187. recipe.add(1, "km:copper_sword", air, copper_ingot, air, air, copper_ingot, air, air, stick, air);
  188. recipe.add(1, "km:bronze_sword", air, bronze_ingot, air, air, bronze_ingot, air, air, stick, air);
  189. recipe.add(1, "km:mushroom_stick_raw", air, "minecraft:brown_mushroom", "minecraft:brown_mushroom", air, stick, "minecraft:red_mushroom", air, air, air);
  190. recipe.add(1, "km:mushroom_stick_cooked", air, air, air, air, "km:mushroom_stick_raw", air, air, air, air);
  191. recipe.add(1, "km:fried_egg", air, air, air, air, "minecraft:egg", air, air, air, air);
  192. recipe.add(1, "km:crate_acacia", acacia_planks, acacia_planks, acacia_planks, acacia_planks, acacia_planks, acacia_planks, acacia_planks, acacia_planks, acacia_planks);
  193. recipe.add(1, "km:crate_birch", birch_planks, birch_planks, birch_planks, birch_planks, birch_planks, birch_planks, birch_planks, birch_planks, birch_planks);
  194. recipe.add(1, "km:crate_big_oak", dark_oak_planks, dark_oak_planks, dark_oak_planks, dark_oak_planks, dark_oak_planks, dark_oak_planks, dark_oak_planks, dark_oak_planks, dark_oak_planks);
  195. recipe.add(1, "km:crate_oak", planks, planks, planks, planks, planks, planks, planks, planks, planks);
  196. recipe.add(1, "km:crate_jungle", jungle_planks, jungle_planks, jungle_planks, jungle_planks, jungle_planks, jungle_planks, jungle_planks, jungle_planks, jungle_planks);
  197. recipe.add(1, "km:crate_spruce", spruce_planks, spruce_planks, spruce_planks, spruce_planks, spruce_planks, spruce_planks, spruce_planks, spruce_planks, spruce_planks);
  198. recipe.add(1, "km:coarse_dirt_slab", air, air, air, coarse_dirt, coarse_dirt, coarse_dirt, air, air, air);
  199. recipe.add(1, "km:gravel_slab", air, air, air, gravel, gravel, gravel, air, air, air);
  200. recipe.add(1, "km:straw_hat", air, wheat, air, wheat, wheat, wheat, air, air, air);
  201. recipe.add(1, hay_bundle, grass, grass, grass, grass, grass, grass, grass, grass, grass);
  202. recipe.add(1, real_hay_block, hay_bundle, hay_bundle, hay_bundle, hay_bundle, hay_bundle, hay_bundle, hay_bundle, hay_bundle, hay_bundle);
  203. recipe.add(1, "km:real_hay_bed", air, air, air, real_hay_block, real_hay_block, real_hay_block, air, air, air);
  204. recipe.add(1, "km:lantern", iron_nugget, iron_nugget, iron_nugget, "minecraft:glass_pane", "minecraft:torch", "minecraft:glass_pane", iron_nugget, iron_nugget, iron_nugget);
  205. recipe.add(1, "km:sling", stick, string, stick, stick, air, stick, air, stick, air);
  206. recipe.add(4, "minecraft:string", air, air, air, air, "minecraft:white_wool", air, air, air, air);
  207. ench_flame = enchantment.get("flame");
  208. ench_unbreaking = enchantment.get("unbreaking");
  209. ench_sharpness = enchantment.get("sharpness");
  210. par = particle.get("minecraft:witch");
  211. piston_sound = sound.get("block.piston.extend");
  212. adv_tp_sound = sound.get("block.portal.travel");
  213. sound_category_ambient = sound.getCategory("ambient");
  214. gambler_inv = inv.new("020202020");
  215. gambler_inv_id = inv.getId(gambler_inv);
  216. inv.setItem(gambler_inv, 0, read.item("km:coin_copper", 1, "§f1 snuvi"));
  217. inv.setItem(gambler_inv, 1, read.item("km:coin_silver", 1, "§f64 snuvis"));
  218. inv.setItem(gambler_inv, 2, read.item("km:coin_gold", 1, "§f4096 snuvis"));
  219. inv.setItem(gambler_inv, 3, read.item("minecraft:netherite_block", 1, "§fAll in"));
  220. bankmenu = inv.new("233302332233302332");
  221. bankinvid = inv.getId(bankmenu);
  222. coin_gold = read.item("km:coin_gold", 1, "§f4096 snuvis");
  223. coin_silver = read.item("km:coin_silver", 1, "§f64 snuvis");
  224. coin_copper = read.item("km:coin_copper", 1, "§f1 snuvi");
  225. coin_silver64 = read.item("km:coin_silver", 64, "§f4096 snuvis");
  226. coin_copper64 = read.item("km:coin_copper", 64, "§f64 snuvis");
  227. arrow_left = read.item("km:arrow_left", 1, "§fchange to");
  228. arrow_right = read.item("km:arrow_right", 1, "§fchange to");
  229. inv.setItem(bankmenu, 0, read.item("km:plus_green", 1, "§fDeposit..."));
  230. inv.setItem(bankmenu, 1, coin_copper);
  231. inv.setItem(bankmenu, 2, coin_silver);
  232. inv.setItem(bankmenu, 3, coin_gold);
  233. inv.setItem(bankmenu, 4, coin_copper64);
  234. inv.setItem(bankmenu, 5, arrow_left);
  235. inv.setItem(bankmenu, 6, arrow_right);
  236. inv.setItem(bankmenu, 7, coin_silver);
  237. inv.setItem(bankmenu, 8, read.item("km:minus_red", 1, "§fWithdraw..."));
  238. inv.setItem(bankmenu, 9, coin_copper);
  239. inv.setItem(bankmenu, 10, coin_silver);
  240. inv.setItem(bankmenu, 11, coin_gold);
  241. inv.setItem(bankmenu, 12, coin_silver64);
  242. inv.setItem(bankmenu, 13, arrow_left);
  243. inv.setItem(bankmenu, 14, arrow_right);
  244. inv.setItem(bankmenu, 15, coin_gold);
  245. msg("dev", "§bSurvival §rloaded.");
  246. @wait
  247. wait();
  248. if(event == "player_move") {
  249. if(id == moveid_storyspawn) {
  250. player.setBackPosLoc(player, world.getServerSpawn());
  251. player.teleport(player, world.getStorySpawn(), false);
  252. goto("wait");
  253. }
  254. if(id == moveid_gamesspawn) {
  255. player.setBackPosLoc(player, world.getServerSpawn());
  256. player.teleport(player, world.getGamesSpawn(), false);
  257. goto("wait");
  258. }
  259. if(id == move_id_afk_loop) {
  260. player_uuid = player.getUuid(player);
  261. now_time = time.getMillis();
  262. time = map.getOrDefault(afk_loop_map, player_uuid, 0);
  263. if(now_time - time > 9000) { //9 Sekunden
  264. map.add(afk_loop_map, player_uuid, now_time);
  265. money.addBoost(player, 1);
  266. }
  267. goto("wait");
  268. }
  269. goto("wait");
  270. }
  271. //Wenn Event aus Survival-Welten, dann wird er verarbeitet
  272. if(event == "living_death" || event == "living_pre_hurt") {
  273. loc = entity.getLocation(living_entity);
  274. } elseif(event == "pre_explosion") {
  275. loc = location;
  276. } elseif(event == "mob_griefing") {
  277. if(entity == null) {
  278. goto("wait");
  279. }
  280. loc = entity.getLocation(entity);
  281. } else {
  282. loc = entity.getLocation(player);
  283. }
  284. world_name = world.getName(loc.getWorld(loc));
  285. if(word.isSurvName(world_name)) {
  286. ignoreGoto(event);
  287. }
  288. goto("wait");
  289. @item_air_click
  290. player_loc = entity.getLocation(player);
  291. world = loc.getWorld(player_loc);
  292. if(world.getName(world) != "overworld") {
  293. goto("wait");
  294. }
  295. item = living.getEquip(player, "hand");
  296. if(item.getType(item) != "minecraft:clock") {
  297. goto("wait");
  298. }
  299. time = world.getTime(world);
  300. time_h = math.roundDown(time/1000) + 6;
  301. while(time_h >= 24) {
  302. time_h -= 24;
  303. }
  304. //m min = t ticks * 60m / 1000 ticks
  305. time_m = time%1000;
  306. time_m = math.roundDown(time_m * 60 / 1000);
  307. if(time_m < 10) {
  308. time_m = concat("0", text.number(time_m));
  309. } else {
  310. time_m = text.number(time_m);
  311. }
  312. msg.prefix(player, "§eClock", concat(text.number(time_h), ":", time_m));
  313. goto("wait");
  314. @mob_griefing
  315. if(entity.getType(entity) == "enderman") {
  316. cancel = true;
  317. }
  318. goto("wait");
  319. @pre_explosion
  320. plot_list = plot.get(location);
  321. for(i = 0; i < list.getSize(plot_list); i++) {
  322. plot = list.getIndex(plot_list, i);
  323. if(plot.isExplosive(plot)) {
  324. cancel = false;
  325. }
  326. }
  327. //Kein Grundstück existiert
  328. if(i == 0) {
  329. cancel = false;
  330. }
  331. goto("wait");
  332. @player_toss
  333. target_loc = player.getTarget(player, 5);
  334. block_type = block.getType(target_loc);
  335. if(block_type == "minecraft:lectern") {
  336. cancel = true;
  337. item.entity.spawn(item.entity.new(loc.mod(target_loc, 0.5, 1.5, 0.5), item));
  338. }
  339. goto("wait");
  340. @living_pre_hurt
  341. if(!isPlayer(living_entity)) {
  342. damager = player.getFromDamageSource(damage_source);
  343. if(!isPlayer(damager)) {
  344. goto("wait");
  345. }
  346. pet_type = entity.getType(living_entity);
  347. if(pet_type == "wolf" || pet_type == "cat" || pet_type == "parrot" || pet_type == "horse") {
  348. if(pet.isTamed(living_entity)) {
  349. owner_uuid = pet.getOwner(living_entity);
  350. if(owner_uuid == player.getUuid(damager)) {
  351. if(player.getNoPetDamage(damager)) {
  352. cancel = true;
  353. }
  354. }
  355. }
  356. }
  357. goto("wait");
  358. }
  359. player = living_entity;
  360. damager = player.getFromDamageSource(damage_source);
  361. if(!isPlayer(damager)) {
  362. player_loc = entity.getLocation(player);
  363. if(loc.hasPlotId(player_loc, 128) && damage.getType(damage_source) == "fall") {
  364. cancel = true;
  365. }
  366. goto("wait");
  367. }
  368. if(player == damager) {
  369. goto("wait");
  370. }
  371. if(!hasPvpOn(damager)) {
  372. cancel = true;
  373. msg.prefix(damager, "§5PvP", "You have PvP disabled.");
  374. goto("wait");
  375. }
  376. if(!hasPvpOn(player)) {
  377. cancel = true;
  378. msg.prefix(damager, "§5PvP", concat(player.getName(player), " has PvP disabled."));
  379. goto("wait");
  380. }
  381. goto("wait");
  382. @entity_click
  383. if(hand == "OFF_HAND") {
  384. goto("wait");
  385. }
  386. if(entity.getType(entity) == "human") {
  387. entity_name = entity.getName(entity);
  388. if(entity_name == "Info-Point") {
  389. msg(player, getSpacer());
  390. msg(player, text.click("§r [§cclick§r] [§eSurvival§r]", "/infopoint1"));
  391. msg(player, text.click("§r [§cclick§r] [§eAdventure§r]", "/infopoint2"));
  392. msg(player, text.click("§r [§cclick§r] [§ePlots§r]", "/infopoint3"));
  393. msg(player, text.click("§r [§cclick§r] [§eClans§r]", "/infopoint4"));
  394. msg(player, text.click("§r [§cclick§r] [§eCities§r]", "/infopoint5"));
  395. msg(player, text.click("§r [§cclick§r] [§eShops§r]", "/infopoint6"));
  396. msg(player, text.click("§r [§cclick§r] [§eMinigames§r]", "/infopoint7"), " ", text.click("§f[§bTeleport§f]", "/games"));
  397. msg(player, text.click("§r [§cclick§r] [§eQuests§r]", "/infopoint8"), " ", text.click("§f[§bTeleport§f]", "/story"));
  398. msg(player, text.click("§r [§cclick§r] [§eRanking§r]", "/infopoint9"), " ", text.link("§f[§bRanks§f]", "https://minecraft.hammerle.me/?site=ranks"));
  399. msg(player, text.click("§r [§cclick§r] [§eRules§r]", "/infopoint10"), " ", text.link("§f[§bFake Rules§f]", "https://minecraft.hammerle.me/?site=rules"));
  400. msg(player, text.click("§r [§cclick§r] [§eNote§r]", "/infopoint11"));
  401. goto("wait");
  402. }
  403. if(entity_name == "Recipes") {
  404. recipe_menu = inv.new("333333333333333333333333333333333333333333333200000022");
  405. recipe.setPage(player, recipe_menu, 1);
  406. inv.open(recipe_menu, player, "Recipes");
  407. goto("wait");
  408. }
  409. if(entity_name == "Banker") {
  410. inv.open(bankmenu, player, "Banker");
  411. goto("wait");
  412. }
  413. if(entity_name == "Adventure") {
  414. if(!player.isOnAdventure(player)) {
  415. msg.prefix(player, "§5Adventure", "§rYou aren't on an adventure. Click the chest in the teleporter to start an adventure.");
  416. goto("wait");
  417. }
  418. player.setAdventure(player, false);
  419. adventures = player.getAdventureAmounts(player);
  420. if(adventures == null) {
  421. adventures = 0;
  422. }
  423. player.setAdventureAmounts(player, ++adventures);
  424. msg.prefix(player, "§5Adventure", "§rCongratulations, you finished your adventure, here ist your reward!");
  425. if(adventures == 10) {
  426. offerRank(player, "rank.pioneer");
  427. } elseif(adventures == 5) {
  428. offerRank(player, "rank.explorer");
  429. } elseif(adventures == 1) {
  430. offerRank(player, "rank.adventurer");
  431. }
  432. removeAdventureDisplay(player);
  433. player.safeGiveItem(player, coin_silver);
  434. goto("wait");
  435. }
  436. }
  437. goto("wait");
  438. @player_login
  439. if(player.isOnAdventure(player)) {
  440. addAdventureDisplay(player, adventure_aim_loc);
  441. }
  442. goto("wait");
  443. @inv_click
  444. cancel = true;
  445. if(inv_id == bankinvid) { //Bankmenü
  446. gold_inv = player.getItemAmount(player, false, coin_gold);
  447. silver_inv = player.getItemAmount(player, false, coin_silver);
  448. copper_inv = player.getItemAmount(player, false, coin_copper);
  449. //Wechseln
  450. if(inv_slot == 5 || inv_slot == 6 || inv_slot == 13 || inv_slot == 14) {
  451. if(inv_slot == 5) {
  452. //1 Silbermünze --> 64 Kupfermünzen
  453. amount1 = 1;
  454. item1 = coin_silver;
  455. amount2 = 64;
  456. item2 = coin_copper64;
  457. message = "No silvercoin in inventory.";
  458. item_type = "km:coin_copper";
  459. coin_inv = silver_inv;
  460. }
  461. elseif(inv_slot == 6) {
  462. //64 Kupfermünzen --> 1 Silbermünze
  463. amount1 = 64;
  464. item1 = coin_copper64;
  465. amount2 = 1;
  466. item2 = coin_silver;
  467. message = "Not enough coppercoins in inventory.";
  468. item_type = "km:coin_silver";
  469. coin_inv = copper_inv;
  470. }
  471. elseif(inv_slot == 13) {
  472. //1 Goldmünze --> 64 Silbermünzen
  473. amount1 = 1;
  474. item1 = coin_gold;
  475. amount2 = 64;
  476. item2 = coin_silver64;
  477. message = "No goldcoin in inventory.";
  478. item_type = "km:coin_silver";
  479. coin_inv = gold_inv;
  480. }
  481. elseif(inv_slot == 14) {
  482. //64 Silbermünzen --> 1 Goldmünze
  483. amount1 = 64;
  484. item1 = coin_silver64;
  485. amount2 = 1;
  486. item2 = coin_gold;
  487. message = "Not enough silvercoins in inventory.";
  488. item_type = "km:coin_gold";
  489. coin_inv = silver_inv;
  490. }
  491. if(coin_inv < amount1) {
  492. msg.prefix(player, prefix_money, message);
  493. goto("wait");
  494. }
  495. player.removeItemNbt(player, item1);
  496. notgiven = player.giveItem(player, item2);
  497. if(item.getType(notgiven) != "minecraft:air") {
  498. amount = item.getAmount(notgiven);
  499. player.removeItemNbt(player, read.item(item_type, amount2 - amount));
  500. player.giveItem(player, item1);
  501. msg.prefix(player, prefix_money, "Not enough space in inventory.");
  502. goto("wait");
  503. }
  504. inv.update(player);
  505. msg.prefix(player, prefix_money, "Exchange succesfull.");
  506. goto("wait");
  507. }
  508. //Kontobewegungen
  509. if(inv_slot == 1 || inv_slot == 9) {
  510. betrag = 1;
  511. coin_inv = copper_inv;
  512. }
  513. elseif(inv_slot == 2 || inv_slot == 10) {
  514. betrag = 64;
  515. coin_inv = silver_inv;
  516. }
  517. elseif(inv_slot == 3 || inv_slot == 11) {
  518. betrag = 4096;
  519. coin_inv = gold_inv;
  520. }
  521. //Einzahlen
  522. if(inv_slot > 0 && inv_slot < 4) {
  523. player_id = player.getId(player);
  524. if(coin_inv < 1) {
  525. msg.prefix(player, prefix_money, "§rCoin not in inventory.");
  526. } else {
  527. addMoney(player, betrag);
  528. player.removeItemNbt(player, inv.getItem(bankmenu, inv_slot));
  529. inv.update(player);
  530. }
  531. goto("wait");
  532. }
  533. //Auszahlen
  534. if(inv_slot > 8 && inv_slot < 12) {
  535. player_id = player.getId(player);
  536. if(!hasEnoughMoney(player_id, betrag)) {
  537. msg.prefix(player, prefix_money, "Not enough snuvis on your account.");
  538. } else {
  539. subMoney(player, betrag);
  540. player.giveItem(player, inv.getItem(bankmenu, inv_slot));
  541. inv.update(player);
  542. }
  543. goto("wait");
  544. }
  545. goto("wait");
  546. }
  547. if(inv_id == gambler_inv_id) {
  548. if(inv_slot == 0) {
  549. amount = 1;
  550. } elseif(inv_slot == 1) {
  551. amount = 64;
  552. } elseif(inv_slot == 2) {
  553. amount = 4096;
  554. } elseif(inv_slot == 3) {
  555. amount = getMoney(player);
  556. if(amount == 0) {
  557. msg.prefix(player, prefix_money, "You need at least 1 snuvi on your account.");
  558. goto("wait");
  559. }
  560. }
  561. if(!hasEnoughMoney(player, amount)) {
  562. msg.prefix(player, prefix_money, "Not enough snuvis on your account.");
  563. goto("wait");
  564. }
  565. win = math.random(1, 2);
  566. if(win == 1) {
  567. addMoney(player, amount);
  568. temp = " won ";
  569. } else {
  570. subMoney(player, amount);
  571. temp = " lost ";
  572. }
  573. if(amount == 1) {
  574. message = concat(player.getName(player), temp, text.number(amount), " snuvi.");
  575. } else {
  576. message = concat(player.getName(player), temp, text.number(amount), " snuvis.");
  577. }
  578. msg.radius("§2Gambler", message, entity.getLocation(player), 50);
  579. goto("wait");
  580. }
  581. if(inv_name == "Recipes") {
  582. item_type = item.getType(item);
  583. if(item_type == "minecraft:air") {
  584. goto("wait");
  585. }
  586. if(item_type == "km:return_red") {
  587. page = map.getOrDefault($recipe_site_map, player.getUuid(player), 1);
  588. recipe.setPage(player, inv, page);
  589. goto("wait");
  590. }
  591. if(item_type == "minecraft:paper") {
  592. name = item.getName(item);
  593. if(text.contains(name, "<<") || text.contains(name, ">>")) {
  594. page = removeFormat(name);
  595. page = text.replace(page, "<<", "");
  596. page = text.replace(page, ">>", "");
  597. page = read.number(page);
  598. if(inv_slot == 46) {
  599. recipe.setPage(player, inv, page);
  600. }
  601. if(inv_slot == 47) {
  602. recipe.setPage(player, inv, page);
  603. }
  604. goto("wait");
  605. }
  606. }
  607. index = recipe.getIndexFromItemType(item_type);
  608. if(index == null) {
  609. goto("wait");
  610. }
  611. recipe.showRecipe(player, inv, index);
  612. }
  613. goto("wait");
  614. @projectile_hit
  615. if(!isPlayer(shooter)) {
  616. goto("wait");
  617. }
  618. player = shooter;
  619. duration = data.getTimer(player, "skill.fire_arrow");
  620. if(duration > 0) {
  621. if(loc_hit == null) {
  622. goto("wait");
  623. }
  624. flame = enchantment.getLevel(ench_flame, living.getHand(player));
  625. if(flame <= 0) {
  626. goto("wait");
  627. }
  628. if(!plot.check(loc_hit, player, 3, true) && !perm.has(player, "plot.bypass")) {
  629. msg.prefix(player, prefix_skill, "You have no permissions on this plot.");
  630. goto("wait");
  631. }
  632. ent_loc = entity.getLocation(projectile);
  633. if(block.isAir(ent_loc)){
  634. block.set(ent_loc, "minecraft:fire");
  635. }
  636. fire_ring(ent_loc, "minecraft:fire", 0);
  637. }
  638. goto("wait");
  639. function fire_ring(location, block_string, radius){
  640. loc_x = loc.getX(location);
  641. loc_y = loc.getY(location);
  642. loc_z = loc.getZ(location);
  643. for(a = -radius; a < radius + 1; a++){
  644. loc.setX(location, loc_x + a);
  645. for(b = -radius; b < radius + 1; b++){
  646. loc.setY(location, loc_y + b);
  647. for(c = -radius; c < radius + 1; c++){
  648. loc.setZ(location, loc_z + c);
  649. if(block.isAir(location)){
  650. block.set(location, block_string);
  651. }
  652. }
  653. }
  654. }
  655. }
  656. @block_break
  657. duration = data.getTimer(player, "block_down");
  658. if(duration > 0) {
  659. do = true;
  660. loc = loc.mod(block_loc, 0, -1, 0);
  661. b_type = block.getType(loc);
  662. if(b_type == "minecraft:bedrock" || b_type == "minecraft:end_portal_frame") {
  663. do = false;
  664. }
  665. if(!plot.check(loc, player, 2, true)) {
  666. do = false;
  667. }
  668. if(do) {
  669. block.break(loc, player);
  670. }
  671. }
  672. duration = data.getTimer(player, "block_up");
  673. if(duration > 0) {
  674. do = true;
  675. loc = loc.mod(block_loc, 0, 1, 0);
  676. b_type = block.getType(loc);
  677. if(b_type == "minecraft:bedrock" || b_type == "minecraft:end_portal_frame") {
  678. do = false;
  679. }
  680. if(!plot.check(loc, player, 2, true)) {
  681. do = false;
  682. }
  683. if(do) {
  684. block.break(loc, player);
  685. }
  686. }
  687. if(block_type == "minecraft:cobweb") {
  688. if(cancel) {
  689. goto("wait");
  690. }
  691. hand_item = living.getHand(player);
  692. if(!item.hasTag(sword_tag, hand_item)) {
  693. goto("wait");
  694. }
  695. amount = skill.getAmount(player, "skill.cobweb_miner");
  696. if(amount <= 0) {
  697. goto("wait");
  698. }
  699. if(!skill.isActivated(player, "skill.cobweb_miner")) {
  700. goto("wait");
  701. }
  702. location = loc.mod(block_loc, 0, 0, 0);
  703. cobweb_X = loc.getX(location);
  704. cobweb_Y = loc.getY(location);
  705. cobweb_Z = loc.getZ(location);
  706. unbreaking_level = enchantment.getLevel(ench_unbreaking, hand_item);
  707. for(a = -cobweb_radius; a < cobweb_radius + 1; a++) {
  708. loc.setX(location, cobweb_X + a);
  709. for(b = -cobweb_radius; b < cobweb_radius + 1; b++) {
  710. loc.setY(location, cobweb_Y + b);
  711. for(c = -cobweb_radius; c < cobweb_radius + 1; c++) {
  712. loc.setZ(location, cobweb_Z + c);
  713. if(math.abs(a) + math.abs(b) + math.abs(c) + math.random(0, 2) < cobweb_radius + 2) {
  714. shear_cobweb(location, block_type, player, unbreaking_level);
  715. }
  716. }
  717. }
  718. }
  719. goto("wait");
  720. }
  721. if(block.hasTag(leaves_tag, block)) {
  722. if(cancel) {
  723. goto("wait");
  724. }
  725. hand_item = living.getHand(player);
  726. if(item.getType(hand_item) != "minecraft:shears") {
  727. goto("wait");
  728. }
  729. if(block.property.getValue(block_loc, prop_persistent)){
  730. goto("wait");
  731. }
  732. amount = skill.getAmount(player, "skill.better_shears");
  733. if(amount <= 0) {
  734. goto("wait");
  735. }
  736. if(!skill.isActivated(player, "skill.better_shears")) {
  737. goto("wait");
  738. }
  739. location = loc.mod(block_loc, 0, 0, 0);
  740. shears_X = loc.getX(location);
  741. shears_Y = loc.getY(location);
  742. shears_Z = loc.getZ(location);
  743. unbreaking_level = enchantment.getLevel(ench_unbreaking, hand_item);
  744. radius = enchantment.getLevel(ench_sharpness, hand_item);
  745. if(radius > 0) {
  746. cancel = true;
  747. }
  748. orig_item = block.toStack(location);
  749. for(a = -radius; a < radius + 1; a++){
  750. loc.setX(location, shears_X + a);
  751. for(b = -radius; b < radius + 1; b++){
  752. loc.setY(location, shears_Y + b);
  753. for(c = -radius; c < radius + 1; c++){
  754. loc.setZ(location, shears_Z + c);
  755. if(math.abs(a) + math.abs(b) + math.abs(c) + math.random(0, 2) < radius + 2) {
  756. shear_leave(location, block_type, orig_item, player, unbreaking_level);
  757. }
  758. }
  759. }
  760. }
  761. goto("wait");
  762. }
  763. goto("wait");
  764. function shear_leave(block_loc, original_block_type, original_item, player, unbreaking_level){
  765. if(block.getType(block_loc) != original_block_type) {
  766. return;
  767. }
  768. if(block.property.getValue(block_loc, $prop_persistent)) {
  769. return;
  770. }
  771. block.set(block_loc, "minecraft:air");
  772. item.drop(block_loc, original_item);
  773. if(player.isSurvival(player)) {
  774. if(math.random(0, 99) < 100 / (unbreaking_level + 1)) {
  775. player.damageItem(player, 1);
  776. }
  777. }
  778. }
  779. function shear_cobweb(block_loc, original_block_type, player, unbreaking_level) {
  780. if(block.getType(block_loc) != original_block_type) {
  781. return;
  782. }
  783. block.break(block_loc, player);
  784. if(math.random(0, 99) < 100 / (unbreaking_level + 1)) {
  785. player.damageItem(player, 1);
  786. }
  787. }
  788. @block_click
  789. if(action == "right" && player.checkHandsForTag(player, dye_tag)) {
  790. if(block.hasTag(sign_tag, block)) {
  791. if(!perm.has(player, "plot.bypass")) {
  792. if(!plot.check(block_loc, player, 3, true)) {
  793. cancel = true;
  794. goto("wait");
  795. }
  796. }
  797. }
  798. }
  799. if(hand == "OFF_HAND") {
  800. goto("wait");
  801. }
  802. if(block_type == "minecraft:lectern") {
  803. if(action == "right") {
  804. itementity = entity.get(loc.mod(block_loc, 0.5, 0.9, 0.5), 0.2, "net.minecraft.entity.item.ItemEntity");
  805. if(itementity == null) {
  806. goto("wait");
  807. }
  808. list = entity.near(itementity, 0.2);
  809. list.add(list, itementity);
  810. if(list.getSize(list) < 2) {
  811. //Zu wenig Items am Lesepult
  812. goto("wait");
  813. }
  814. a = array.new(2, 6); //0 = item, 1 = itementity, 2 = enchantments, 3 = enchanted, 4 = enchanted_book, 5 = book
  815. size = 0;
  816. for(i = 0; i < list.getSize(list); i++) {
  817. entity = list.getIndex(list, i);
  818. item = item.entity.get(entity);
  819. size += item.getAmount(item);
  820. if(size > 2) {
  821. //Zu viele Items am Lesepult
  822. goto("wait");
  823. }
  824. map = enchantment.readFromItem(item);
  825. a[i, 0] = item;
  826. a[i, 1] = entity;
  827. a[i, 2] = map;
  828. a[i, 4] = false;
  829. a[i, 5] = false;
  830. if(map.getSize(map) > 0) {
  831. //Verzauberte Items
  832. a[i, 3] = true;
  833. if(item.getType(item) == "minecraft:enchanted_book") {
  834. a[i, 4] = true;
  835. }
  836. } else {
  837. //Nicht verzauberte Items
  838. a[i, 3] = false;
  839. if(item.getType(item) == "minecraft:book") {
  840. a[i, 5] = true;
  841. }
  842. }
  843. }
  844. lectern_action = null;
  845. if(a[0, 4] == true && a[1, 4] == true) {
  846. //Beide Items sind verzauberte Bücher
  847. lectern_action = 0;
  848. }
  849. elseif(a[0, 5] == true || a[1, 5] == true) {
  850. //Eines der beiden Items ist ein normales Buch
  851. if(a[0, 4] == true || a[1, 4] == true) {
  852. //Eines der beiden Items ist ein verzaubertes Buch
  853. lectern_action = 1;
  854. } elseif(a[0, 3] == true || a[1, 3] == true) {
  855. //Eines der beiden Items ist ein verzaubertes Item
  856. lectern_action = 2;
  857. }
  858. }
  859. elseif(a[0, 4] == true || a[1, 4] == true) {
  860. lectern_action = 3;
  861. }
  862. if(lectern_action == null) {
  863. goto("wait");
  864. }
  865. if(lectern_action == 0) {
  866. //Verzauberungsbücher mergen
  867. item1 = a[0, 0];
  868. item_entity1 = a[0, 1];
  869. item_entity2 = a[1, 1];
  870. map1 = a[0, 2];
  871. map2 = a[1, 2];
  872. map_size1 = map.getSize(map1);
  873. map_size2 = map.getSize(map2);
  874. iter = map.iterator(map2);
  875. betrag = 0;
  876. extra = 0;
  877. while(hasNext(iter)) {
  878. element = next(iter);
  879. key = map.getKey(element);
  880. level1 = map.getValue(element);
  881. level2 = map.getOrDefault(map1, key, 0);
  882. if(level1 == level2) {
  883. max_lvl = map.get(max_ench_lvl, key);
  884. //max_lvl = map.getOrDefault(max_ench_lvl, key, enchantment.getMaxLevel(key));
  885. if(max_lvl != null) {
  886. if(level1 < max_lvl) {
  887. extra += 40;
  888. level1++;
  889. }
  890. }
  891. }
  892. if(level2 > level1) {
  893. level1 = level2;
  894. }
  895. map.add(map1, key, level1);
  896. }
  897. if(map_size1 > map_size2) {
  898. map = map1;
  899. } else {
  900. map = map2;
  901. }
  902. iter = map.iterator(map);
  903. while(hasNext(iter)) {
  904. element = next(iter);
  905. level = map.getValue(element);
  906. betrag += level * 20 + extra;
  907. }
  908. if(!hasEnoughMoney(player.getId(player), betrag)) {
  909. msg.prefix(player, prefix_money, concat("Not enough coins in inventory. This action costs ", text.number(betrag), " snuvis."));
  910. goto("wait");
  911. }
  912. subMoney(player, betrag);
  913. enchantment.writeToItem(map1, item1);
  914. item.entity.set(item_entity1, item.clone(item1));
  915. entity.remove(item_entity2);
  916. } elseif(lectern_action == 1) {
  917. //Verzauberungsbuch kopieren
  918. if(a[0, 5]) {
  919. book_index = 0;
  920. other_index = 1;
  921. } else {
  922. book_index = 1;
  923. other_index = 0;
  924. }
  925. item1 = a[book_index, 0];
  926. item_entity1 = a[book_index, 1];
  927. item2 = a[other_index, 0];
  928. item_entity2 = a[other_index, 1];
  929. map2 = a[other_index, 2];
  930. map_size = map.getSize(map2);
  931. betrag = 20 * map_size;
  932. if(!hasEnoughMoney(player.getId(player), betrag)) {
  933. msg.prefix(player, prefix_money, concat("Not enough snuvis on your account. This action costs ", text.number(betrag), " snuvis."));
  934. goto("wait");
  935. }
  936. subMoney(player, betrag);
  937. item1 = read.item("minecraft:enchanted_book");
  938. enchantment.writeToItem(map2, item1);
  939. item.entity.set(item_entity1, item1);
  940. item.entity.set(item_entity2, item.clone(item2));
  941. } elseif(lectern_action == 2) {
  942. //Einzelne Verzauberung herunterziehen
  943. if(a[0, 5]) {
  944. book_index = 0;
  945. other_index = 1;
  946. } else {
  947. book_index = 1;
  948. other_index = 0;
  949. }
  950. item_entity1 = a[book_index, 1];
  951. map1 = map.new();
  952. item2 = a[other_index, 0];
  953. item_entity2 = a[other_index, 1];
  954. map2 = a[other_index, 2];
  955. item1 = read.item("minecraft:enchanted_book");
  956. element = next(map.iterator(map2));
  957. key = map.getKey(element);
  958. value = map.getValue(element);
  959. map.add(map1, key, value);
  960. map.remove(map2, key);
  961. betrag = 20 * value;
  962. if(!hasEnoughMoney(player.getId(player), betrag)) {
  963. msg.prefix(player, prefix_money, concat("Not enough snuvis in your ccount. This action costs ", text.number(betrag), " snuvis."));
  964. goto("wait");
  965. }
  966. subMoney(player, betrag);
  967. enchantment.writeToItem(map1, item1);
  968. enchantment.writeToItem(map2, item2);
  969. item.entity.set(item_entity1, item1);
  970. item.entity.set(item_entity2, item.clone(item2));
  971. } elseif(lectern_action == 3) {
  972. //Alle Verzauberungen vom Buch auf das Item übertragen
  973. betrag = 0;
  974. if(a[0, 4]) {
  975. ench_book_index = 0;
  976. other_index = 1;
  977. } else {
  978. ench_book_index = 1;
  979. other_index = 0;
  980. }
  981. item1 = a[ench_book_index, 0];
  982. item_entity1 = a[ench_book_index, 1];
  983. map1 = a[ench_book_index, 2];
  984. item2 = a[other_index, 0];
  985. item_entity2 = a[other_index, 1];
  986. map2 = a[other_index, 2];
  987. map_size1 = map.getSize(map1);
  988. map_size2 = map.getSize(map2);
  989. iter = map.iterator(map1);
  990. while(hasNext(iter)) {
  991. element = next(iter);
  992. key = map.getKey(element);
  993. value = map.getValue(element);
  994. value2 = map.getOrDefault(map2, key, 0);
  995. if(value2 > value) {
  996. value = value2;
  997. }
  998. map.add(map2, key, value);
  999. }
  1000. if(map_size1 > map_size2) {
  1001. map = map1;
  1002. } else {
  1003. map = map2;
  1004. }
  1005. iter = map.iterator(map);
  1006. while(hasNext(iter)) {
  1007. element = next(iter);
  1008. level = map.getValue(element);
  1009. betrag += level * 20;
  1010. }
  1011. if(!hasEnoughMoney(player.getId(player), betrag)) {
  1012. msg.prefix(player, prefix_money, concat("Not enough snuvis on your account. This action costs ", text.number(betrag), " snuvis."));
  1013. goto("wait");
  1014. }
  1015. subMoney(player, betrag);
  1016. enchantment.writeToItem(map2, item2);
  1017. item.entity.set(item_entity2, item.clone(item2));
  1018. entity.remove(item_entity1);
  1019. }
  1020. entity.throw(item_entity1, 0, 0.3, 0);
  1021. entity.throw(item_entity2, 0, 0.3, 0);
  1022. particle.spawn(loc.mod(block_loc, 0.5, 1.4, 0.5), par, 20, 0, 0.25, 0.25, 0.25);
  1023. msg.prefix(player, prefix_money, concat("This cost " , text.number(betrag), " snuvis."));
  1024. }
  1025. goto("wait");
  1026. }
  1027. if(block_type == "minecraft:chest") {
  1028. if(isATpReceiver(block_loc)) {
  1029. tp_item = read.item("km:gear", 1, "§rTeleport");
  1030. list = list.new();
  1031. list.add(list, world.getName(loc.getWorld(block_loc)));
  1032. list.add(list, text.number(loc.getX(block_loc)));
  1033. list.add(list, text.number(loc.getY(block_loc)));
  1034. list.add(list, text.number(loc.getZ(block_loc)));
  1035. item.setLore(tp_item, list);
  1036. player.giveItem(player, tp_item);
  1037. goto("wait");
  1038. }
  1039. if(isATpTransmitter(block_loc)) {
  1040. player_uuid = player.getUuid(player);
  1041. clicked = map.getOrDefault(tp_map, player_uuid, 0);
  1042. now_time = time.getMillis();
  1043. if(now_time - clicked < 5000) {
  1044. msg.prefix(player, "§5Adventure", "Wait 5 seconds!");
  1045. goto("wait");
  1046. }
  1047. map.add(tp_map, player_uuid, now_time);
  1048. //Abenteuer-Teleport
  1049. if(block_loc == adventure_chest_loc) {
  1050. if(!player.isOnAdventure(player)) {
  1051. if(!player.hasClearInventory(player)) {
  1052. msg.prefix(player, "§5Adventure", "Your inventory needs to be empty!");
  1053. goto("wait");
  1054. }
  1055. alpha = math.random(0, 360);
  1056. alpha *= math.pi() / 180;
  1057. x = math.round(math.sin(alpha) * 10000) + 0.5;
  1058. z = math.round(math.cos(alpha) * 10000) + 0.5;
  1059. y = 255;
  1060. tp_loc = loc.new(world.getOverWorld(), x, y, z);
  1061. while(block.isAir(tp_loc)) {
  1062. loc.setY(tp_loc, y);
  1063. y--;
  1064. }
  1065. tp_loc = loc.mod(tp_loc, 0, 1, 0);
  1066. setTpWallX(block_loc, "minecraft:lime_stained_glass");
  1067. sound.spawn(block_loc, piston_sound, sound_category_ambient);
  1068. array = array.new(4);
  1069. array[0] = player.getUuid(player);
  1070. array[1] = block_loc;
  1071. array[2] = tp_loc;
  1072. array[3] = true;
  1073. list.add(tp_list, array);
  1074. sgoto(30, "tp_ticker");
  1075. }
  1076. goto("wait");
  1077. }
  1078. //Normaler Teleport
  1079. temp = false;
  1080. inv = block.getInv(block_loc);
  1081. inv_size = inv.getSize(inv);
  1082. for(i = 0; i < inv_size; i++) {
  1083. item = inv.getItem(inv, i);
  1084. if(item.getType(item) == "km:gear") {
  1085. if(item.getName(item) == "§rTeleport") {
  1086. temp = true;
  1087. break;
  1088. }
  1089. }
  1090. }
  1091. if(!temp) {
  1092. msg.prefix(player, "§5Adventure", "No receiver found!");
  1093. goto("wait");
  1094. }
  1095. lore_list = item.getLore(item);
  1096. if(list.getSize(lore_list) != 4) {
  1097. msg.prefix(player, "§5Adventure", "No receiver found!");
  1098. goto("wait");
  1099. }
  1100. world = world.get(list.getIndex(lore_list, 0));
  1101. x = read.number(list.getIndex(lore_list, 1));
  1102. y = read.number(list.getIndex(lore_list, 2));
  1103. z = read.number(list.getIndex(lore_list, 3));
  1104. tp_loc = loc.new(world, x, y, z);
  1105. if(!isATpReceiver(tp_loc)) {
  1106. msg.prefix(player, "§5Adventure", "No receiver found!");
  1107. goto("wait");
  1108. }
  1109. loc.add(tp_loc, 0.5, -3, 0.5);
  1110. setTpWallX(block_loc, "minecraft:lime_stained_glass");
  1111. sound.spawn(block_loc, piston_sound, sound_category_ambient);
  1112. array = array.new(4);
  1113. array[0] = player.getUuid(player);
  1114. array[1] = block_loc;
  1115. array[2] = tp_loc;
  1116. array[3] = false;
  1117. list.add(tp_list, array);
  1118. sgoto(30, "tp_ticker");
  1119. }
  1120. goto("wait");
  1121. }
  1122. if(block_loc == gambler_loc) {
  1123. cancel = true;
  1124. inv.open(gambler_inv, player, "Choose your amount to bet with");
  1125. goto("wait");
  1126. }
  1127. if(block_loc == lottery_loc_1 || block_loc == lottery_loc_2) {
  1128. if(!hasEnoughMoney(player, 1)) {
  1129. msg.prefix(player, prefix_money, "Not enough snuvis on your account.");
  1130. goto("wait");
  1131. }
  1132. subMoney(player, 1);
  1133. amount = lottery.add(block_loc, 1);
  1134. if(block_loc == lottery_loc_1) {
  1135. winrate = 1000;
  1136. } else {
  1137. winrate = 10000;
  1138. }
  1139. win = math.random(1, winrate);
  1140. if(win == 1) {
  1141. addMoney(player, amount);
  1142. lottery.set(block_loc, 0);
  1143. message = concat(player.getName(player), " has won ", text.number(amount), " snuvis.");
  1144. msg.radius(prefix_money, message, block_loc, 50);
  1145. }
  1146. goto("wait");
  1147. }
  1148. goto("wait");
  1149. @living_death
  1150. if(isPlayer(living_entity)) {
  1151. player = living_entity;
  1152. setDeathLoc(player);
  1153. loc = entity.getLocation(player);
  1154. amount = skill.getAmount(player, "skill.subcu_inv");
  1155. if(skill.isActivated(player, "skill.subcu_inv") && amount > 0) {
  1156. new_amount = amount - 1;
  1157. skill.setAmount(player, "skill.subcu_inv", new_amount);
  1158. msg.prefix(player, prefix_skill, concat("Used Subcutaneous Inventory. New amount: ", text.number(new_amount)));
  1159. } else {
  1160. player.dropInventory(player, loc);
  1161. }
  1162. killer = player.getFromDamageSource(damage_source);
  1163. if(isPlayer(killer)) {
  1164. amount = skill.getAmount(player, "skill.head_human");
  1165. if(amount >= 1) {
  1166. if(perm.has(player, "isTeam")) {
  1167. temp = math.random(1, 20);
  1168. } else {
  1169. temp = math.random(1, 5);
  1170. }
  1171. if(temp == 1) {
  1172. item.drop(loc, player.getHead(player.getUuid(player), player.getName(player)));
  1173. }
  1174. }
  1175. }
  1176. goto("wait");
  1177. }
  1178. killer = player.getFromDamageSource(damage_source);
  1179. if(isPlayer(killer)) {
  1180. r = math.random(1, 20);
  1181. if(r == 1) {
  1182. amount = skill.getAmount(killer, "skill.head_monster");
  1183. if(amount >= 1) {
  1184. entity_type = entity.getType(living_entity);
  1185. if(entity_type == "creeper") {
  1186. item.drop(loc, read.item("minecraft:creeper_head"));
  1187. goto("wait");
  1188. }
  1189. if(entity_type == "zombie") {
  1190. item.drop(loc, read.item("minecraft:zombie_head"));
  1191. goto("wait");
  1192. }
  1193. if(entity_type == "skeleton") {
  1194. item.drop(loc, read.item("minecraft:skeleton_skull"));
  1195. goto("wait");
  1196. }
  1197. }
  1198. }
  1199. }
  1200. goto("wait");
  1201. @player_pre_respawn
  1202. if(loc.isInSurvWorld(entity.getLocation(player))) {
  1203. set.add(survival_respawn, player.getUuid(player));
  1204. }
  1205. goto("wait");
  1206. @player_post_respawn
  1207. player_uuid = player.getUuid(player);
  1208. if(set.contains(survival_respawn, player_uuid)) {
  1209. set.remove(survival_respawn, player_uuid);
  1210. if(player.isOnAdventure(player)) {
  1211. tp_loc = player.getAdventureStart(player);
  1212. entity.teleport(player, tp_loc);
  1213. goto("wait");
  1214. }
  1215. amount = skill.getAmount(player, "skill.comeback");
  1216. if(skill.isActivated(player, "skill.comeback") && amount > 0) {
  1217. new_amount = amount - 1;
  1218. skill.setAmount(player, "skill.comeback", new_amount);
  1219. msg.prefix(player, prefix_skill, concat("Used Comeback. New amount: ", text.number(new_amount)));
  1220. entity.teleport(player, getDeathLoc(player));
  1221. goto("wait");
  1222. }
  1223. entity.teleport(player, world.getServerSpawn());
  1224. }
  1225. goto("wait");
  1226. @tp_ticker
  1227. array = list.getIndex(tp_list, 0);
  1228. list.removeIndex(tp_list, 0);
  1229. block_loc = array[1];
  1230. list.add(tp_list, array);
  1231. setTpWallFull(block_loc, "minecraft:lime_stained_glass");
  1232. sound.spawn(block_loc, piston_sound, sound_category_ambient);
  1233. sgoto(30, "tp_final");
  1234. goto("wait");
  1235. @tp_final
  1236. array = list.getIndex(tp_list, 0);
  1237. list.removeIndex(tp_list, 0);
  1238. player_uuid = array[0];
  1239. block_loc = array[1];
  1240. tp_loc = array[2];
  1241. adventure = array[3];
  1242. sound.spawn(block_loc, piston_sound, sound_category_ambient);
  1243. setTpWallFull(block_loc, "minecraft:air");
  1244. player = player.get(player_uuid);
  1245. if(player == null) {
  1246. goto("wait");
  1247. }
  1248. sound.spawn(tp_loc, adv_tp_sound, sound_category_ambient);
  1249. if(adventure) {
  1250. //Party
  1251. if(player.isInParty(player) && player.isPartyLeader(player)) {
  1252. party_id = player.getPartyId(player);
  1253. party_list = party.getList(party_id);
  1254. iter = list.iterator(party_list);
  1255. while(hasNext(iter)) {
  1256. p = player.get(next(iter));
  1257. p_name = player.getName(p);
  1258. p_loc = entity.getLocation(p);
  1259. if(!loc.isSameWorld(adventure_chest_loc, p_loc)) {
  1260. msg.prefix(player, "§5Party", concat(p_name, "§c is in another world."));
  1261. msg.prefix(p, "§5Party", "§cYou are in another world.");
  1262. continue;
  1263. }
  1264. if(loc.distance(adventure_chest_loc, p_loc) > 5) {
  1265. msg.prefix(player, "§5Party", concat(p_name, "§c is too far away."));
  1266. msg.prefix(p, "§5Party", "§cYou are too far away.");
  1267. continue;
  1268. }
  1269. if(player.hasMinigame(p)) {
  1270. msg.prefix(player, "§5Party", concat(p_name, "§c is in a game."));
  1271. msg.prefix(p, "§5Party", "§cYou are in a game.");
  1272. continue;
  1273. }
  1274. if(player.hasQuest2(p)) {
  1275. msg.prefix(player, "§5Party", concat(p_name, "§c is doing a quest."));
  1276. msg.prefix(p, "§5Party", "§cYou are doing a quest.");
  1277. continue;
  1278. }
  1279. if(player.isOnAdventure(p)) {
  1280. msg.prefix(player, "§5Party", concat(p_name, "§c is already on an adventure."));
  1281. msg.prefix(p, "§5Party", "§cYou are already on an adventure.");
  1282. continue;
  1283. }
  1284. if(player.isAfk(p)) {
  1285. msg.prefix(player, "§5Party", concat(p_name, "§c is afk."));
  1286. msg.prefix(p, "§5Party", "§cYou are afk.");
  1287. continue;
  1288. }
  1289. if(!player.hasClearInventory(p)) {
  1290. msg.prefix(player, "§5Party", concat(p_name, "§c has no clear inventory."));
  1291. msg.prefix(p, "§5Party", "§cYou have no clear inventory.");
  1292. continue;
  1293. }
  1294. player.teleport(p, tp_loc, false);
  1295. player.setAdventure(p, true);
  1296. player.setAdventureStart(p, tp_loc);
  1297. addAdventureDisplay(p, adventure_aim_loc);
  1298. title.reset(p);
  1299. title.setSub(p, "Have fun!");
  1300. title.send(p, "§cAdventure");
  1301. msg.prefix(p, "§5Adventure", "§rTo complete your adventure, go to the survival spawn. You cannot teleport. If you die, you start again!");
  1302. }
  1303. goto("wait");
  1304. }
  1305. if(!player.hasClearInventory(player)) {
  1306. msg.prefix(player, "§5Adventure", "Your inventory needs to be empty!");
  1307. goto("wait");
  1308. }
  1309. player.teleport(player, tp_loc, false);
  1310. player.setAdventure(player, true);
  1311. player.setAdventureStart(player, tp_loc);
  1312. addAdventureDisplay(player, adventure_aim_loc);
  1313. title.reset(player);
  1314. title.setSub(player, "Have fun!");
  1315. title.send(player, "§cAdventure");
  1316. msg.prefix(player, "§5Adventure", "§rTo complete your adventure, go to the survival spawn. You cannot teleport. If you die, you start again!");
  1317. goto("wait");
  1318. }
  1319. player.teleport(player, tp_loc, false);
  1320. goto("wait");
  1321. function lottery.set(location, amount) {
  1322. location = loc.mod(location, 0.5, 0, 0.5);
  1323. list = living.near(location, 0.1);
  1324. text_entity = list.getIndex(list, 0);
  1325. name = entity.getName(text_entity);
  1326. if(!text.startsWith(name, "Snuvis: ", 0)) {
  1327. snuvi.debug("Lottery error");
  1328. goto("wait");
  1329. }
  1330. entity.setName(text_entity, concat("Snuvis: ", text.number(amount)), true);
  1331. }
  1332. function lottery.add(location, amount) {
  1333. location = loc.mod(location, 0.5, 0, 0.5);
  1334. list = living.near(location, 0.1);
  1335. text_entity = list.getIndex(list, 0);
  1336. name = entity.getName(text_entity);
  1337. if(!text.startsWith(name, "Snuvis: ", 0)) {
  1338. snuvi.debug("Lottery error");
  1339. goto("wait");
  1340. }
  1341. amount = text.convert(text.subString(name, 8, text.length(name))) + 1;
  1342. entity.setName(text_entity, concat("Snuvis: ", text.number(amount)), true);
  1343. return amount;
  1344. }
  1345. function recipe.add(result_amount, result_item, item1, item2, item3, item4, item5, item6, item7, item8, item9) {
  1346. array = array.new(11);
  1347. array[0] = result_amount;
  1348. array[1] = result_item;
  1349. array[2] = item1;
  1350. array[3] = item2;
  1351. array[4] = item3;
  1352. array[5] = item4;
  1353. array[6] = item5;
  1354. array[7] = item6;
  1355. array[8] = item7;
  1356. array[9] = item8;
  1357. array[10] = item9;
  1358. list.add($items_list, array);
  1359. }
  1360. function recipe.getIndexFromItemType(item_type) {
  1361. for(i = 0; i < list.getSize($items_list); i++) {
  1362. array = list.getIndex($items_list, i);
  1363. if(array[1] == item_type) {
  1364. return i;
  1365. }
  1366. }
  1367. return null;
  1368. }
  1369. function recipe.showRecipe(player, menu, index) {
  1370. for(i = 0; i < 48; i++) {
  1371. inv.setItem(menu, i, $air_item);
  1372. }
  1373. array = list.getIndex($items_list, index);
  1374. inv.setItem(menu, 23, read.item("km:arrow_right"));
  1375. inv.setItem(menu, 45, read.item("km:return_red", 1, "§fReturn to overview"));
  1376. inv.setItem(menu, 10, read.item(array[2]));
  1377. inv.setItem(menu, 11, read.item(array[3]));
  1378. inv.setItem(menu, 12, read.item(array[4]));
  1379. inv.setItem(menu, 19, read.item(array[5]));
  1380. inv.setItem(menu, 20, read.item(array[6]));
  1381. inv.setItem(menu, 21, read.item(array[7]));
  1382. inv.setItem(menu, 28, read.item(array[8]));
  1383. inv.setItem(menu, 29, read.item(array[9]));
  1384. inv.setItem(menu, 30, read.item(array[10]));
  1385. inv.setItem(menu, 25, read.item(array[1], array[0]));
  1386. inv.update(player);
  1387. }
  1388. function recipe.setPage(player, menu, page) {
  1389. map.add($recipe_site_map, player.getUuid(player), page);
  1390. size = list.getSize($items_list);
  1391. max_page = math.roundUp(size / 45);
  1392. if(page > max_page) {
  1393. return;
  1394. }
  1395. inv.setItem(menu, 45, $air_item);
  1396. if(page > 1) {
  1397. inv.setItem(menu, 46, read.item("minecraft:paper", 1, concat("§e", text.number(page - 1), " <<")));
  1398. } else {
  1399. inv.setItem(menu, 46, $air_item);
  1400. }
  1401. if(page < max_page) {
  1402. inv.setItem(menu, 47, read.item("minecraft:paper", 1, concat("§e>> ", text.number(page + 1))));
  1403. } else {
  1404. inv.setItem(menu, 47, $air_item);
  1405. }
  1406. max_index = size - 1;
  1407. for(i = 0; i < 45; i++) {
  1408. list_index = i + 45 * (page - 1);
  1409. if(list_index > max_index) {
  1410. inv.setItem(menu, i, $air_item);
  1411. } else {
  1412. array = list.getIndex($items_list, list_index);
  1413. inv.setItem(menu, i, read.item(array[1]));
  1414. }
  1415. }
  1416. inv.update(player);
  1417. }
  1418. function setDeathLoc(player) {
  1419. map.add($death_loc_map, player.getUuid(player), entity.getLocation(player));
  1420. }
  1421. function getDeathLoc(player) {
  1422. return map.getOrDefault($death_loc_map, player.getUuid(player), world.getServerSpawn());
  1423. }