survival.txt 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216
  1. setMoney(114, 0);
  2. event.load("entity_click");
  3. event.load("container_click");
  4. event.load("inv_click");
  5. event.load("player_pre_respawn");
  6. event.load("player_post_respawn");
  7. event.load("player_login");
  8. event.load("player_move");
  9. event.load("block_break");
  10. event.load("block_click");
  11. event.load("living_death");
  12. event.load("living_pre_hurt");
  13. event.load("pre_explosion");
  14. event.load("mob_griefing");
  15. event.load("item_air_click");
  16. event.load("projectile_hit");
  17. event.load("ender_teleport");
  18. setScriptVar("skills", list.new());
  19. skill.add("Keep Inventory", "skill.subcu_inv", "minecraft:chest", "Keeps the inventory on death", 100, false, false, true);
  20. skill.add("Comeback", "skill.comeback", "km:skill55", "Respawn at your death location", 100, false, false, true);
  21. 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);
  22. 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);
  23. skill.add("Fly 10min", "skill.fly10min", "minecraft:elytra", "You can fly for 10 minutes", 4096, false, true, false);
  24. skill.add("Grow", "skill.grow", "minecraft:farmland", "Grow seeds in radius 5", 25, false, true, false);
  25. skill.add("Haste", "skill.haste", "minecraft:iron_pickaxe", "Haste for 2 minutes", 25, false, true, false);
  26. skill.add("Speed", "skill.speed", "minecraft:iron_boots", "Speed for 2 minutes", 25, false, true, false);
  27. skill.add("Jump Boost", "skill.jump_boost", "minecraft:rabbit_foot", "JumpBoost Lvl.2 for 2 minutes", 25, false, true, false);
  28. skill.add("Dolphin", "skill.dolphin", "minecraft:fire_coral", "Swim like a dolphin for a minute", 25, false, true, false);
  29. skill.add("Block Up", "skill.block_up", "minecraft:diamond_pickaxe", "Break a block and the block above for a minute", 25, false, true, false);
  30. skill.add("Block Down", "skill.block_down", "minecraft:diamond_pickaxe", "Break a block and the block below for a minute", 25, false, true, false);
  31. skill.add("Timber", "skill.timber", "minecraft:iron_axe", "Break whole trees with an axe for a minute", 128, false, true, false);
  32. 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);
  33. skill.add("Better Shears", "skill.better_shears", "minecraft:shears", "Sharpness enchanted shears increase the radius for destruction of leaves", 500, true, false, true);
  34. skill.add("Cobweb Miner", "skill.cobweb_miner", "minecraft:cobweb", "Swords increase the radius for destruction of cobwebs", 250, true, false, true);
  35. clan.loadData();
  36. tp_list = list.new();
  37. tp_map = map.new();
  38. tp_set = set.new();
  39. afk_loop_map = map.new();
  40. death_loc_map = map.new();
  41. survival_respawn = set.new();
  42. overworld = world.getOverWorld();
  43. moveid_storyspawn = event.addMoveData(loc.new(overworld, 167, 70, 241), loc.new(overworld, 169, 72, 243), 5, -1);
  44. moveid_gamesspawn = event.addMoveData(loc.new(overworld, 219, 66, 253), loc.new(overworld, 223, 69, 258), 5, -1);
  45. move_id_afk_loop = event.addMoveData(loc.new(overworld, 208, 69, 226), loc.new(overworld, 209, 69.5, 227), 5, -1);
  46. move_id_afk_loop_2 = event.addMoveData(loc.new(overworld, 208, 62, 242), loc.new(overworld, 209, 62.5, 243), 5, -1);
  47. move_id_afk_loop_3 = event.addMoveData(loc.new(overworld, 210, 62, 242), loc.new(overworld, 211, 62.5, 243), 5, -1);
  48. move_id_afk_loop_4 = event.addMoveData(loc.new(overworld, 206, 62, 246), loc.new(overworld, 207, 62.5, 247), 5, -1);
  49. move_id_afk_loop_5 = event.addMoveData(loc.new(overworld, 212, 62, 246), loc.new(overworld, 213, 62.5, 247), 5, -1);
  50. afk_loop_ids = set.new();
  51. set.add(afk_loop_ids, move_id_afk_loop);
  52. set.add(afk_loop_ids, move_id_afk_loop_2);
  53. set.add(afk_loop_ids, move_id_afk_loop_3);
  54. set.add(afk_loop_ids, move_id_afk_loop_4);
  55. set.add(afk_loop_ids, move_id_afk_loop_5);
  56. config = getScriptVar("server_config");
  57. survival_spawn = read.location(config.getString(config, "surv_spawn", "games:0:0:0"));
  58. adventure_chest_loc = loc.new(overworld, 177, 74, 237);
  59. adventure_aim_loc = loc.new(overworld, 180, 70, 241);
  60. lottery_loc_1 = loc.new(overworld, 186, 69, 227);
  61. lottery_loc_2 = loc.new(overworld, 186, 69, 223);
  62. gambler_loc = loc.new(overworld, 185, 68, 225);
  63. prefix_money = "§2Money";
  64. prefix_skill = "§2Skill";
  65. sword_tag = item.getTag("km:sword");
  66. dye_tag = item.getTag("km:dye");
  67. leaves_tag = block.getTag("minecraft:leaves");
  68. sign_tag = block.getTag("minecraft:signs");
  69. prop_persistent = block.getProperty("persistent");
  70. ench_flame = enchantment.get("flame");
  71. ench_unbreaking = enchantment.get("unbreaking");
  72. ench_sharpness = enchantment.get("sharpness");
  73. piston_sound = sound.get("block.piston.extend");
  74. adv_tp_sound = sound.get("block.portal.travel");
  75. sound_category_ambient = sound.getCategory("ambient");
  76. sound_category_master = sound.getCategory("master");
  77. sound_flute = sound.get("block.note_block.flute");
  78. sound_harp = sound.get("block.note_block.harp");
  79. sound_pling = sound.get("block.note_block.pling");
  80. sound_cat = sound.get("entity.cat.ambient");
  81. sound_stray_cat = sound.get("entity.cat.stray_ambient");
  82. sound_purreow = sound.get("entity.cat.purreow");
  83. sound_drink_milk = sound.get("entity.wandering_trader.drink_milk");
  84. sound_slime_place = sound.get("block.slime_block.place");
  85. sound_eating = sound.get("entity.generic.eat");
  86. music_chirp = sound.get("music_disc.chirp");
  87. Sound_Pitch_List = list.new();
  88. for(a = -12; a <= 12; a++){
  89. list.add(Sound_Pitch_List, math.pow(2, -a / 12));
  90. }
  91. gambler_inv = inv.new("020202020");
  92. gambler_inv_id = inv.getId(gambler_inv);
  93. inv.setItem(gambler_inv, 0, read.item("km:coin_copper", 1, "§f1 snuvi"));
  94. inv.setItem(gambler_inv, 1, read.item("km:coin_silver", 1, "§f64 snuvis"));
  95. inv.setItem(gambler_inv, 2, read.item("km:coin_gold", 1, "§f4096 snuvis"));
  96. inv.setItem(gambler_inv, 3, read.item("minecraft:netherite_block", 1, "§fAll in"));
  97. //bankmenu = inv.new("233302332233302332");
  98. bankmenu = inv.new("233330000233330000000000000233200000233200000");
  99. //bankmenu = inv.new("233330000 233330000 000000000 233200000 233200000");
  100. bankinvid = inv.getId(bankmenu);
  101. coin_gold = read.item("km:coin_gold");
  102. coin_silver = read.item("km:coin_silver");
  103. coin_copper = read.item("km:coin_copper");
  104. coin_silver64 = read.item("km:coin_silver", 64);
  105. coin_copper64 = read.item("km:coin_copper", 64);
  106. arrow_left = read.item("km:arrow_left", 1, "§fchange to");
  107. arrow_right = read.item("km:arrow_right", 1, "§fchange to");
  108. inv.setItem(bankmenu, 0, read.item("km:plus_green", 1, "§fDeposit..."));
  109. inv.setItem(bankmenu, 1, read.item("km:coin_copper", 1, "§f1 snuvi"));
  110. inv.setItem(bankmenu, 2, read.item("km:coin_silver", 1, "§f64 snuvis"));
  111. inv.setItem(bankmenu, 3, read.item("km:coin_gold", 1, "§f4096 snuvis"));
  112. inv.setItem(bankmenu, 4, read.item("minecraft:netherite_block", 1, "§fAll snuvis"));
  113. inv.setItem(bankmenu, 5, read.item("km:minus_red", 1, "§fWithdraw..."));
  114. inv.setItem(bankmenu, 6, read.item("km:coin_copper", 1, "§f1 snuvi"));
  115. inv.setItem(bankmenu, 7, read.item("km:coin_silver", 1, "§f64 snuvis"));
  116. inv.setItem(bankmenu, 8, read.item("km:coin_gold", 1, "§f4096 snuvis"));
  117. inv.setItem(bankmenu, 9, read.item("minecraft:netherite_block", 1, "§fAll snuvis"));
  118. inv.setItem(bankmenu, 10, read.item("km:coin_copper", 64, "§f64 snuvis"));
  119. inv.setItem(bankmenu, 11, arrow_left);
  120. inv.setItem(bankmenu, 12, arrow_right);
  121. inv.setItem(bankmenu, 13, read.item("km:coin_silver", 1, "§f64 snuvis"));
  122. inv.setItem(bankmenu, 14, read.item("km:coin_silver", 64, "§f4096 snuvis"));
  123. inv.setItem(bankmenu, 15, arrow_left);
  124. inv.setItem(bankmenu, 16, arrow_right);
  125. inv.setItem(bankmenu, 17, read.item("km:coin_gold", 1, "§f4096 snuvis"));
  126. msg("dev", "§bSurvival §rloaded.");
  127. @wait
  128. wait();
  129. if(event == "player_move") {
  130. if(id == moveid_storyspawn) {
  131. player.setBackPosLoc(player, world.getServerSpawn());
  132. player.teleport(player, world.getStorySpawn(), false);
  133. goto("wait");
  134. }
  135. if(id == moveid_gamesspawn) {
  136. player.setBackPosLoc(player, world.getServerSpawn());
  137. player.teleport(player, world.getGamesSpawn(), false);
  138. goto("wait");
  139. }
  140. if(set.contains(afk_loop_ids, id)) {
  141. player_uuid = player.getUuid(player);
  142. now_time = time.getMillis();
  143. time = map.getOrDefault(afk_loop_map, player_uuid, 0);
  144. if(now_time - time > 9000) { //9 Sekunden
  145. map.add(afk_loop_map, player_uuid, now_time);
  146. money.addBoost(player, 1);
  147. }
  148. goto("wait");
  149. }
  150. goto("wait");
  151. }
  152. //Wenn Event aus Survival-Welten, dann wird er verarbeitet
  153. if(event == "living_death" || event == "living_pre_hurt") {
  154. loc = entity.getLocation(living_entity);
  155. } elseif(event == "ender_teleport") {
  156. loc = location;
  157. } elseif(event == "pre_explosion") {
  158. loc = location;
  159. } elseif(event == "mob_griefing") {
  160. if(entity == null) {
  161. goto("wait");
  162. }
  163. loc = entity.getLocation(entity);
  164. } else {
  165. loc = entity.getLocation(player);
  166. }
  167. world_name = world.getName(loc.getWorld(loc));
  168. if(world.isSurvName(world_name)) {
  169. ignoreGoto(event);
  170. }
  171. goto("wait");
  172. @ender_teleport
  173. if(!isPlayer(living_entity)) {
  174. goto("wait");
  175. }
  176. player = living_entity;
  177. if(player.isOnAdventure(player)) {
  178. cancel = true;
  179. msg.prefix(player, "§5Adventure", "Using Enderpearls during adventures? Nope!");
  180. goto("wait");
  181. }
  182. //Verhindert während eines (Abenteuer-)Teleports, die Benutzung der Enderperle
  183. player_uuid = player.getUuid(player);
  184. if(set.contains(tp_set, player_uuid)) {
  185. cancel = true;
  186. msg.prefix(player, "§5Adventure", "Using Enderpearls during adventures? Nope!");
  187. }
  188. goto("wait");
  189. @item_air_click
  190. player_loc = entity.getLocation(player);
  191. world = loc.getWorld(player_loc);
  192. if(world.getName(world) != "overworld") {
  193. goto("wait");
  194. }
  195. item = living.getEquip(player, "hand");
  196. if(item.getType(item) != "minecraft:clock") {
  197. goto("wait");
  198. }
  199. time = world.getTime(world);
  200. time_h = math.roundDown(time/1000) + 6;
  201. while(time_h >= 24) {
  202. time_h -= 24;
  203. }
  204. //m min = t ticks * 60m / 1000 ticks
  205. time_m = time%1000;
  206. time_m = math.roundDown(time_m * 60 / 1000);
  207. if(time_m < 10) {
  208. time_m = concat("0", text.number(time_m));
  209. } else {
  210. time_m = text.number(time_m);
  211. }
  212. msg.prefix(player, "§eClock", concat(text.number(time_h), ":", time_m));
  213. goto("wait");
  214. @mob_griefing
  215. if(entity.getType(entity) == "enderman") {
  216. cancel = true;
  217. }
  218. goto("wait");
  219. @pre_explosion
  220. plot_list = plot.get(location);
  221. for(i = 0; i < list.getSize(plot_list); i++) {
  222. plot = list.getIndex(plot_list, i);
  223. if(plot.isExplosive(plot)) {
  224. cancel = false;
  225. }
  226. }
  227. //Kein Grundstück existiert
  228. if(i == 0) {
  229. cancel = false;
  230. }
  231. goto("wait");
  232. @living_pre_hurt
  233. if(!isPlayer(living_entity)) {
  234. damager = player.getFromDamageSource(damage_source);
  235. if(!isPlayer(damager)) {
  236. goto("wait");
  237. }
  238. pet_type = entity.getType(living_entity);
  239. if(pet_type == "wolf" || pet_type == "cat" || pet_type == "parrot" || pet_type == "horse") {
  240. if(pet.isTamed(living_entity)) {
  241. owner_uuid = pet.getOwner(living_entity);
  242. if(owner_uuid == player.getUuid(damager)) {
  243. if(player.getNoPetDamage(damager)) {
  244. cancel = true;
  245. }
  246. }
  247. }
  248. }
  249. goto("wait");
  250. }
  251. player = living_entity;
  252. damager = player.getFromDamageSource(damage_source);
  253. if(!isPlayer(damager)) {
  254. player_loc = entity.getLocation(player);
  255. if(loc.hasPlotId(player_loc, 128) && damage.getType(damage_source) == "fall") {
  256. cancel = true;
  257. }
  258. goto("wait");
  259. }
  260. if(player == damager) {
  261. goto("wait");
  262. }
  263. if(!hasPvpOn(damager)) {
  264. cancel = true;
  265. msg.prefix(damager, "§5PvP", "You have PvP disabled.");
  266. goto("wait");
  267. }
  268. if(!hasPvpOn(player)) {
  269. cancel = true;
  270. msg.prefix(damager, "§5PvP", concat(player.getName(player), " has PvP disabled."));
  271. goto("wait");
  272. }
  273. goto("wait");
  274. @entity_click
  275. if(hand == "OFF_HAND") {
  276. goto("wait");
  277. }
  278. if(entity.getType(entity) == "human") {
  279. entity_name = entity.getName(entity);
  280. if(entity_name == "Administrator\n§cmarvinius") {
  281. item = living.getHand(player);
  282. item_name = item.getName(item);
  283. if(removeFormat(item_name) == "Beer") {
  284. sound.spawnForPlayer(player, $sound_drink_milk, $sound_category_master, 1, 1);
  285. msg.prefix(player, "§cmarvinius", "Prost!");
  286. }
  287. else{
  288. msg.prefix(player, "§cmarvinius", "Ich mag Gösser.");
  289. }
  290. goto("wait");
  291. }
  292. if(entity_name == "Owner\n§4kajetanjohannes") {
  293. item = living.getHand(player);
  294. item_type = item.getType(item);
  295. sound.spawnForPlayer(player, $sound_slime_place, $sound_category_master, 1, 1);
  296. if(item_type == "minecraft:redstone") {
  297. rand_number = math.roundup(math.random(0,3));
  298. if(rand_number == 0){
  299. temp_message = "WUSIWUSIWUSIWUSIWUSIWUSIWUSIWUSI";
  300. }
  301. if(rand_number == 1){
  302. temp_message = "Wusi!";
  303. }
  304. if(rand_number == 2){
  305. temp_message = "Wusi?";
  306. }
  307. if(rand_number == 3){
  308. temp_message = "Wusi.";
  309. }
  310. msg.prefix(player, "§4kajetanjohannes", temp_message);
  311. goto("wait");
  312. }
  313. if(item_type == "minecraft:ice" || item_type == "minecraft:blue_ice" || item_type == "minecraft:packed_ice"){
  314. msg.prefix(player, "§4kajetanjohannes", "§bDas sieht nach mir aus.");
  315. }else{
  316. msg.prefix(player, "§4kajetanjohannes", "wusi");
  317. }
  318. goto("wait");
  319. }
  320. if(entity_name == "Supporter\n§bImKillerKatze") {
  321. rand_number = math.roundup(math.random(0,25));
  322. if(rand_number > 13){
  323. sound.spawnForPlayer(player, $sound_cat, $sound_category_master, 1, 1);
  324. msg.prefix(player, "§bImKillerKatze", "Miau");
  325. goto("wait");
  326. }
  327. if(rand_number < 12){
  328. sound.spawnForPlayer(player, $sound_stray_cat, $sound_category_master, 1, 1);
  329. msg.prefix(player, "§bImKillerKatze", "Miau!");
  330. goto("wait");
  331. }
  332. else{
  333. sound.spawnForPlayer(player, $sound_purreow, $sound_category_master, 1, 1);
  334. msg.prefix(player, "§bImKillerKatze", "Schnurrr!");
  335. goto("wait");
  336. }
  337. }
  338. if(entity_name == "Administrator\n§cwertibaldi") {
  339. msg.prefix(player, "§cwertibaldi", "Kann grad nicht, bin im Einsatz für den Katastrophenschutz.");
  340. goto("wait");
  341. }
  342. if(entity_name == "Administrator\n§cMentorMentos") {
  343. item = living.getHand(player);
  344. item_name = item.getName(item);
  345. if(removeFormat(item_name) == "Beer") {
  346. msg.prefix(player, "§cMentorMentos", "Folg mir auf Twitch! ");
  347. msg(player, text.link("Klick mich an :D","https://www.twitch.tv/Mentor_Mentos"));
  348. }
  349. else{
  350. msg.prefix(player, "§cMentorMentos", "Ich mag Kölsch.");
  351. }
  352. goto("wait");
  353. }
  354. if(entity_name == "Moderator\n§9SirTerence7") {
  355. rand_number = math.roundup(math.random(0,7));
  356. if(rand_number < 4){
  357. msg.prefix(player, "§9SirTerence7", "Mathe bla... bla... bla...");
  358. }
  359. if(rand_number == 4){
  360. msg.prefix(player, "§9SirTerence7", "Fraktale bla... bla... bla...");
  361. }
  362. if(rand_number == 5){
  363. msg.prefix(player, "§9SirTerence7", "Höhere Dimensionen bla... bla... bla...");
  364. }
  365. if(rand_number == 6){
  366. msg.prefix(player, "§9SirTerence7", "*redet mit Händen weiter*");
  367. }
  368. if(rand_number == 7){
  369. msg.prefix(player, "§9SirTerence7", "*wechselt voller Faszination zwischen scheinbar zusammenhangslosen Themen hin und her*");
  370. }
  371. rand_number = math.roundup(math.random(0,500));
  372. if(rand_number <= 2){
  373. sound.spawnForPlayer(player, $music_chirp, $sound_category_master, 1, 1);
  374. }else{
  375. rand_pitch = math.roundup(math.random(4, list.getSize(Sound_Pitch_List)-5));
  376. if(rand_number < 200){
  377. pitch1 = list.getIndex(Sound_Pitch_List, rand_pitch-4);
  378. pitch2 = list.getIndex(Sound_Pitch_List, rand_pitch);
  379. pitch3 = list.getIndex(Sound_Pitch_List, rand_pitch+3);
  380. }else{
  381. if(rand_number < 300){
  382. pitch1 = list.getIndex(Sound_Pitch_List, rand_pitch-4);
  383. pitch1_2 = list.getIndex(Sound_Pitch_List, rand_pitch-2);
  384. pitch2 = list.getIndex(Sound_Pitch_List, rand_pitch);
  385. pitch3_2 = list.getIndex(Sound_Pitch_List, rand_pitch+1);
  386. pitch3 = list.getIndex(Sound_Pitch_List, rand_pitch+3);
  387. sound.spawnForPlayer(player, $sound_harp, $sound_category_master, 0.5, pitch1_2);
  388. sound.spawnForPlayer(player, $sound_harp, $sound_category_master, 0.5, pitch3_2);
  389. sound.spawnForPlayer(player, $sound_flute, $sound_category_master, 0.75, pitch1_2);
  390. sound.spawnForPlayer(player, $sound_flute, $sound_category_master, 0.75, pitch3_2);
  391. }else{
  392. pitch1 = list.getIndex(Sound_Pitch_List, rand_pitch-3);
  393. pitch2 = list.getIndex(Sound_Pitch_List, rand_pitch);
  394. pitch3 = list.getIndex(Sound_Pitch_List, rand_pitch+4);
  395. }
  396. }
  397. sound.spawnForPlayer(player, $sound_harp, $sound_category_master, 0.8, pitch1);
  398. sound.spawnForPlayer(player, $sound_harp, $sound_category_master, 0.9, pitch2);
  399. sound.spawnForPlayer(player, $sound_harp, $sound_category_master, 0.8, pitch2);
  400. sound.spawnForPlayer(player, $sound_flute, $sound_category_master, 0.9, pitch1);
  401. sound.spawnForPlayer(player, $sound_flute, $sound_category_master, 1, pitch2);
  402. sound.spawnForPlayer(player, $sound_flute, $sound_category_master, 0.9, pitch3);
  403. }
  404. goto("wait");
  405. }
  406. if(entity_name == "Moderator\n§9Mareeeen") {
  407. rand_number = math.roundup(math.random(0,5));
  408. if(rand_number > 1){
  409. msg.prefix(player, "§9Mareeeen", "Wo ist die Schokolade versteckt!?");
  410. }else{
  411. msg.prefix(player, "§9Mareeeen", "Ich esse deine Schokolade!");
  412. sound.spawnForPlayer(player, $sound_eating, $sound_category_master, 1, 1);
  413. }
  414. goto("wait");
  415. }
  416. if(entity_name == "Info-Point") {
  417. msg(player, getSpacer());
  418. msg(player, text.click("§r [§cclick§r] [§eSurvival§r]", "/infopoint1"));
  419. msg(player, text.click("§r [§cclick§r] [§eAdventure§r]", "/infopoint2"));
  420. msg(player, text.click("§r [§cclick§r] [§ePlots§r]", "/infopoint3"));
  421. msg(player, text.click("§r [§cclick§r] [§eClans§r]", "/infopoint4"));
  422. msg(player, text.click("§r [§cclick§r] [§eCities§r]", "/infopoint5"));
  423. msg(player, text.click("§r [§cclick§r] [§eShops§r]", "/infopoint6"));
  424. msg(player, text.click("§r [§cclick§r] [§eMinigames§r]", "/infopoint7"), " ", text.click("§f[§bTeleport§f]", "/games"));
  425. msg(player, text.click("§r [§cclick§r] [§eQuests§r]", "/infopoint8"), " ", text.click("§f[§bTeleport§f]", "/story"));
  426. msg(player, text.click("§r [§cclick§r] [§eCreative§r]", "/infopoint12"), " ", text.click("§f[§bTeleport§f]", "/creative"));
  427. msg(player, text.click("§r [§cclick§r] [§eRanking§r]", "/infopoint9"), " ", text.link("§f[§bRanks§f]", "https://minecraft.hammerle.me/?site=ranks"));
  428. msg(player, text.click("§r [§cclick§r] [§eRules§r]", "/infopoint10"), " ", text.link("§f[§bFake Rules§f]", "https://minecraft.hammerle.me/?site=rules"));
  429. msg(player, text.click("§r [§cclick§r] [§eNote§r]", "/infopoint11"));
  430. goto("wait");
  431. }
  432. if(entity_name == "Banker") {
  433. inv.open(bankmenu, player, "Banker");
  434. goto("wait");
  435. }
  436. if(entity_name == "Adventure") {
  437. if(!player.isOnAdventure(player)) {
  438. msg.prefix(player, "§5Adventure", "You aren't on an adventure. Click the chest in the teleporter to start an adventure.");
  439. goto("wait");
  440. }
  441. player.setAdventure(player, false);
  442. adventures = player.getAdventureAmounts(player);
  443. if(adventures == null) {
  444. adventures = 0;
  445. }
  446. player.setAdventureAmounts(player, ++adventures);
  447. msg.prefix(player, "§5Adventure", "Congratulations, you finished your adventure, here ist your reward!");
  448. if(adventures == 10) {
  449. offerRank(player, "rank.pioneer");
  450. } elseif(adventures == 5) {
  451. offerRank(player, "rank.explorer");
  452. } elseif(adventures == 1) {
  453. offerRank(player, "rank.adventurer");
  454. }
  455. removeAdventureDisplay(player);
  456. player.safeGiveItem(player, item.getAmber());
  457. money.addBoost(player, 4096);
  458. goto("wait");
  459. }
  460. }
  461. goto("wait");
  462. @player_login
  463. if(player.isOnAdventure(player)) {
  464. addAdventureDisplay(player, adventure_aim_loc);
  465. }
  466. goto("wait");
  467. @container_click
  468. //Verhindert während eines (Abenteuer-)Teleports, die Benutzung des Spielerinventars (inkl. Crafting-Bereich!)
  469. player_uuid = player.getUuid(player);
  470. if(set.contains(tp_set, player_uuid)) {
  471. cancel = true;
  472. }
  473. goto("wait");
  474. @inv_click
  475. if(inv_id == bankinvid) { //Bankmenü
  476. factor = 1;
  477. if(click_type == "QUICK_MOVE") {
  478. factor = 8;
  479. }
  480. gold_inv = player.getItemAmount(player, false, coin_gold);
  481. silver_inv = player.getItemAmount(player, false, coin_silver);
  482. copper_inv = player.getItemAmount(player, false, coin_copper);
  483. //Wechseln
  484. if(inv_slot == 11 || inv_slot == 12 || inv_slot == 15 || inv_slot == 16) {
  485. if(inv_slot == 11) {
  486. //1 Silbermünze --> 64 Kupfermünzen
  487. from_item = coin_silver;
  488. to_item = coin_copper64;
  489. message = "Not enough silvercoins in inventory.";
  490. item_type = "km:coin_copper";
  491. needed_inv_coins = silver_inv;
  492. }
  493. elseif(inv_slot == 12) {
  494. //64 Kupfermünzen --> 1 Silbermünze
  495. from_item = coin_copper64;
  496. to_item = coin_silver;
  497. message = "Not enough coppercoins in inventory.";
  498. item_type = "km:coin_silver";
  499. needed_inv_coins = copper_inv;
  500. }
  501. elseif(inv_slot == 15) {
  502. //1 Goldmünze --> 64 Silbermünzen
  503. from_item = coin_gold;
  504. to_item = coin_silver64;
  505. message = "Not enough goldcoins in inventory.";
  506. item_type = "km:coin_silver";
  507. needed_inv_coins = gold_inv;
  508. }
  509. elseif(inv_slot == 16) {
  510. //64 Silbermünzen --> 1 Goldmünze
  511. from_item = coin_silver64;
  512. to_item = coin_gold;
  513. message = "Not enough silvercoins in inventory.";
  514. item_type = "km:coin_gold";
  515. needed_inv_coins = silver_inv;
  516. }
  517. item_1 = item.clone(from_item);
  518. item.setAmount(item_1, item.getAmount(item_1) * factor);
  519. item_2 = item.clone(to_item);
  520. item.setAmount(item_2, item.getAmount(item_2) * factor);
  521. amount1 = item.getAmount(item_1);
  522. amount2 = item.getAmount(item_2);
  523. if(needed_inv_coins * factor < amount1 * factor) {
  524. msg.prefix(player, prefix_money, message);
  525. goto("wait");
  526. }
  527. player.removeItemNbt(player, item_1);
  528. notgiven = player.giveItem(player, item_2);
  529. if(item.getType(notgiven) != "minecraft:air") {
  530. amount = item.getAmount(notgiven);
  531. player.removeItemNbt(player, read.item(item_type, amount2 - amount));
  532. player.giveItem(player, item_1);
  533. msg.prefix(player, prefix_money, "Not enough space in inventory.");
  534. goto("wait");
  535. }
  536. inv.update(player);
  537. msg.prefix(player, prefix_money, "Exchange succesfull.");
  538. goto("wait");
  539. }
  540. //Kontobewegungen
  541. if(inv_slot == 1 || inv_slot == 6) {
  542. betrag = 1 * factor;
  543. coin_inv = copper_inv;
  544. }
  545. elseif(inv_slot == 2 || inv_slot == 7) {
  546. betrag = 64 * factor;
  547. coin_inv = silver_inv;
  548. }
  549. elseif(inv_slot == 3 || inv_slot == 8) {
  550. betrag = 4096 * factor;
  551. coin_inv = gold_inv;
  552. }
  553. elseif(inv_slot == 4 || inv_slot == 9) {
  554. if(inv_slot == 4) {
  555. betrag = copper_inv + silver_inv * 64 + gold_inv * 4096;
  556. coin_inv = 8;
  557. } elseif(inv_slot == 9) {
  558. betrag = getMoney(player);
  559. coin_inv = 8;
  560. }
  561. }
  562. //Einzahlen
  563. if(inv_slot > 0 && inv_slot < 5) {
  564. if(coin_inv < 1 * factor) {
  565. msg.prefix(player, prefix_money, "Coins not in inventory.");
  566. goto("wait");
  567. }
  568. if(betrag == 0) {
  569. msg.prefix(player, prefix_money, "No coins in your inventory.");
  570. goto("wait");
  571. }
  572. addMoney(player, betrag);
  573. if(inv_slot == 4) {
  574. player.removeItemNbt(player, read.item("km:coin_gold", gold_inv));
  575. player.removeItemNbt(player, read.item("km:coin_silver", silver_inv));
  576. player.removeItemNbt(player, read.item("km:coin_copper", copper_inv));
  577. } else {
  578. remove_item = item.clone(inv.getItem(bankmenu, inv_slot));
  579. item.setAmount(remove_item, item.getAmount(remove_item) * factor);
  580. player.removeItemNbt(player, remove_item);
  581. }
  582. inv.update(player);
  583. goto("wait");
  584. }
  585. //Auszahlen
  586. if(inv_slot > 5 && inv_slot < 10) {
  587. if(!hasEnoughMoney(player, betrag)) {
  588. msg.prefix(player, prefix_money, "Not enough snuvis on your account.");
  589. } else {
  590. subMoney(player, betrag);
  591. if(inv_slot == 9) {
  592. gold_amount = math.roundDown(betrag / 4096);
  593. betrag %= 4096;
  594. silver_amount = math.roundDown(betrag / 64);
  595. copper_amount = math.roundDown(betrag % 64);
  596. coin_item = read.item("km:coin_gold", gold_amount);
  597. player.safeGiveItem(player, coin_item);
  598. coin_item = read.item("km:coin_silver", silver_amount);
  599. player.safeGiveItem(player, coin_item);
  600. coin_item = read.item("km:coin_copper", copper_amount);
  601. player.safeGiveItem(player, coin_item);
  602. } else {
  603. item = inv.getItem(bankmenu, inv_slot);
  604. new_item = read.item(item.getType(item), item.getAmount(item) * factor);
  605. player.safeGiveItem(player, new_item);
  606. }
  607. inv.update(player);
  608. }
  609. goto("wait");
  610. }
  611. goto("wait");
  612. }
  613. if(inv_id == gambler_inv_id) {
  614. if(inv_slot == 0) {
  615. amount = 1;
  616. } elseif(inv_slot == 1) {
  617. amount = 64;
  618. } elseif(inv_slot == 2) {
  619. amount = 4096;
  620. } elseif(inv_slot == 3) {
  621. amount = getMoney(player);
  622. if(amount == 0) {
  623. msg.prefix(player, prefix_money, "You need at least 1 snuvi on your account.");
  624. goto("wait");
  625. }
  626. }
  627. if(!hasEnoughMoney(player, amount)) {
  628. msg.prefix(player, prefix_money, "Not enough snuvis on your account.");
  629. goto("wait");
  630. }
  631. win = math.random(1, 2);
  632. if(win == 1) {
  633. addMoney(player, amount);
  634. temp = " won ";
  635. } else {
  636. subMoney(player, amount);
  637. temp = " lost ";
  638. }
  639. if(amount == 1) {
  640. message = concat(player.getName(player), temp, text.number(amount), " snuvi.");
  641. } else {
  642. message = concat(player.getName(player), temp, text.number(amount), " snuvis.");
  643. }
  644. if(amount < 64) {
  645. msg.prefix(player, "§2Gambler", message);
  646. } elseif(amount >= 131072) {
  647. msg.online("§2Gambler", message);
  648. } else {
  649. msg.radius("§2Gambler", message, entity.getLocation(player), 10);
  650. }
  651. goto("wait");
  652. }
  653. goto("wait");
  654. @projectile_hit
  655. if(!isPlayer(shooter)) {
  656. goto("wait");
  657. }
  658. player = shooter;
  659. duration = data.getTimer(player, "skill.fire_arrow");
  660. if(duration > 0) {
  661. if(loc_hit == null) {
  662. goto("wait");
  663. }
  664. flame = enchantment.getLevel(ench_flame, living.getHand(player));
  665. if(flame <= 0) {
  666. goto("wait");
  667. }
  668. if(!plot.check(loc_hit, player, 3, true) && !perm.has(player, "plot.bypass")) {
  669. msg.prefix(player, prefix_skill, "You have no permissions on this plot.");
  670. goto("wait");
  671. }
  672. ent_loc = entity.getLocation(projectile);
  673. if(block.isAir(ent_loc)){
  674. block.set(ent_loc, "minecraft:fire");
  675. }
  676. fire_ring(ent_loc, "minecraft:fire", 0);
  677. }
  678. goto("wait");
  679. function fire_ring(location, block_string, radius){
  680. loc_x = loc.getX(location);
  681. loc_y = loc.getY(location);
  682. loc_z = loc.getZ(location);
  683. for(a = -radius; a < radius + 1; a++){
  684. loc.setX(location, loc_x + a);
  685. for(b = -radius; b < radius + 1; b++){
  686. loc.setY(location, loc_y + b);
  687. for(c = -radius; c < radius + 1; c++){
  688. loc.setZ(location, loc_z + c);
  689. if(block.isAir(location)){
  690. block.set(location, block_string);
  691. }
  692. }
  693. }
  694. }
  695. }
  696. @block_break
  697. duration = data.getTimer(player, "block_down");
  698. if(duration > 0) {
  699. do = true;
  700. loc = loc.mod(block_loc, 0, -1, 0);
  701. b_type = block.getType(loc);
  702. if(b_type == "minecraft:bedrock" || b_type == "minecraft:end_portal_frame") {
  703. do = false;
  704. }
  705. if(!plot.check(loc, player, 2, true)) {
  706. do = false;
  707. }
  708. if(do) {
  709. block.break(loc, player);
  710. }
  711. }
  712. duration = data.getTimer(player, "block_up");
  713. if(duration > 0) {
  714. do = true;
  715. loc = loc.mod(block_loc, 0, 1, 0);
  716. b_type = block.getType(loc);
  717. if(b_type == "minecraft:bedrock" || b_type == "minecraft:end_portal_frame") {
  718. do = false;
  719. }
  720. if(!plot.check(loc, player, 2, true)) {
  721. do = false;
  722. }
  723. if(do) {
  724. block.break(loc, player);
  725. }
  726. }
  727. if(block_type == "minecraft:cobweb") {
  728. if(cancel) {
  729. goto("wait");
  730. }
  731. hand_item = living.getHand(player);
  732. if(!item.hasTag(sword_tag, hand_item)) {
  733. goto("wait");
  734. }
  735. amount = skill.getAmount(player, "skill.cobweb_miner");
  736. if(amount <= 0) {
  737. goto("wait");
  738. }
  739. if(!skill.isActivated(player, "skill.cobweb_miner")) {
  740. goto("wait");
  741. }
  742. location = loc.mod(block_loc, 0, 0, 0);
  743. cobweb_X = loc.getX(location);
  744. cobweb_Y = loc.getY(location);
  745. cobweb_Z = loc.getZ(location);
  746. cobweb_radius = 1;
  747. unbreaking_level = enchantment.getLevel(ench_unbreaking, hand_item);
  748. for(a = -cobweb_radius; a < cobweb_radius + 1; a++) {
  749. loc.setX(location, cobweb_X + a);
  750. for(b = -cobweb_radius; b < cobweb_radius + 1; b++) {
  751. loc.setY(location, cobweb_Y + b);
  752. for(c = -cobweb_radius; c < cobweb_radius + 1; c++) {
  753. loc.setZ(location, cobweb_Z + c);
  754. if(math.abs(a) + math.abs(b) + math.abs(c) + math.random(0, 2) < cobweb_radius + 2) {
  755. shear_cobweb(location, block_type, player, unbreaking_level);
  756. }
  757. }
  758. }
  759. }
  760. goto("wait");
  761. }
  762. if(block.hasTag(leaves_tag, block)) {
  763. if(cancel) {
  764. goto("wait");
  765. }
  766. hand_item = living.getHand(player);
  767. if(item.getType(hand_item) != "minecraft:shears") {
  768. goto("wait");
  769. }
  770. if(block.property.getValue(block_loc, prop_persistent)){
  771. goto("wait");
  772. }
  773. amount = skill.getAmount(player, "skill.better_shears");
  774. if(amount <= 0) {
  775. goto("wait");
  776. }
  777. if(!skill.isActivated(player, "skill.better_shears")) {
  778. goto("wait");
  779. }
  780. location = loc.mod(block_loc, 0, 0, 0);
  781. shears_X = loc.getX(location);
  782. shears_Y = loc.getY(location);
  783. shears_Z = loc.getZ(location);
  784. unbreaking_level = enchantment.getLevel(ench_unbreaking, hand_item);
  785. radius = enchantment.getLevel(ench_sharpness, hand_item);
  786. if(radius > 0) {
  787. cancel = true;
  788. }
  789. orig_item = block.toStack(location);
  790. for(a = -radius; a < radius + 1; a++){
  791. loc.setX(location, shears_X + a);
  792. for(b = -radius; b < radius + 1; b++){
  793. loc.setY(location, shears_Y + b);
  794. for(c = -radius; c < radius + 1; c++){
  795. loc.setZ(location, shears_Z + c);
  796. if(math.abs(a) + math.abs(b) + math.abs(c) + math.random(0, 2) < radius + 2) {
  797. shear_leave(location, block_type, orig_item, player, unbreaking_level);
  798. }
  799. }
  800. }
  801. }
  802. goto("wait");
  803. }
  804. goto("wait");
  805. function shear_leave(block_loc, original_block_type, original_item, player, unbreaking_level){
  806. if(block.getType(block_loc) != original_block_type) {
  807. return;
  808. }
  809. if(block.property.getValue(block_loc, $prop_persistent)) {
  810. return;
  811. }
  812. block.set(block_loc, "minecraft:air");
  813. item.drop(block_loc, original_item);
  814. if(player.isSurvival(player)) {
  815. player.damageItem(player, 1);
  816. }
  817. }
  818. function shear_cobweb(block_loc, original_block_type, player, unbreaking_level) {
  819. if(block.getType(block_loc) != original_block_type) {
  820. return;
  821. }
  822. block.break(block_loc, player);
  823. if(math.random(0, 99) < 100 / (unbreaking_level + 1)) {
  824. player.damageItem(player, 1);
  825. }
  826. }
  827. @block_click
  828. if(action == "right" && player.checkHandsForTag(player, dye_tag)) {
  829. if(block.hasTag(sign_tag, block)) {
  830. if(!perm.has(player, "plot.bypass")) {
  831. if(!plot.check(block_loc, player, 3, true)) {
  832. cancel = true;
  833. goto("wait");
  834. }
  835. }
  836. }
  837. }
  838. if(hand == "OFF_HAND") {
  839. goto("wait");
  840. }
  841. if(block_type == "minecraft:chest") {
  842. if(isATpReceiver(block_loc)) {
  843. tp_item = read.item("km:gear", 1, "§rTeleport");
  844. list = list.new();
  845. list.add(list, world.getName(loc.getWorld(block_loc)));
  846. list.add(list, text.number(loc.getX(block_loc)));
  847. list.add(list, text.number(loc.getY(block_loc)));
  848. list.add(list, text.number(loc.getZ(block_loc)));
  849. item.setLore(tp_item, list);
  850. player.giveItem(player, tp_item);
  851. goto("wait");
  852. }
  853. if(isATpTransmitter(block_loc)) {
  854. player_uuid = player.getUuid(player);
  855. clicked = map.getOrDefault(tp_map, player_uuid, 0);
  856. now_time = time.getMillis();
  857. if(now_time - clicked < 5000) {
  858. msg.prefix(player, "§5Adventure", "Wait 5 seconds!");
  859. goto("wait");
  860. }
  861. map.add(tp_map, player_uuid, now_time);
  862. //Abenteuer-Teleport
  863. if(block_loc == adventure_chest_loc) {
  864. if(!player.isOnAdventure(player)) {
  865. if(!player.hasClearInventory(player)) {
  866. msg.prefix(player, "§5Adventure", "Your inventory needs to be empty!");
  867. goto("wait");
  868. }
  869. alpha = math.random(0, 360);
  870. alpha *= math.pi() / 180;
  871. x = math.round(math.sin(alpha) * 10000) + 0.5;
  872. z = math.round(math.cos(alpha) * 10000) + 0.5;
  873. y = 255;
  874. tp_loc = loc.new(world.getOverWorld(), x, y, z);
  875. while(block.isAir(tp_loc)) {
  876. loc.setY(tp_loc, y);
  877. y--;
  878. }
  879. tp_loc = loc.mod(tp_loc, 0, 1, 0);
  880. setTpWallX(block_loc, "minecraft:lime_stained_glass");
  881. sound.spawn(block_loc, piston_sound, sound_category_ambient);
  882. player_uuid = player.getUuid(player);
  883. array = array.new(4);
  884. array[0] = player_uuid;
  885. array[1] = block_loc;
  886. array[2] = tp_loc;
  887. array[3] = true;
  888. list.add(tp_list, array);
  889. set.add(tp_set, player_uuid);
  890. sgoto(30, "tp_ticker");
  891. }
  892. goto("wait");
  893. }
  894. //Normaler Teleport
  895. temp = false;
  896. inv = block.getInv(block_loc);
  897. inv_size = inv.getSize(inv);
  898. for(i = 0; i < inv_size; i++) {
  899. item = inv.getItem(inv, i);
  900. if(item.getType(item) == "km:gear") {
  901. if(item.getName(item) == "§rTeleport") {
  902. temp = true;
  903. break;
  904. }
  905. }
  906. }
  907. if(!temp) {
  908. msg.prefix(player, "§5Adventure", "No receiver found!");
  909. goto("wait");
  910. }
  911. lore_list = item.getLore(item);
  912. if(list.getSize(lore_list) != 4) {
  913. msg.prefix(player, "§5Adventure", "No receiver found!");
  914. goto("wait");
  915. }
  916. world = world.get(list.getIndex(lore_list, 0));
  917. x = read.number(list.getIndex(lore_list, 1));
  918. y = read.number(list.getIndex(lore_list, 2));
  919. z = read.number(list.getIndex(lore_list, 3));
  920. tp_loc = loc.new(world, x, y, z);
  921. if(!isATpReceiver(tp_loc)) {
  922. msg.prefix(player, "§5Adventure", "No receiver found!");
  923. goto("wait");
  924. }
  925. loc.add(tp_loc, 0.5, -3, 0.5);
  926. setTpWallX(block_loc, "minecraft:lime_stained_glass");
  927. sound.spawn(block_loc, piston_sound, sound_category_ambient);
  928. array = array.new(4);
  929. array[0] = player.getUuid(player);
  930. array[1] = block_loc;
  931. array[2] = tp_loc;
  932. array[3] = false;
  933. list.add(tp_list, array);
  934. sgoto(30, "tp_ticker");
  935. }
  936. goto("wait");
  937. }
  938. if(block_loc == gambler_loc) {
  939. cancel = true;
  940. inv.open(gambler_inv, player, "Choose your amount to bet with");
  941. goto("wait");
  942. }
  943. if(block_loc == lottery_loc_1 || block_loc == lottery_loc_2) {
  944. if(!hasEnoughMoney(player, 1)) {
  945. msg.prefix(player, prefix_money, "Not enough snuvis on your account.");
  946. goto("wait");
  947. }
  948. subMoney(player, 1);
  949. amount = lottery.add(block_loc, 1);
  950. if(amount == null) {
  951. goto("wait");
  952. }
  953. if(block_loc == lottery_loc_1) {
  954. winrate = 1000;
  955. } else {
  956. winrate = 10000;
  957. }
  958. win = math.random(1, winrate);
  959. if(win == 1) {
  960. addMoney(player, amount);
  961. lottery.set(block_loc, 0);
  962. message = concat(player.getName(player), " has won ", text.number(amount), " snuvis.");
  963. msg.radius(prefix_money, message, block_loc, 50);
  964. }
  965. goto("wait");
  966. }
  967. goto("wait");
  968. @living_death
  969. if(isPlayer(living_entity)) {
  970. player = living_entity;
  971. setDeathLoc(player);
  972. loc = entity.getLocation(player);
  973. amount = skill.getAmount(player, "skill.subcu_inv");
  974. if(skill.isActivated(player, "skill.subcu_inv") && amount > 0) {
  975. new_amount = amount - 1;
  976. skill.setAmount(player, "skill.subcu_inv", new_amount);
  977. msg.prefix(player, prefix_skill, concat("Used Subcutaneous Inventory. New amount: ", text.number(new_amount)));
  978. } else {
  979. player.dropInventory(player, loc);
  980. }
  981. killer = player.getFromDamageSource(damage_source);
  982. if(isPlayer(killer)) {
  983. amount = skill.getAmount(player, "skill.head_human");
  984. if(amount >= 1) {
  985. if(perm.has(player, "isTeam")) {
  986. temp = math.random(1, 20);
  987. } else {
  988. temp = math.random(1, 5);
  989. }
  990. if(temp == 1) {
  991. item.drop(loc, player.getHead(player.getUuid(player), player.getName(player)));
  992. }
  993. }
  994. }
  995. goto("wait");
  996. }
  997. killer = player.getFromDamageSource(damage_source);
  998. if(isPlayer(killer)) {
  999. r = math.random(1, 20);
  1000. if(r == 1) {
  1001. amount = skill.getAmount(killer, "skill.head_monster");
  1002. if(amount >= 1) {
  1003. entity_type = entity.getType(living_entity);
  1004. if(entity_type == "creeper") {
  1005. item.drop(loc, read.item("minecraft:creeper_head"));
  1006. goto("wait");
  1007. }
  1008. if(entity_type == "zombie") {
  1009. item.drop(loc, read.item("minecraft:zombie_head"));
  1010. goto("wait");
  1011. }
  1012. if(entity_type == "skeleton") {
  1013. item.drop(loc, read.item("minecraft:skeleton_skull"));
  1014. goto("wait");
  1015. }
  1016. }
  1017. }
  1018. }
  1019. goto("wait");
  1020. @player_pre_respawn
  1021. if(loc.isInSurvWorld(entity.getLocation(player))) {
  1022. set.add(survival_respawn, player.getUuid(player));
  1023. }
  1024. goto("wait");
  1025. @player_post_respawn
  1026. player_uuid = player.getUuid(player);
  1027. if(set.contains(survival_respawn, player_uuid)) {
  1028. set.remove(survival_respawn, player_uuid);
  1029. if(player.isOnAdventure(player)) {
  1030. tp_loc = player.getAdventureStart(player);
  1031. entity.teleport(player, tp_loc);
  1032. goto("wait");
  1033. }
  1034. amount = skill.getAmount(player, "skill.comeback");
  1035. if(skill.isActivated(player, "skill.comeback") && amount > 0) {
  1036. new_amount = amount - 1;
  1037. skill.setAmount(player, "skill.comeback", new_amount);
  1038. msg.prefix(player, prefix_skill, concat("Used Comeback. New amount: ", text.number(new_amount)));
  1039. entity.teleport(player, getDeathLoc(player));
  1040. goto("wait");
  1041. }
  1042. entity.teleport(player, world.getServerSpawn());
  1043. }
  1044. goto("wait");
  1045. @tp_ticker
  1046. array = list.getIndex(tp_list, 0);
  1047. list.removeIndex(tp_list, 0);
  1048. block_loc = array[1];
  1049. list.add(tp_list, array);
  1050. setTpWallFull(block_loc, "minecraft:lime_stained_glass");
  1051. sound.spawn(block_loc, piston_sound, sound_category_ambient);
  1052. sgoto(30, "tp_final");
  1053. goto("wait");
  1054. @tp_final
  1055. array = list.getIndex(tp_list, 0);
  1056. list.removeIndex(tp_list, 0);
  1057. player_uuid = array[0];
  1058. block_loc = array[1];
  1059. tp_loc = array[2];
  1060. adventure = array[3];
  1061. set.remove(tp_set, player_uuid);
  1062. sound.spawn(block_loc, piston_sound, sound_category_ambient);
  1063. setTpWallFull(block_loc, "minecraft:air");
  1064. player = player.get(player_uuid);
  1065. if(player == null) {
  1066. goto("wait");
  1067. }
  1068. sound.spawn(tp_loc, adv_tp_sound, sound_category_ambient);
  1069. if(adventure) {
  1070. //Party
  1071. if(player.isInParty(player) && player.isPartyLeader(player)) {
  1072. party_id = player.getPartyId(player);
  1073. party_list = party.getList(party_id);
  1074. iter = list.iterator(party_list);
  1075. while(hasNext(iter)) {
  1076. p = player.get(next(iter));
  1077. p_name = player.getName(p);
  1078. p_loc = entity.getLocation(p);
  1079. if(!loc.isSameWorld(adventure_chest_loc, p_loc)) {
  1080. msg.prefix(player, "§5Party", concat(p_name, "§c is in another world."));
  1081. msg.prefix(p, "§5Party", "§cYou are in another world.");
  1082. continue;
  1083. }
  1084. if(loc.distance(adventure_chest_loc, p_loc) > 5) {
  1085. msg.prefix(player, "§5Party", concat(p_name, "§c is too far away."));
  1086. msg.prefix(p, "§5Party", "§cYou are too far away.");
  1087. continue;
  1088. }
  1089. if(player.hasMinigame(p)) {
  1090. msg.prefix(player, "§5Party", concat(p_name, "§c is in a game."));
  1091. msg.prefix(p, "§5Party", "§cYou are in a game.");
  1092. continue;
  1093. }
  1094. if(player.hasQuest2(p)) {
  1095. msg.prefix(player, "§5Party", concat(p_name, "§c is doing a quest."));
  1096. msg.prefix(p, "§5Party", "§cYou are doing a quest.");
  1097. continue;
  1098. }
  1099. if(player.isOnAdventure(p)) {
  1100. msg.prefix(player, "§5Party", concat(p_name, "§c is already on an adventure."));
  1101. msg.prefix(p, "§5Party", "§cYou are already on an adventure.");
  1102. continue;
  1103. }
  1104. if(player.isAfk(p)) {
  1105. msg.prefix(player, "§5Party", concat(p_name, "§c is afk."));
  1106. msg.prefix(p, "§5Party", "§cYou are afk.");
  1107. continue;
  1108. }
  1109. if(!player.hasClearInventory(p)) {
  1110. msg.prefix(player, "§5Party", concat(p_name, "§c has no clear inventory."));
  1111. msg.prefix(p, "§5Party", "§cYou have no clear inventory.");
  1112. continue;
  1113. }
  1114. player.teleport(p, tp_loc, false);
  1115. player.setAdventure(p, true);
  1116. player.setAdventureStart(p, tp_loc);
  1117. addAdventureDisplay(p, adventure_aim_loc);
  1118. title.reset(p);
  1119. title.setSub(p, "Have fun!");
  1120. title.send(p, "§cAdventure");
  1121. msg.prefix(p, "§5Adventure", "To complete your adventure, go to the survival spawn. You cannot teleport. If you die, you start again!");
  1122. }
  1123. goto("wait");
  1124. }
  1125. if(!player.hasClearInventory(player)) {
  1126. msg.prefix(player, "§5Adventure", "Your inventory needs to be empty!");
  1127. goto("wait");
  1128. }
  1129. player.teleport(player, tp_loc, false);
  1130. player.setAdventure(player, true);
  1131. player.setAdventureStart(player, tp_loc);
  1132. addAdventureDisplay(player, adventure_aim_loc);
  1133. title.reset(player);
  1134. title.setSub(player, "Have fun!");
  1135. title.send(player, "§cAdventure");
  1136. msg.prefix(player, "§5Adventure", "To complete your adventure, go to the survival spawn. You cannot teleport. If you die, you start again!");
  1137. goto("wait");
  1138. }
  1139. player.teleport(player, tp_loc, false);
  1140. goto("wait");
  1141. function lottery.set(location, amount) {
  1142. location = loc.mod(location, 0.5, 0, 0.5);
  1143. list = living.near(location, 0.1);
  1144. text_entity = list.getIndex(list, 0);
  1145. name = entity.getName(text_entity);
  1146. if(!text.startsWith(name, "Snuvis to win: ", 0)) {
  1147. snuvi.debug("Lottery error");
  1148. return;
  1149. }
  1150. entity.setName(text_entity, concat("Snuvis to win: ", text.number(amount)), true);
  1151. }
  1152. function lottery.add(location, amount) {
  1153. location = loc.mod(location, 0.5, 0, 0.5);
  1154. list = living.near(location, 0.1);
  1155. text_entity = list.getIndex(list, 0);
  1156. name = entity.getName(text_entity);
  1157. if(!text.startsWith(name, "Snuvis to win:", 0)) {
  1158. snuvi.debug("Lottery error");
  1159. return null;
  1160. }
  1161. amount = text.convert(text.subString(name, 15, text.length(name))) + 1;
  1162. entity.setName(text_entity, concat("Snuvis to win: ", text.number(amount)), true);
  1163. return amount;
  1164. }
  1165. function setDeathLoc(player) {
  1166. map.add($death_loc_map, player.getUuid(player), entity.getLocation(player));
  1167. }
  1168. function getDeathLoc(player) {
  1169. return map.getOrDefault($death_loc_map, player.getUuid(player), world.getServerSpawn());
  1170. }