survival.txt 40 KB

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