survival.txt 48 KB

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