survival.txt 45 KB

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