survival.txt 53 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472
  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 ignites hitten blocks", 50, false, true, false);
  31. skill.add("Better Shears", "skill.better_shears", "minecraft:shears", "Sharpness enchanted shears increases the radius for destruction of leaves", 500, true, false, true);
  32. skill.add("Cobweb Miner", "skill.cobweb_miner", "minecraft:cobweb", "Swords increases 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"), 7);
  57. map.add(max_ench_lvl, enchantment.get("bane_of_arthropods"), 7);
  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"), 4);
  66. map.add(max_ench_lvl, enchantment.get("fire_protection"), 4);
  67. map.add(max_ench_lvl, enchantment.get("blast_protection"), 4);
  68. map.add(max_ench_lvl, enchantment.get("projectile_protection"), 4);
  69. map.add(max_ench_lvl, enchantment.get("feather_falling"), 4);
  70. map.add(max_ench_lvl, enchantment.get("respiration"), 3);
  71. map.add(max_ench_lvl, enchantment.get("thorns"), 3);
  72. map.add(max_ench_lvl, enchantment.get("depth_strider"), 4);
  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"), 5);
  76. map.add(max_ench_lvl, enchantment.get("knockback"), 2);
  77. map.add(max_ench_lvl, enchantment.get("fire_aspect"), 2);
  78. map.add(max_ench_lvl, enchantment.get("looting"), 3);
  79. map.add(max_ench_lvl, enchantment.get("sweeping_edge"), 3);
  80. map.add(max_ench_lvl, enchantment.get("power"), 5);
  81. map.add(max_ench_lvl, enchantment.get("punch"), 2);
  82. map.add(max_ench_lvl, enchantment.get("impaling"), 5);
  83. map.add(max_ench_lvl, enchantment.get("fortune"), 3);
  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. loc = entity.getLocation(entity);
  278. } else {
  279. loc = entity.getLocation(player);
  280. }
  281. world_name = world.getName(loc.getWorld(loc));
  282. if(word.isSurvName(world_name)) {
  283. ignoreGoto(event);
  284. }
  285. goto("wait");
  286. @item_air_click
  287. player_loc = entity.getLocation(player);
  288. world = loc.getWorld(player_loc);
  289. if(world.getName(world) != "overworld") {
  290. goto("wait");
  291. }
  292. item = living.getEquip(player, "hand");
  293. if(item.getType(item) != "minecraft:clock") {
  294. goto("wait");
  295. }
  296. time = world.getTime(world);
  297. time_h = math.roundDown(time/1000) + 6;
  298. while(time_h >= 24) {
  299. time_h -= 24;
  300. }
  301. //m min = t ticks * 60m / 1000 ticks
  302. time_m = time%1000;
  303. time_m = math.roundDown(time_m * 60 / 1000);
  304. if(time_m < 10) {
  305. time_m = concat("0", text.number(time_m));
  306. } else {
  307. time_m = text.number(time_m);
  308. }
  309. msg.prefix(player, "§eClock", concat(text.number(time_h), ":", time_m));
  310. goto("wait");
  311. @mob_griefing
  312. if(entity.getType(entity) == "enderman") {
  313. cancel = true;
  314. }
  315. goto("wait");
  316. @pre_explosion
  317. plot_list = plot.get(location);
  318. for(i = 0; i < list.getSize(plot_list); i++) {
  319. plot = list.getIndex(plot_list, i);
  320. if(plot.isExplosive(plot)) {
  321. cancel = false;
  322. }
  323. }
  324. //Kein Grundstück existiert
  325. if(i == 0) {
  326. cancel = false;
  327. }
  328. goto("wait");
  329. @player_toss
  330. target_loc = player.getTarget(player, 5);
  331. block_type = block.getType(target_loc);
  332. if(block_type == "minecraft:lectern") {
  333. cancel = true;
  334. item.entity.spawn(item.entity.new(loc.mod(target_loc, 0.5, 1.5, 0.5), item));
  335. }
  336. goto("wait");
  337. @living_pre_hurt
  338. if(!isPlayer(living_entity)) {
  339. damager = player.getFromDamageSource(damage_source);
  340. if(!isPlayer(damager)) {
  341. goto("wait");
  342. }
  343. pet_type = entity.getType(living_entity);
  344. if(pet_type == "wolf" || pet_type == "cat" || pet_type == "parrot" || pet_type == "horse") {
  345. if(pet.isTamed(living_entity)) {
  346. owner_uuid = pet.getOwner(living_entity);
  347. if(owner_uuid == player.getUuid(damager)) {
  348. if(player.getNoPetDamage(damager)) {
  349. cancel = true;
  350. }
  351. }
  352. }
  353. }
  354. goto("wait");
  355. }
  356. player = living_entity;
  357. damager = player.getFromDamageSource(damage_source);
  358. if(!isPlayer(damager)) {
  359. player_loc = entity.getLocation(player);
  360. if(loc.hasPlotId(player_loc, 128) && damage.getType(damage_source) == "fall") {
  361. cancel = true;
  362. }
  363. goto("wait");
  364. }
  365. if(player == damager) {
  366. goto("wait");
  367. }
  368. if(!hasPvpOn(damager)) {
  369. cancel = true;
  370. msg.prefix(damager, "§5PvP", "You have PvP disabled.");
  371. goto("wait");
  372. }
  373. if(!hasPvpOn(player)) {
  374. cancel = true;
  375. msg.prefix(damager, "§5PvP", concat(player.getName(player), " has PvP disabled."));
  376. goto("wait");
  377. }
  378. goto("wait");
  379. @entity_click
  380. if(hand == "OFF_HAND") {
  381. goto("wait");
  382. }
  383. if(entity.getType(entity) == "human") {
  384. entity_name = entity.getName(entity);
  385. if(entity_name == "Info-Point") {
  386. msg(player, getSpacer());
  387. msg(player, text.click("§r [§cclick§r] [§eSurvival§r]", "/infopoint1"));
  388. msg(player, text.click("§r [§cclick§r] [§eAdventure§r]", "/infopoint2"));
  389. msg(player, text.click("§r [§cclick§r] [§ePlots§r]", "/infopoint3"));
  390. msg(player, text.click("§r [§cclick§r] [§eClans§r]", "/infopoint4"));
  391. msg(player, text.click("§r [§cclick§r] [§eCities§r]", "/infopoint5"));
  392. msg(player, text.click("§r [§cclick§r] [§eShops§r]", "/infopoint6"));
  393. msg(player, text.click("§r [§cclick§r] [§eMinigames§r]", "/infopoint7"), " ", text.click("§f[§bTeleport§f]", "/games"));
  394. msg(player, text.click("§r [§cclick§r] [§eQuests§r]", "/infopoint8"), " ", text.click("§f[§bTeleport§f]", "/story"));
  395. msg(player, text.click("§r [§cclick§r] [§eRanking§r]", "/infopoint9"), " ", text.link("§f[§bRanks§f]", "https://minecraft.hammerle.me/?site=ranks"));
  396. msg(player, text.click("§r [§cclick§r] [§eRules§r]", "/infopoint10"), " ", text.link("§f[§bFake Rules§f]", "https://minecraft.hammerle.me/?site=rules"));
  397. msg(player, text.click("§r [§cclick§r] [§eNote§r]", "/infopoint11"));
  398. goto("wait");
  399. }
  400. if(entity_name == "Recipes") {
  401. recipe_menu = inv.new("333333333333333333333333333333333333333333333200000022");
  402. recipe.setPage(player, recipe_menu, 1);
  403. inv.open(recipe_menu, player, "Recipes");
  404. goto("wait");
  405. }
  406. if(entity_name == "Banker") {
  407. inv.open(bankmenu, player, "Banker");
  408. goto("wait");
  409. }
  410. if(entity_name == "Adventure") {
  411. if(!player.isOnAdventure(player)) {
  412. msg.prefix(player, "§5Adventure", "§rYou aren't on an adventure. Click the chest in the teleporter to start an adventure.");
  413. goto("wait");
  414. }
  415. player.setAdventure(player, false);
  416. adventures = player.getAdventureAmounts(player);
  417. if(adventures == null) {
  418. adventures = 0;
  419. }
  420. player.setAdventureAmounts(player, ++adventures);
  421. msg.prefix(player, "§5Adventure", "§rCongratulations, you finished your adventure, here ist your reward!");
  422. if(adventures == 10) {
  423. offerRank(player, "rank.pioneer");
  424. } elseif(adventures == 5) {
  425. offerRank(player, "rank.explorer");
  426. } elseif(adventures == 1) {
  427. offerRank(player, "rank.adventurer");
  428. }
  429. removeAdventureDisplay(player);
  430. player.safeGiveItem(player, coin_silver);
  431. goto("wait");
  432. }
  433. }
  434. goto("wait");
  435. @player_login
  436. if(player.isOnAdventure(player)) {
  437. addAdventureDisplay(player, adventure_aim_loc);
  438. }
  439. goto("wait");
  440. @inv_click
  441. cancel = true;
  442. if(inv_id == bankinvid) { //Bankmenü
  443. gold_inv = player.getItemAmount(player, false, coin_gold);
  444. silver_inv = player.getItemAmount(player, false, coin_silver);
  445. copper_inv = player.getItemAmount(player, false, coin_copper);
  446. //Wechseln
  447. if(inv_slot == 5 || inv_slot == 6 || inv_slot == 13 || inv_slot == 14) {
  448. if(inv_slot == 5) {
  449. //1 Silbermünze --> 64 Kupfermünzen
  450. amount1 = 1;
  451. item1 = coin_silver;
  452. amount2 = 64;
  453. item2 = coin_copper64;
  454. message = "No silvercoin in inventory.";
  455. item_type = "km:coin_copper";
  456. coin_inv = silver_inv;
  457. }
  458. elseif(inv_slot == 6) {
  459. //64 Kupfermünzen --> 1 Silbermünze
  460. amount1 = 64;
  461. item1 = coin_copper64;
  462. amount2 = 1;
  463. item2 = coin_silver;
  464. message = "Not enough coppercoins in inventory.";
  465. item_type = "km:coin_silver";
  466. coin_inv = copper_inv;
  467. }
  468. elseif(inv_slot == 13) {
  469. //1 Goldmünze --> 64 Silbermünzen
  470. amount1 = 1;
  471. item1 = coin_gold;
  472. amount2 = 64;
  473. item2 = coin_silver64;
  474. message = "No goldcoin in inventory.";
  475. item_type = "km:coin_silver";
  476. coin_inv = gold_inv;
  477. }
  478. elseif(inv_slot == 14) {
  479. //64 Silbermünzen --> 1 Goldmünze
  480. amount1 = 64;
  481. item1 = coin_silver64;
  482. amount2 = 1;
  483. item2 = coin_gold;
  484. message = "Not enough silvercoins in inventory.";
  485. item_type = "km:coin_gold";
  486. coin_inv = silver_inv;
  487. }
  488. if(coin_inv < amount1) {
  489. msg.prefix(player, prefix_money, message);
  490. goto("wait");
  491. }
  492. player.removeItemNbt(player, item1);
  493. notgiven = player.giveItem(player, item2);
  494. if(item.getType(notgiven) != "minecraft:air") {
  495. amount = item.getAmount(notgiven);
  496. player.removeItemNbt(player, read.item(item_type, amount2 - amount));
  497. player.giveItem(player, item1);
  498. msg.prefix(player, prefix_money, "Not enough space in inventory.");
  499. goto("wait");
  500. }
  501. inv.update(player);
  502. msg.prefix(player, prefix_money, "Exchange succesfull.");
  503. goto("wait");
  504. }
  505. //Kontobewegungen
  506. if(inv_slot == 1 || inv_slot == 9) {
  507. betrag = 1;
  508. coin_inv = copper_inv;
  509. }
  510. elseif(inv_slot == 2 || inv_slot == 10) {
  511. betrag = 64;
  512. coin_inv = silver_inv;
  513. }
  514. elseif(inv_slot == 3 || inv_slot == 11) {
  515. betrag = 4096;
  516. coin_inv = gold_inv;
  517. }
  518. //Einzahlen
  519. if(inv_slot > 0 && inv_slot < 4) {
  520. player_id = player.getId(player);
  521. if(coin_inv < 1) {
  522. msg.prefix(player, prefix_money, "§rCoin not in inventory.");
  523. } else {
  524. addMoney(player, betrag);
  525. player.removeItemNbt(player, inv.getItem(bankmenu, inv_slot));
  526. inv.update(player);
  527. }
  528. goto("wait");
  529. }
  530. //Auszahlen
  531. if(inv_slot > 8 && inv_slot < 12) {
  532. player_id = player.getId(player);
  533. if(!hasEnoughMoney(player_id, betrag)) {
  534. msg.prefix(player, prefix_money, "Not enough snuvis on your account.");
  535. } else {
  536. subMoney(player, betrag);
  537. player.giveItem(player, inv.getItem(bankmenu, inv_slot));
  538. inv.update(player);
  539. }
  540. goto("wait");
  541. }
  542. goto("wait");
  543. }
  544. if(inv_id == gambler_inv_id) {
  545. if(inv_slot == 0) {
  546. amount = 1;
  547. } elseif(inv_slot == 1) {
  548. amount = 64;
  549. } elseif(inv_slot == 2) {
  550. amount = 4096;
  551. } elseif(inv_slot == 3) {
  552. amount = getMoney(player);
  553. if(amount == 0) {
  554. msg.prefix(player, prefix_money, "You need at least 1 snuvi on your account.");
  555. goto("wait");
  556. }
  557. }
  558. if(!hasEnoughMoney(player, amount)) {
  559. msg.prefix(player, prefix_money, "Not enough snuvis on your account.");
  560. goto("wait");
  561. }
  562. win = math.random(1, 2);
  563. if(win == 1) {
  564. addMoney(player, amount);
  565. temp = " won ";
  566. } else {
  567. subMoney(player, amount);
  568. temp = " lost ";
  569. }
  570. if(amount == 1) {
  571. message = concat(player.getName(player), temp, text.number(amount), " snuvi.");
  572. } else {
  573. message = concat(player.getName(player), temp, text.number(amount), " snuvis.");
  574. }
  575. msg.radius("§2Gambler", message, entity.getLocation(player), 50);
  576. goto("wait");
  577. }
  578. if(inv_name == "Recipes") {
  579. item_type = item.getType(item);
  580. if(item_type == "minecraft:air") {
  581. goto("wait");
  582. }
  583. if(item_type == "km:return_red") {
  584. page = map.getOrDefault($recipe_site_map, player.getUuid(player), 1);
  585. recipe.setPage(player, inv, page);
  586. goto("wait");
  587. }
  588. if(item_type == "minecraft:paper") {
  589. name = item.getName(item);
  590. if(text.contains(name, "<<") || text.contains(name, ">>")) {
  591. page = removeFormat(name);
  592. page = text.replace(page, "<<", "");
  593. page = text.replace(page, ">>", "");
  594. page = read.number(page);
  595. if(inv_slot == 46) {
  596. recipe.setPage(player, inv, page);
  597. }
  598. if(inv_slot == 47) {
  599. recipe.setPage(player, inv, page);
  600. }
  601. goto("wait");
  602. }
  603. }
  604. index = recipe.getIndexFromItemType(item_type);
  605. if(index == null) {
  606. goto("wait");
  607. }
  608. recipe.showRecipe(player, inv, index);
  609. }
  610. goto("wait");
  611. @projectile_hit
  612. if(!isPlayer(shooter)) {
  613. goto("wait");
  614. }
  615. player = shooter;
  616. duration = data.getTimer(player, "skill.fire_arrow");
  617. if(duration > 0) {
  618. if(loc_hit == null) {
  619. goto("wait");
  620. }
  621. flame = enchantment.getLevel(ench_flame, living.getHand(player));
  622. if(flame <= 0) {
  623. goto("wait");
  624. }
  625. if(!plot.check(loc_hit, player, 3, true) && !perm.has(player, "plot.bypass")) {
  626. msg.prefix(player, prefix_skill, "You have no permissions on this plot.");
  627. goto("wait");
  628. }
  629. ent_loc = entity.getLocation(projectile);
  630. if(block.isAir(ent_loc)){
  631. block.set(ent_loc, "minecraft:fire");
  632. }
  633. fire_ring(ent_loc, "minecraft:fire", 0);
  634. }
  635. goto("wait");
  636. function fire_ring(location, block_string, radius){
  637. loc_x = loc.getX(location);
  638. loc_y = loc.getY(location);
  639. loc_z = loc.getZ(location);
  640. for(a = -radius; a < radius + 1; a++){
  641. loc.setX(location, loc_x + a);
  642. for(b = -radius; b < radius + 1; b++){
  643. loc.setY(location, loc_y + b);
  644. for(c = -radius; c < radius + 1; c++){
  645. loc.setZ(location, loc_z + c);
  646. if(block.isAir(location)){
  647. block.set(location, block_string);
  648. }
  649. }
  650. }
  651. }
  652. }
  653. @block_break
  654. duration = data.getTimer(player, "block_down");
  655. if(duration > 0) {
  656. do = true;
  657. loc = loc.mod(block_loc, 0, -1, 0);
  658. b_type = block.getType(loc);
  659. if(b_type == "minecraft:bedrock" || b_type == "minecraft:end_portal_frame") {
  660. do = false;
  661. }
  662. if(!plot.check(loc, player, 2, true)) {
  663. do = false;
  664. }
  665. if(do) {
  666. block.break(loc, player);
  667. }
  668. }
  669. duration = data.getTimer(player, "block_up");
  670. if(duration > 0) {
  671. do = true;
  672. loc = loc.mod(block_loc, 0, 1, 0);
  673. b_type = block.getType(loc);
  674. if(b_type == "minecraft:bedrock" || b_type == "minecraft:end_portal_frame") {
  675. do = false;
  676. }
  677. if(!plot.check(loc, player, 2, true)) {
  678. do = false;
  679. }
  680. if(do) {
  681. block.break(loc, player);
  682. }
  683. }
  684. if(block_type == "minecraft:cobweb") {
  685. if(cancel) {
  686. goto("wait");
  687. }
  688. hand_item = living.getHand(player);
  689. if(!item.hasTag(sword_tag, hand_item)) {
  690. goto("wait");
  691. }
  692. amount = skill.getAmount(player, "skill.cobweb_miner");
  693. if(amount <= 0) {
  694. goto("wait");
  695. }
  696. if(!skill.isActivated(player, "skill.cobweb_miner")) {
  697. goto("wait");
  698. }
  699. location = loc.mod(block_loc, 0, 0, 0);
  700. cobweb_X = loc.getX(location);
  701. cobweb_Y = loc.getY(location);
  702. cobweb_Z = loc.getZ(location);
  703. unbreaking_level = enchantment.getLevel(ench_unbreaking, hand_item);
  704. for(a = -cobweb_radius; a < cobweb_radius + 1; a++) {
  705. loc.setX(location, cobweb_X + a);
  706. for(b = -cobweb_radius; b < cobweb_radius + 1; b++) {
  707. loc.setY(location, cobweb_Y + b);
  708. for(c = -cobweb_radius; c < cobweb_radius + 1; c++) {
  709. loc.setZ(location, cobweb_Z + c);
  710. if(math.abs(a) + math.abs(b) + math.abs(c) + math.random(0, 2) < cobweb_radius + 2) {
  711. shear_cobweb(location, block_type, player, unbreaking_level);
  712. }
  713. }
  714. }
  715. }
  716. goto("wait");
  717. }
  718. if(block.hasTag(leaves_tag, block)) {
  719. if(cancel) {
  720. goto("wait");
  721. }
  722. hand_item = living.getHand(player);
  723. if(item.getType(hand_item) != "minecraft:shears") {
  724. goto("wait");
  725. }
  726. if(block.property.getValue(block_loc, prop_persistent)){
  727. goto("wait");
  728. }
  729. amount = skill.getAmount(player, "skill.better_shears");
  730. if(amount <= 0) {
  731. goto("wait");
  732. }
  733. if(!skill.isActivated(player, "skill.better_shears")) {
  734. goto("wait");
  735. }
  736. location = loc.mod(block_loc, 0, 0, 0);
  737. shears_X = loc.getX(location);
  738. shears_Y = loc.getY(location);
  739. shears_Z = loc.getZ(location);
  740. unbreaking_level = enchantment.getLevel(ench_unbreaking, hand_item);
  741. radius = enchantment.getLevel(ench_sharpness, hand_item);
  742. if(radius > 0) {
  743. cancel = true;
  744. }
  745. orig_item = block.toStack(location);
  746. for(a = -radius; a < radius + 1; a++){
  747. loc.setX(location, shears_X + a);
  748. for(b = -radius; b < radius + 1; b++){
  749. loc.setY(location, shears_Y + b);
  750. for(c = -radius; c < radius + 1; c++){
  751. loc.setZ(location, shears_Z + c);
  752. if(math.abs(a) + math.abs(b) + math.abs(c) + math.random(0, 2) < radius + 2) {
  753. shear_leave(location, block_type, orig_item, player, unbreaking_level);
  754. }
  755. }
  756. }
  757. }
  758. goto("wait");
  759. }
  760. goto("wait");
  761. function shear_leave(block_loc, original_block_type, original_item, player, unbreaking_level){
  762. if(block.getType(block_loc) != original_block_type) {
  763. return;
  764. }
  765. if(block.property.getValue(block_loc, $prop_persistent)) {
  766. return;
  767. }
  768. block.set(block_loc, "minecraft:air");
  769. item.drop(block_loc, original_item);
  770. if(player.isSurvival(player)) {
  771. if(math.random(0, 99) < 100 / (unbreaking_level + 1)) {
  772. player.damageItem(player, 1);
  773. }
  774. }
  775. }
  776. function shear_cobweb(block_loc, original_block_type, player, unbreaking_level) {
  777. if(block.getType(block_loc) != original_block_type) {
  778. return;
  779. }
  780. block.break(block_loc, player);
  781. if(math.random(0, 99) < 100 / (unbreaking_level + 1)) {
  782. player.damageItem(player, 1);
  783. }
  784. }
  785. @block_click
  786. if(action == "right" && player.checkHandsForTag(player, dye_tag)) {
  787. if(block.hasTag(sign_tag, block)) {
  788. if(!perm.has(player, "plot.bypass")) {
  789. if(!plot.check(block_loc, player, 3, true)) {
  790. cancel = true;
  791. goto("wait");
  792. }
  793. }
  794. }
  795. }
  796. if(hand == "OFF_HAND") {
  797. goto("wait");
  798. }
  799. if(block_type == "minecraft:lectern") {
  800. if(action == "right") {
  801. itementity = entity.get(loc.mod(block_loc, 0.5, 0.9, 0.5), 0.2, "net.minecraft.entity.item.ItemEntity");
  802. if(itementity == null) {
  803. goto("wait");
  804. }
  805. list = entity.near(itementity, 0.2);
  806. list.add(list, itementity);
  807. if(list.getSize(list) < 2) {
  808. //Zu wenig Items am Lesepult
  809. goto("wait");
  810. }
  811. a = array.new(2, 6); //0 = item, 1 = itementity, 2 = enchantments, 3 = enchanted, 4 = enchanted_book, 5 = book
  812. size = 0;
  813. for(i = 0; i < list.getSize(list); i++) {
  814. entity = list.getIndex(list, i);
  815. item = item.entity.get(entity);
  816. size += item.getAmount(item);
  817. if(size > 2) {
  818. //Zu viele Items am Lesepult
  819. goto("wait");
  820. }
  821. map = enchantment.readFromItem(item);
  822. a[i, 0] = item;
  823. a[i, 1] = entity;
  824. a[i, 2] = map;
  825. a[i, 4] = false;
  826. a[i, 5] = false;
  827. if(map.getSize(map) > 0) {
  828. //Verzauberte Items
  829. a[i, 3] = true;
  830. if(item.getType(item) == "minecraft:enchanted_book") {
  831. a[i, 4] = true;
  832. }
  833. } else {
  834. //Nicht verzauberte Items
  835. a[i, 3] = false;
  836. if(item.getType(item) == "minecraft:book") {
  837. a[i, 5] = true;
  838. }
  839. }
  840. }
  841. lectern_action = null;
  842. if(a[0, 4] == true && a[1, 4] == true) {
  843. //Beide Items sind verzauberte Bücher
  844. lectern_action = 0;
  845. }
  846. elseif(a[0, 5] == true || a[1, 5] == true) {
  847. //Eines der beiden Items ist ein normales Buch
  848. if(a[0, 4] == true || a[1, 4] == true) {
  849. //Eines der beiden Items ist ein verzaubertes Buch
  850. lectern_action = 1;
  851. } elseif(a[0, 3] == true || a[1, 3] == true) {
  852. //Eines der beiden Items ist ein verzaubertes Item
  853. lectern_action = 2;
  854. }
  855. }
  856. elseif(a[0, 4] == true || a[1, 4] == true) {
  857. lectern_action = 3;
  858. }
  859. if(lectern_action == null) {
  860. goto("wait");
  861. }
  862. if(lectern_action == 0) {
  863. //Verzauberungsbücher mergen
  864. item1 = a[0, 0];
  865. item_entity1 = a[0, 1];
  866. item_entity2 = a[1, 1];
  867. map1 = a[0, 2];
  868. map2 = a[1, 2];
  869. map_size1 = map.getSize(map1);
  870. map_size2 = map.getSize(map2);
  871. iter = map.iterator(map2);
  872. betrag = 0;
  873. extra = 0;
  874. while(hasNext(iter)) {
  875. element = next(iter);
  876. key = map.getKey(element);
  877. level1 = map.getValue(element);
  878. level2 = map.getOrDefault(map1, key, 0);
  879. if(level1 == level2) {
  880. max_lvl = map.get(max_ench_lvl, key);
  881. //max_lvl = map.getOrDefault(max_ench_lvl, key, enchantment.getMaxLevel(key));
  882. if(max_lvl != null) {
  883. if(level1 < max_lvl) {
  884. extra += 40;
  885. level1++;
  886. }
  887. }
  888. }
  889. if(level2 > level1) {
  890. level1 = level2;
  891. }
  892. map.add(map1, key, level1);
  893. }
  894. if(map_size1 > map_size2) {
  895. map = map1;
  896. } else {
  897. map = map2;
  898. }
  899. iter = map.iterator(map);
  900. while(hasNext(iter)) {
  901. element = next(iter);
  902. level = map.getValue(element);
  903. betrag += level * 20 + extra;
  904. }
  905. if(!hasEnoughMoney(player.getId(player), betrag)) {
  906. msg.prefix(player, prefix_money, concat("Not enough coins in inventory. This action costs ", text.number(betrag), " snuvis."));
  907. goto("wait");
  908. }
  909. subMoney(player, betrag);
  910. enchantment.writeToItem(map1, item1);
  911. item.entity.set(item_entity1, item.clone(item1));
  912. entity.remove(item_entity2);
  913. } elseif(lectern_action == 1) {
  914. //Verzauberungsbuch kopieren
  915. if(a[0, 5]) {
  916. book_index = 0;
  917. other_index = 1;
  918. } else {
  919. book_index = 1;
  920. other_index = 0;
  921. }
  922. item1 = a[book_index, 0];
  923. item_entity1 = a[book_index, 1];
  924. item2 = a[other_index, 0];
  925. item_entity2 = a[other_index, 1];
  926. map2 = a[other_index, 2];
  927. map_size = map.getSize(map2);
  928. betrag = 20 * map_size;
  929. if(!hasEnoughMoney(player.getId(player), betrag)) {
  930. msg.prefix(player, prefix_money, concat("Not enough snuvis on your account. This action costs ", text.number(betrag), " snuvis."));
  931. goto("wait");
  932. }
  933. subMoney(player, betrag);
  934. item1 = read.item("minecraft:enchanted_book");
  935. enchantment.writeToItem(map2, item1);
  936. item.entity.set(item_entity1, item1);
  937. item.entity.set(item_entity2, item.clone(item2));
  938. } elseif(lectern_action == 2) {
  939. //Einzelne Verzauberung herunterziehen
  940. if(a[0, 5]) {
  941. book_index = 0;
  942. other_index = 1;
  943. } else {
  944. book_index = 1;
  945. other_index = 0;
  946. }
  947. item_entity1 = a[book_index, 1];
  948. map1 = map.new();
  949. item2 = a[other_index, 0];
  950. item_entity2 = a[other_index, 1];
  951. map2 = a[other_index, 2];
  952. item1 = read.item("minecraft:enchanted_book");
  953. element = next(map.iterator(map2));
  954. key = map.getKey(element);
  955. value = map.getValue(element);
  956. map.add(map1, key, value);
  957. map.remove(map2, key);
  958. betrag = 20 * value;
  959. if(!hasEnoughMoney(player.getId(player), betrag)) {
  960. msg.prefix(player, prefix_money, concat("Not enough snuvis in your ccount. This action costs ", text.number(betrag), " snuvis."));
  961. goto("wait");
  962. }
  963. subMoney(player, betrag);
  964. enchantment.writeToItem(map1, item1);
  965. enchantment.writeToItem(map2, item2);
  966. item.entity.set(item_entity1, item1);
  967. item.entity.set(item_entity2, item.clone(item2));
  968. } elseif(lectern_action == 3) {
  969. //Alle Verzauberungen vom Buch auf das Item übertragen
  970. betrag = 0;
  971. if(a[0, 4]) {
  972. ench_book_index = 0;
  973. other_index = 1;
  974. } else {
  975. ench_book_index = 1;
  976. other_index = 0;
  977. }
  978. item1 = a[ench_book_index, 0];
  979. item_entity1 = a[ench_book_index, 1];
  980. map1 = a[ench_book_index, 2];
  981. item2 = a[other_index, 0];
  982. item_entity2 = a[other_index, 1];
  983. map2 = a[other_index, 2];
  984. map_size1 = map.getSize(map1);
  985. map_size2 = map.getSize(map2);
  986. iter = map.iterator(map1);
  987. while(hasNext(iter)) {
  988. element = next(iter);
  989. key = map.getKey(element);
  990. value = map.getValue(element);
  991. value2 = map.getOrDefault(map2, key, 0);
  992. if(value2 > value) {
  993. value = value2;
  994. }
  995. map.add(map2, key, value);
  996. }
  997. if(map_size1 > map_size2) {
  998. map = map1;
  999. } else {
  1000. map = map2;
  1001. }
  1002. iter = map.iterator(map);
  1003. while(hasNext(iter)) {
  1004. element = next(iter);
  1005. level = map.getValue(element);
  1006. betrag += level * 20;
  1007. }
  1008. if(!hasEnoughMoney(player.getId(player), betrag)) {
  1009. msg.prefix(player, prefix_money, concat("Not enough snuvis on your account. This action costs ", text.number(betrag), " snuvis."));
  1010. goto("wait");
  1011. }
  1012. subMoney(player, betrag);
  1013. enchantment.writeToItem(map2, item2);
  1014. item.entity.set(item_entity2, item.clone(item2));
  1015. entity.remove(item_entity1);
  1016. }
  1017. entity.throw(item_entity1, 0, 0.3, 0);
  1018. entity.throw(item_entity2, 0, 0.3, 0);
  1019. particle.spawn(loc.mod(block_loc, 0.5, 1.4, 0.5), par, 20, 0, 0.25, 0.25, 0.25);
  1020. msg.prefix(player, prefix_money, concat("This cost " , text.number(betrag), " snuvis."));
  1021. }
  1022. goto("wait");
  1023. }
  1024. if(block_type == "minecraft:chest") {
  1025. if(isATpReceiver(block_loc)) {
  1026. tp_item = read.item("km:gear", 1, "§rTeleport");
  1027. list = list.new();
  1028. list.add(list, world.getName(loc.getWorld(block_loc)));
  1029. list.add(list, text.number(loc.getX(block_loc)));
  1030. list.add(list, text.number(loc.getY(block_loc)));
  1031. list.add(list, text.number(loc.getZ(block_loc)));
  1032. item.setLore(tp_item, list);
  1033. player.giveItem(player, tp_item);
  1034. goto("wait");
  1035. }
  1036. if(isATpTransmitter(block_loc)) {
  1037. player_uuid = player.getUuid(player);
  1038. clicked = map.getOrDefault(tp_map, player_uuid, 0);
  1039. now_time = time.getMillis();
  1040. if(now_time - clicked < 5000) {
  1041. msg.prefix(player, "§5Adventure", "Wait 5 seconds!");
  1042. goto("wait");
  1043. }
  1044. map.add(tp_map, player_uuid, now_time);
  1045. //Abenteuer-Teleport
  1046. if(block_loc == adventure_chest_loc) {
  1047. if(!player.isOnAdventure(player)) {
  1048. if(!player.hasClearInventory(player)) {
  1049. msg.prefix(player, "§5Adventure", "Your inventory needs to be empty!");
  1050. goto("wait");
  1051. }
  1052. alpha = math.random(0, 360);
  1053. alpha *= math.pi() / 180;
  1054. x = math.round(math.sin(alpha) * 10000) + 0.5;
  1055. z = math.round(math.cos(alpha) * 10000) + 0.5;
  1056. y = 255;
  1057. tp_loc = loc.new(world.getOverWorld(), x, y, z);
  1058. while(block.isAir(tp_loc)) {
  1059. loc.setY(tp_loc, y);
  1060. y--;
  1061. }
  1062. tp_loc = loc.mod(tp_loc, 0, 1, 0);
  1063. setTpWallX(block_loc, "minecraft:lime_stained_glass");
  1064. sound.spawn(block_loc, piston_sound, sound_category_ambient);
  1065. array = array.new(4);
  1066. array[0] = player.getUuid(player);
  1067. array[1] = block_loc;
  1068. array[2] = tp_loc;
  1069. array[3] = true;
  1070. list.add(tp_list, array);
  1071. sgoto(30, "tp_ticker");
  1072. }
  1073. goto("wait");
  1074. }
  1075. //Normaler Teleport
  1076. temp = false;
  1077. inv = block.getInv(block_loc);
  1078. inv_size = inv.getSize(inv);
  1079. for(i = 0; i < inv_size; i++) {
  1080. item = inv.getItem(inv, i);
  1081. if(item.getType(item) == "km:gear") {
  1082. if(item.getName(item) == "§rTeleport") {
  1083. temp = true;
  1084. break;
  1085. }
  1086. }
  1087. }
  1088. if(!temp) {
  1089. msg.prefix(player, "§5Adventure", "No receiver found!");
  1090. goto("wait");
  1091. }
  1092. lore_list = item.getLore(item);
  1093. if(list.getSize(lore_list) != 4) {
  1094. msg.prefix(player, "§5Adventure", "No receiver found!");
  1095. goto("wait");
  1096. }
  1097. world = world.get(list.getIndex(lore_list, 0));
  1098. x = read.number(list.getIndex(lore_list, 1));
  1099. y = read.number(list.getIndex(lore_list, 2));
  1100. z = read.number(list.getIndex(lore_list, 3));
  1101. tp_loc = loc.new(world, x, y, z);
  1102. if(!isATpReceiver(tp_loc)) {
  1103. msg.prefix(player, "§5Adventure", "No receiver found!");
  1104. goto("wait");
  1105. }
  1106. loc.add(tp_loc, 0.5, -3, 0.5);
  1107. setTpWallX(block_loc, "minecraft:lime_stained_glass");
  1108. sound.spawn(block_loc, piston_sound, sound_category_ambient);
  1109. array = array.new(4);
  1110. array[0] = player.getUuid(player);
  1111. array[1] = block_loc;
  1112. array[2] = tp_loc;
  1113. array[3] = false;
  1114. list.add(tp_list, array);
  1115. sgoto(30, "tp_ticker");
  1116. }
  1117. goto("wait");
  1118. }
  1119. if(block_loc == gambler_loc) {
  1120. cancel = true;
  1121. inv.open(gambler_inv, player, "Choose your amount to bet with");
  1122. goto("wait");
  1123. }
  1124. if(block_loc == lottery_loc_1 || block_loc == lottery_loc_2) {
  1125. if(!hasEnoughMoney(player, 1)) {
  1126. msg.prefix(player, prefix_money, "Not enough snuvis on your account.");
  1127. goto("wait");
  1128. }
  1129. subMoney(player, 1);
  1130. amount = lottery.add(block_loc, 1);
  1131. if(block_loc == lottery_loc_1) {
  1132. winrate = 1000;
  1133. } else {
  1134. winrate = 10000;
  1135. }
  1136. win = math.random(1, winrate);
  1137. if(win == 1) {
  1138. addMoney(player, amount);
  1139. lottery.set(block_loc, 0);
  1140. message = concat(player.getName(player), " has won ", text.number(amount), " snuvis.");
  1141. msg.radius(prefix_money, message, block_loc, 50);
  1142. }
  1143. goto("wait");
  1144. }
  1145. goto("wait");
  1146. @living_death
  1147. if(isPlayer(living_entity)) {
  1148. player = living_entity;
  1149. setDeathLoc(player);
  1150. loc = entity.getLocation(player);
  1151. amount = skill.getAmount(player, "skill.subcu_inv");
  1152. if(skill.isActivated(player, "skill.subcu_inv") && amount > 0) {
  1153. new_amount = amount - 1;
  1154. skill.setAmount(player, "skill.subcu_inv", new_amount);
  1155. msg.prefix(player, prefix_skill, concat("Used Subcutaneous Inventory. New amount: ", text.number(new_amount)));
  1156. } else {
  1157. player.dropInventory(player, loc);
  1158. }
  1159. killer = player.getFromDamageSource(damage_source);
  1160. if(isPlayer(killer)) {
  1161. amount = skill.getAmount(player, "skill.head_human");
  1162. if(amount >= 1) {
  1163. if(perm.has(player, "isTeam")) {
  1164. temp = math.random(1, 20);
  1165. } else {
  1166. temp = math.random(1, 5);
  1167. }
  1168. if(temp == 1) {
  1169. item.drop(loc, player.getHead(player.getUuid(player), player.getName(player)));
  1170. }
  1171. }
  1172. }
  1173. goto("wait");
  1174. }
  1175. killer = player.getFromDamageSource(damage_source);
  1176. if(isPlayer(killer)) {
  1177. r = math.random(1, 20);
  1178. if(r == 1) {
  1179. amount = skill.getAmount(killer, "skill.head_monster");
  1180. if(amount >= 1) {
  1181. entity_type = entity.getType(living_entity);
  1182. if(entity_type == "creeper") {
  1183. item.drop(loc, read.item("minecraft:creeper_head"));
  1184. goto("wait");
  1185. }
  1186. if(entity_type == "zombie") {
  1187. item.drop(loc, read.item("minecraft:zombie_head"));
  1188. goto("wait");
  1189. }
  1190. if(entity_type == "skeleton") {
  1191. item.drop(loc, read.item("minecraft:skeleton_skull"));
  1192. goto("wait");
  1193. }
  1194. }
  1195. }
  1196. }
  1197. goto("wait");
  1198. @player_pre_respawn
  1199. if(loc.isInSurvWorld(entity.getLocation(player))) {
  1200. set.add(survival_respawn, player.getUuid(player));
  1201. }
  1202. goto("wait");
  1203. @player_post_respawn
  1204. player_uuid = player.getUuid(player);
  1205. if(set.contains(survival_respawn, player_uuid)) {
  1206. set.remove(survival_respawn, player_uuid);
  1207. if(player.isOnAdventure(player)) {
  1208. tp_loc = player.getAdventureStart(player);
  1209. entity.teleport(player, tp_loc);
  1210. goto("wait");
  1211. }
  1212. amount = skill.getAmount(player, "skill.comeback");
  1213. if(skill.isActivated(player, "skill.comeback") && amount > 0) {
  1214. new_amount = amount - 1;
  1215. skill.setAmount(player, "skill.comeback", new_amount);
  1216. msg.prefix(player, prefix_skill, concat("Used Comeback. New amount: ", text.number(new_amount)));
  1217. entity.teleport(player, getDeathLoc(player));
  1218. goto("wait");
  1219. }
  1220. entity.teleport(player, world.getServerSpawn());
  1221. }
  1222. goto("wait");
  1223. @tp_ticker
  1224. array = list.getIndex(tp_list, 0);
  1225. list.removeIndex(tp_list, 0);
  1226. block_loc = array[1];
  1227. list.add(tp_list, array);
  1228. setTpWallFull(block_loc, "minecraft:lime_stained_glass");
  1229. sound.spawn(block_loc, piston_sound, sound_category_ambient);
  1230. sgoto(30, "tp_final");
  1231. goto("wait");
  1232. @tp_final
  1233. array = list.getIndex(tp_list, 0);
  1234. list.removeIndex(tp_list, 0);
  1235. player_uuid = array[0];
  1236. block_loc = array[1];
  1237. tp_loc = array[2];
  1238. adventure = array[3];
  1239. sound.spawn(block_loc, piston_sound, sound_category_ambient);
  1240. setTpWallFull(block_loc, "minecraft:air");
  1241. player = player.get(player_uuid);
  1242. if(player == null) {
  1243. goto("wait");
  1244. }
  1245. sound.spawn(tp_loc, adv_tp_sound, sound_category_ambient);
  1246. if(adventure) {
  1247. //Party
  1248. if(player.isInParty(player) && player.isPartyLeader(player)) {
  1249. party_id = player.getPartyId(player);
  1250. party_list = party.getList(party_id);
  1251. iter = list.iterator(party_list);
  1252. while(hasNext(iter)) {
  1253. p = player.get(next(iter));
  1254. p_name = player.getName(p);
  1255. p_loc = entity.getLocation(p);
  1256. if(!loc.isSameWorld(adventure_chest_loc, p_loc)) {
  1257. msg.prefix(player, "§5Party", concat(p_name, "§c is in another world."));
  1258. msg.prefix(p, "§5Party", "§cYou are in another world.");
  1259. continue;
  1260. }
  1261. if(loc.distance(adventure_chest_loc, p_loc) > 5) {
  1262. msg.prefix(player, "§5Party", concat(p_name, "§c is too far away."));
  1263. msg.prefix(p, "§5Party", "§cYou are too far away.");
  1264. continue;
  1265. }
  1266. if(player.hasMinigame(p)) {
  1267. msg.prefix(player, "§5Party", concat(p_name, "§c is in a game."));
  1268. msg.prefix(p, "§5Party", "§cYou are in a game.");
  1269. continue;
  1270. }
  1271. if(player.hasQuest2(p)) {
  1272. msg.prefix(player, "§5Party", concat(p_name, "§c is doing a quest."));
  1273. msg.prefix(p, "§5Party", "§cYou are doing a quest.");
  1274. continue;
  1275. }
  1276. if(player.isOnAdventure(p)) {
  1277. msg.prefix(player, "§5Party", concat(p_name, "§c is already on an adventure."));
  1278. msg.prefix(p, "§5Party", "§cYou are already on an adventure.");
  1279. continue;
  1280. }
  1281. if(player.isAfk(p)) {
  1282. msg.prefix(player, "§5Party", concat(p_name, "§c is afk."));
  1283. msg.prefix(p, "§5Party", "§cYou are afk.");
  1284. continue;
  1285. }
  1286. if(!player.hasClearInventory(p)) {
  1287. msg.prefix(player, "§5Party", concat(p_name, "§c has no clear inventory."));
  1288. msg.prefix(p, "§5Party", "§cYou have no clear inventory.");
  1289. continue;
  1290. }
  1291. player.teleport(p, tp_loc, false);
  1292. player.setAdventure(p, true);
  1293. player.setAdventureStart(p, tp_loc);
  1294. addAdventureDisplay(p, adventure_aim_loc);
  1295. title.reset(p);
  1296. title.setSub(p, "Have fun!");
  1297. title.send(p, "§cAdventure");
  1298. msg.prefix(p, "§5Adventure", "§rTo complete your adventure, go to the survival spawn. You cannot teleport. If you die, you start again!");
  1299. }
  1300. goto("wait");
  1301. }
  1302. if(!player.hasClearInventory(player)) {
  1303. msg.prefix(player, "§5Adventure", "Your inventory needs to be empty!");
  1304. goto("wait");
  1305. }
  1306. player.teleport(player, tp_loc, false);
  1307. player.setAdventure(player, true);
  1308. player.setAdventureStart(player, tp_loc);
  1309. addAdventureDisplay(player, adventure_aim_loc);
  1310. title.reset(player);
  1311. title.setSub(player, "Have fun!");
  1312. title.send(player, "§cAdventure");
  1313. msg.prefix(player, "§5Adventure", "§rTo complete your adventure, go to the survival spawn. You cannot teleport. If you die, you start again!");
  1314. goto("wait");
  1315. }
  1316. player.teleport(player, tp_loc, false);
  1317. goto("wait");
  1318. function lottery.set(location, amount) {
  1319. location = loc.mod(location, 0.5, 0, 0.5);
  1320. list = living.near(location, 0.1);
  1321. text_entity = list.getIndex(list, 0);
  1322. name = entity.getName(text_entity);
  1323. if(!text.startsWith(name, "Snuvis: ", 0)) {
  1324. snuvi.debug("Lottery error");
  1325. goto("wait");
  1326. }
  1327. entity.setName(text_entity, concat("Snuvis: ", text.number(amount)), true);
  1328. }
  1329. function lottery.add(location, amount) {
  1330. location = loc.mod(location, 0.5, 0, 0.5);
  1331. list = living.near(location, 0.1);
  1332. text_entity = list.getIndex(list, 0);
  1333. name = entity.getName(text_entity);
  1334. if(!text.startsWith(name, "Snuvis: ", 0)) {
  1335. snuvi.debug("Lottery error");
  1336. goto("wait");
  1337. }
  1338. amount = text.convert(text.subString(name, 8, text.length(name))) + 1;
  1339. entity.setName(text_entity, concat("Snuvis: ", text.number(amount)), true);
  1340. return amount;
  1341. }
  1342. function recipe.add(result_amount, result_item, item1, item2, item3, item4, item5, item6, item7, item8, item9) {
  1343. array = array.new(11);
  1344. array[0] = result_amount;
  1345. array[1] = result_item;
  1346. array[2] = item1;
  1347. array[3] = item2;
  1348. array[4] = item3;
  1349. array[5] = item4;
  1350. array[6] = item5;
  1351. array[7] = item6;
  1352. array[8] = item7;
  1353. array[9] = item8;
  1354. array[10] = item9;
  1355. list.add($items_list, array);
  1356. }
  1357. function recipe.getIndexFromItemType(item_type) {
  1358. for(i = 0; i < list.getSize($items_list); i++) {
  1359. array = list.getIndex($items_list, i);
  1360. if(array[1] == item_type) {
  1361. return i;
  1362. }
  1363. }
  1364. return null;
  1365. }
  1366. function recipe.showRecipe(player, menu, index) {
  1367. for(i = 0; i < 48; i++) {
  1368. inv.setItem(menu, i, $air_item);
  1369. }
  1370. array = list.getIndex($items_list, index);
  1371. inv.setItem(menu, 23, read.item("km:arrow_right"));
  1372. inv.setItem(menu, 45, read.item("km:return_red", 1, "§fReturn to overview"));
  1373. inv.setItem(menu, 10, read.item(array[2]));
  1374. inv.setItem(menu, 11, read.item(array[3]));
  1375. inv.setItem(menu, 12, read.item(array[4]));
  1376. inv.setItem(menu, 19, read.item(array[5]));
  1377. inv.setItem(menu, 20, read.item(array[6]));
  1378. inv.setItem(menu, 21, read.item(array[7]));
  1379. inv.setItem(menu, 28, read.item(array[8]));
  1380. inv.setItem(menu, 29, read.item(array[9]));
  1381. inv.setItem(menu, 30, read.item(array[10]));
  1382. inv.setItem(menu, 25, read.item(array[1], array[0]));
  1383. inv.update(player);
  1384. }
  1385. function recipe.setPage(player, menu, page) {
  1386. map.add($recipe_site_map, player.getUuid(player), page);
  1387. size = list.getSize($items_list);
  1388. max_page = math.roundUp(size / 45);
  1389. if(page > max_page) {
  1390. return;
  1391. }
  1392. inv.setItem(menu, 45, $air_item);
  1393. if(page > 1) {
  1394. inv.setItem(menu, 46, read.item("minecraft:paper", 1, concat("§e", text.number(page - 1), " <<")));
  1395. } else {
  1396. inv.setItem(menu, 46, $air_item);
  1397. }
  1398. if(page < max_page) {
  1399. inv.setItem(menu, 47, read.item("minecraft:paper", 1, concat("§e>> ", text.number(page + 1))));
  1400. } else {
  1401. inv.setItem(menu, 47, $air_item);
  1402. }
  1403. max_index = size - 1;
  1404. for(i = 0; i < 45; i++) {
  1405. list_index = i + 45 * (page - 1);
  1406. if(list_index > max_index) {
  1407. inv.setItem(menu, i, $air_item);
  1408. } else {
  1409. array = list.getIndex($items_list, list_index);
  1410. inv.setItem(menu, i, read.item(array[1]));
  1411. }
  1412. }
  1413. inv.update(player);
  1414. }
  1415. function setDeathLoc(player) {
  1416. map.add($death_loc_map, player.getUuid(player), entity.getLocation(player));
  1417. }
  1418. function getDeathLoc(player) {
  1419. return map.getOrDefault($death_loc_map, player.getUuid(player), world.getServerSpawn());
  1420. }