survival.txt 45 KB

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