123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308 |
- event.load("entity_click");
- event.load("inv_click");
- event.load("player_pre_respawn");
- event.load("player_post_respawn");
- event.load("player_login");
- event.load("player_move");
- event.load("block_break");
- event.load("block_click");
- event.load("living_death");
- event.load("living_pre_hurt");
- event.load("player_toss");
- event.load("pre_explosion");
- event.load("mob_griefing");
- event.load("item_air_click");
- setScriptVar("skills", list.new());
- skill.add("Keep Inventory", "skill.subcu_inv", "minecraft:chest", "Keeps the inventory on death", 100, false, false, true);
- skill.add("Comeback", "skill.comeback", "km:skill55", "Respawn at your death location", 100, false, false, true);
- 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);
- 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);
- skill.add("Fly 10min", "skill.fly10min", "minecraft:elytra", "You can fly for 10 minutes", 500, false, true, false);
- skill.add("Grow", "skill.grow", "minecraft:farmland", "Grow seeds in radius 5", 25, false, true, false);
- skill.add("Haste", "skill.haste", "minecraft:iron_pickaxe", "Haste for 2 minutes", 25, false, true, false);
- skill.add("Speed", "skill.speed", "minecraft:iron_boots", "Speed for 2 minutes", 25, false, true, false);
- skill.add("Jump Boost", "skill.jump_boost", "minecraft:rabbit_foot", "JumpBoost Lvl.2 for 2 minutes", 25, false, true, false);
- skill.add("Dolphin", "skill.dolphin", "minecraft:fire_coral", "Swim like a dolphin for a minute", 25, false, true, false);
- skill.add("Block Up", "skill.block_up", "minecraft:diamond_pickaxe", "Break a block and the block above for a minute", 25, false, true, false);
- skill.add("Block Down", "skill.block_down", "minecraft:diamond_pickaxe", "Break a block and the block below for a minute", 25, false, true, false);
- skill.add("Timber", "skill.timber", "minecraft:iron_axe", "Break whole trees with an axe for a minute", 128, false, true, false);
- clan.loadData();
- items_list = list.new(); //Array-List: Alle Items mit Rezepten
- recipe_site_map = map.new();
- tp_list = list.new();
- tp_map = map.new();
- afk_loop_map = map.new();
- death_loc_map = map.new();
- survival_respawn = set.new();
- overworld = world.getOverWorld();
- moveid_storyspawn = event.addMoveData(loc.new(overworld, 167, 70, 241), loc.new(overworld, 169, 72, 243), 5, -1);
- moveid_gamesspawn = event.addMoveData(loc.new(overworld, 219, 66, 253), loc.new(overworld, 223, 69, 258), 5, -1);
- move_id_afk_loop = event.addMoveData(loc.new(overworld, 208, 69, 226), loc.new(overworld, 209, 69.5, 227), 5, -1);
- config = getScriptVar("server_config");
- survival_spawn = read.location(config.getString(config, "surv_spawn", "games:0:0:0"));
- adventure_chest_loc = loc.new(overworld, 177, 74, 237);
- adventure_aim_loc = loc.new(overworld, 180, 70, 241);
- lottery_loc_1 = loc.new(overworld, 186, 69, 227);
- lottery_loc_2 = loc.new(overworld, 186, 69, 223);
- gambler_loc = loc.new(overworld, 185, 68, 225);
- prefix_money = "§2Money";
- prefix_skill = "§2Skill";
- max_ench_lvl = map.new();
- map.add(max_ench_lvl, enchantment.get("efficiency"), 10);
- map.add(max_ench_lvl, enchantment.get("smite"), 7);
- map.add(max_ench_lvl, enchantment.get("bane_of_arthropods"), 7);
- map.add(max_ench_lvl, enchantment.get("loyalty"), 5);
- map.add(max_ench_lvl, enchantment.get("piercing"), 5);
- map.add(max_ench_lvl, enchantment.get("lure"), 5);
- map.add(max_ench_lvl, enchantment.get("luck_of_the_sea"), 5);
- map.add(max_ench_lvl, enchantment.get("riptide"), 5);
- map.add(max_ench_lvl, enchantment.get("unbreaking"), 5);
- map.add(max_ench_lvl, enchantment.get("quick_charge"), 5);
- map.add(max_ench_lvl, enchantment.get("protection"), 4);
- map.add(max_ench_lvl, enchantment.get("fire_protection"), 4);
- map.add(max_ench_lvl, enchantment.get("blast_protection"), 4);
- map.add(max_ench_lvl, enchantment.get("projectile_protection"), 4);
- map.add(max_ench_lvl, enchantment.get("feather_falling"), 4);
- map.add(max_ench_lvl, enchantment.get("respiration"), 3);
- map.add(max_ench_lvl, enchantment.get("thorns"), 3);
- map.add(max_ench_lvl, enchantment.get("depth_strider"), 4);
- map.add(max_ench_lvl, enchantment.get("frost_walker"), 2);
- map.add(max_ench_lvl, enchantment.get("soul_speed"), 3);
- map.add(max_ench_lvl, enchantment.get("sharpness"), 5);
- map.add(max_ench_lvl, enchantment.get("knockback"), 2);
- map.add(max_ench_lvl, enchantment.get("fire_aspect"), 2);
- map.add(max_ench_lvl, enchantment.get("looting"), 3);
- map.add(max_ench_lvl, enchantment.get("sweeping_edge"), 3);
- map.add(max_ench_lvl, enchantment.get("power"), 5);
- map.add(max_ench_lvl, enchantment.get("punch"), 2);
- map.add(max_ench_lvl, enchantment.get("impaling"), 5);
- map.add(max_ench_lvl, enchantment.get("fortune"), 3);
- air = "minecraft:air";
- air_item = read.item(air);
- leather = "minecraft:leather";
- string = "minecraft:string";
- iron_ingot = "minecraft:iron_ingot";
- bronze_ingot = "km:bronze_ingot";
- copper_ingot = "km:copper_ingot";
- tin_ingot = "km:tin_ingot";
- silver_ingot = "km:silver_ingot";
- stick = "minecraft:stick";
- planks = "minecraft:oak_planks";
- cobblestone = "minecraft:cobblestone";
- iron_ingot = "minecraft:iron_ingot";
- gold_ingot = "minecraft:gold_ingot";
- diamond = "minecraft:diamond";
- book = "minecraft:book";
- birch_planks = "minecraft:birch_planks";
- dark_oak_planks = "minecraft:dark_oak_planks";
- jungle_planks = "minecraft:jungle_planks";
- spruce_planks = "minecraft:spruce_planks";
- acacia_planks = "minecraft:acacia_planks";
- coarse_dirt = "minecraft:coarse_dirt";
- gravel = "minecraft:gravel";
- wheat = "minecraft:wheat";
- grass = "minecraft:grass";
- iron_nugget = "minecraft:iron_nugget";
- hay_bundle = "km:hay_bundle";
- real_hay_block = "km:real_hay_block";
- recipe.add(1, "minecraft:saddle", leather, leather, leather, leather, string, leather, air, iron_ingot, air);
- recipe.add(1, "km:bronze_helmet", bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, air, bronze_ingot, air, air, air);
- recipe.add(1, "km:bronze_chestplate", bronze_ingot, air, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot);
- recipe.add(1, "km:bronze_leggings", bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, air, bronze_ingot, bronze_ingot, air, bronze_ingot);
- recipe.add(1, "km:bronze_boots", bronze_ingot, air, bronze_ingot, bronze_ingot, air, bronze_ingot, air, air, air);
- recipe.add(1, "km:copper_helmet", copper_ingot, copper_ingot, copper_ingot, copper_ingot, air, copper_ingot, air, air, air);
- recipe.add(1, "km:copper_chestplate", copper_ingot, air, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot);
- recipe.add(1, "km:copper_leggings", copper_ingot, copper_ingot, copper_ingot, copper_ingot, air, copper_ingot, copper_ingot, air, copper_ingot);
- recipe.add(1, "km:copper_boots", copper_ingot, air, copper_ingot, copper_ingot, air, copper_ingot, air, air, air);
- recipe.add(1, "km:bookshelf_acacia", acacia_planks, acacia_planks, acacia_planks, book, book, book, acacia_planks, acacia_planks, acacia_planks);
- recipe.add(1, "km:bookshelf_birch", birch_planks, birch_planks, birch_planks, book, book, book, birch_planks, birch_planks, birch_planks);
- recipe.add(1, "km:bookshelf_dark_oak", dark_oak_planks, dark_oak_planks, dark_oak_planks, book, book, book, dark_oak_planks, dark_oak_planks, dark_oak_planks);
- recipe.add(1, "km:bookshelf_jungle", jungle_planks, jungle_planks, jungle_planks, book, book, book, jungle_planks, jungle_planks, jungle_planks);
- recipe.add(1, "km:bookshelf_spruce", spruce_planks, spruce_planks, spruce_planks, book, book, book, spruce_planks, spruce_planks, spruce_planks);
- recipe.add(1, "km:copper_block", copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot);
- recipe.add(1, "km:bronze_block", bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot);
- recipe.add(1, "km:tin_block", tin_ingot, tin_ingot, tin_ingot, tin_ingot, tin_ingot, tin_ingot, tin_ingot, tin_ingot, tin_ingot);
- recipe.add(1, "km:silver_block", silver_ingot, silver_ingot, silver_ingot, silver_ingot, silver_ingot, silver_ingot, silver_ingot, silver_ingot, silver_ingot);
- recipe.add(1, "km:cooking_pot_copper", copper_ingot, air, copper_ingot, copper_ingot, air, copper_ingot, copper_ingot, copper_ingot, copper_ingot);
- recipe.add(1, bronze_ingot, tin_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot);
- recipe.add(1, copper_ingot, air, air, air, air, "km:copper_ore", air, air, air, air);
- recipe.add(1, tin_ingot, air, air, air, air, "km:tin_ore", air, air, air, air);
- recipe.add(1, silver_ingot, air, air, air, air, "km:silver_ore", air, air, air, air);
- recipe.add(1, "km:spikes_bronze", air, bronze_ingot, air, bronze_ingot, bronze_ingot, bronze_ingot, air, air, air);
- recipe.add(1, "km:spikes_copper", air, copper_ingot, air, copper_ingot, copper_ingot, copper_ingot, air, air, air);
- recipe.add(1, "km:spikes_gold", air, gold_ingot, air, gold_ingot, gold_ingot, gold_ingot, air, air, air);
- recipe.add(1, "km:spikes_iron", air, iron_ingot, air, iron_ingot, iron_ingot, iron_ingot, air, air, air);
- recipe.add(1, "km:wooden_battleaxe", air, planks, planks, air, stick, planks, stick, air, air);
- recipe.add(1, "km:stone_battleaxe", air, cobblestone, cobblestone, air, stick, cobblestone, stick, air, air);
- recipe.add(1, "km:iron_battleaxe", air, iron_ingot, iron_ingot, air, stick, iron_ingot, stick, air, air);
- recipe.add(1, "km:golden_battleaxe", air, gold_ingot, gold_ingot, air, stick, gold_ingot, stick, air, air);
- recipe.add(1, "km:diamond_battleaxe", air, diamond, diamond, air, stick, diamond, stick, air, air);
- recipe.add(1, "km:copper_battleaxe", air, copper_ingot, copper_ingot, air, stick, copper_ingot, stick, air, air);
- recipe.add(1, "km:bronze_battleaxe", air, bronze_ingot, bronze_ingot, air, stick, bronze_ingot, stick, air, air);
- recipe.add(1, "km:copper_axe", air, copper_ingot, copper_ingot, air, copper_ingot, stick, air, air, stick);
- recipe.add(1, "km:bronze_axe", air, bronze_ingot, bronze_ingot, air, bronze_ingot, stick, air, air, stick);
- recipe.add(1, "km:wooden_dagger", air, air, planks, air, stick, air, air, air, air);
- recipe.add(1, "km:stone_dagger", air, air, cobblestone, air, stick, air, air, air, air);
- recipe.add(1, "km:iron_dagger", air, air, iron_ingot, air, stick, air, air, air, air);
- recipe.add(1, "km:golden_dagger", air, air, gold_ingot, air, stick, air, air, air, air);
- recipe.add(1, "km:diamond_dagger", air, air, diamond, air, stick, air, air, air, air);
- recipe.add(1, "km:copper_dagger", air, air, copper_ingot, air, stick, air, air, air, air);
- recipe.add(1, "km:bronze_dagger", air, air, bronze_ingot, air, stick, air, air, air, air);
- recipe.add(1, "km:copper_hoe", air, copper_ingot, copper_ingot, air, air, stick, air, air, stick);
- recipe.add(1, "km:bronze_hoe", air, bronze_ingot, bronze_ingot, air, air, stick, air, air, stick);
- recipe.add(1, "km:wooden_hammer", planks, planks, planks, planks, stick, planks, air, stick, air);
- recipe.add(1, "km:stone_hammer", cobblestone, cobblestone, cobblestone, cobblestone, stick, cobblestone, air, stick, air);
- recipe.add(1, "km:iron_hammer", iron_ingot, iron_ingot, iron_ingot, iron_ingot, stick, iron_ingot, air, stick, air);
- recipe.add(1, "km:golden_hammer", gold_ingot, gold_ingot, gold_ingot, gold_ingot, stick, gold_ingot, air, stick, air);
- recipe.add(1, "km:diamond_hammer", diamond, diamond, diamond, diamond, stick, diamond, air, stick, air);
- recipe.add(1, "km:copper_hammer", copper_ingot, copper_ingot, copper_ingot, copper_ingot, stick, copper_ingot, air, stick, air);
- recipe.add(1, "km:bronze_hammer", bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, stick, bronze_ingot, air, stick, air);
- recipe.add(1, "km:copper_shovel", air, copper_ingot, air, air, stick, air, air, stick, air);
- recipe.add(1, "km:bronze_shovel", air, bronze_ingot, air, air, stick, air, air, stick, air);
- recipe.add(1, "km:wooden_scepter", air, stick, planks, air, stick, stick, stick, air, air);
- recipe.add(1, "km:stone_scepter", air, stick, cobblestone, air, stick, stick, stick, air, air);
- recipe.add(1, "km:iron_scepter", air, stick, iron_ingot, air, stick, stick, stick, air, air);
- recipe.add(1, "km:golden_scepter", air, stick, gold_ingot, air, stick, stick, stick, air, air);
- recipe.add(1, "km:diamond_scepter", air, stick, diamond, air, stick, stick, stick, air, air);
- recipe.add(1, "km:copper_scepter", air, stick, copper_ingot, air, stick, stick, stick, air, air);
- recipe.add(1, "km:bronze_scepter", air, stick, bronze_ingot, air, stick, stick, stick, air, air);
- recipe.add(1, "km:copper_pickaxe", copper_ingot, copper_ingot, copper_ingot, air, stick, air, air, stick, air);
- recipe.add(1, "km:bronze_pickaxe", bronze_ingot, bronze_ingot, bronze_ingot, air, stick, air, air, stick, air);
- recipe.add(1, "km:wooden_stick", air, air, planks, air, stick, air, planks, air, air);
- recipe.add(1, "km:stone_stick", air, air, cobblestone, air, stick, air, cobblestone, air, air);
- recipe.add(1, "km:iron_stick", air, air, iron_ingot, air, stick, air, iron_ingot, air, air);
- recipe.add(1, "km:golden_stick", air, air, gold_ingot, air, stick, air, gold_ingot, air, air);
- recipe.add(1, "km:diamond_stick", air, air, diamond, air, stick, air, diamond, air, air);
- recipe.add(1, "km:copper_stick", air, air, copper_ingot, air, stick, air, copper_ingot, air, air);
- recipe.add(1, "km:bronze_stick", air, air, bronze_ingot, air, stick, air, bronze_ingot, air, air);
- recipe.add(1, "km:copper_sword", air, copper_ingot, air, air, copper_ingot, air, air, stick, air);
- recipe.add(1, "km:bronze_sword", air, bronze_ingot, air, air, bronze_ingot, air, air, stick, air);
- recipe.add(1, "km:mushroom_stick_raw", air, "minecraft:brown_mushroom", "minecraft:brown_mushroom", air, stick, "minecraft:red_mushroom", air, air, air);
- recipe.add(1, "km:mushroom_stick_cooked", air, air, air, air, "km:mushroom_stick_raw", air, air, air, air);
- recipe.add(1, "km:fried_egg", air, air, air, air, "minecraft:egg", air, air, air, air);
- recipe.add(1, "km:crate_acacia", acacia_planks, acacia_planks, acacia_planks, acacia_planks, acacia_planks, acacia_planks, acacia_planks, acacia_planks, acacia_planks);
- recipe.add(1, "km:crate_birch", birch_planks, birch_planks, birch_planks, birch_planks, birch_planks, birch_planks, birch_planks, birch_planks, birch_planks);
- recipe.add(1, "km:crate_big_oak", dark_oak_planks, dark_oak_planks, dark_oak_planks, dark_oak_planks, dark_oak_planks, dark_oak_planks, dark_oak_planks, dark_oak_planks, dark_oak_planks);
- recipe.add(1, "km:crate_oak", planks, planks, planks, planks, planks, planks, planks, planks, planks);
- recipe.add(1, "km:crate_jungle", jungle_planks, jungle_planks, jungle_planks, jungle_planks, jungle_planks, jungle_planks, jungle_planks, jungle_planks, jungle_planks);
- recipe.add(1, "km:crate_spruce", spruce_planks, spruce_planks, spruce_planks, spruce_planks, spruce_planks, spruce_planks, spruce_planks, spruce_planks, spruce_planks);
- recipe.add(1, "km:coarse_dirt_slab", air, air, air, coarse_dirt, coarse_dirt, coarse_dirt, air, air, air);
- recipe.add(1, "km:gravel_slab", air, air, air, gravel, gravel, gravel, air, air, air);
- recipe.add(1, "km:straw_hat", air, wheat, air, wheat, wheat, wheat, air, air, air);
- recipe.add(1, hay_bundle, grass, grass, grass, grass, grass, grass, grass, grass, grass);
- recipe.add(1, real_hay_block, hay_bundle, hay_bundle, hay_bundle, hay_bundle, hay_bundle, hay_bundle, hay_bundle, hay_bundle, hay_bundle);
- recipe.add(1, "km:real_hay_bed", air, air, air, real_hay_block, real_hay_block, real_hay_block, air, air, air);
- recipe.add(1, "km:lantern", iron_nugget, iron_nugget, iron_nugget, "minecraft:glass_pane", "minecraft:torch", "minecraft:glass_pane", iron_nugget, iron_nugget, iron_nugget);
- recipe.add(1, "km:sling", stick, string, stick, stick, air, stick, air, stick, air);
- recipe.add(4, "minecraft:string", air, air, air, air, "minecraft:white_wool", air, air, air, air);
- par = particle.get("minecraft:witch");
- piston_sound = sound.get("block.piston.extend");
- adv_tp_sound = sound.get("block.portal.travel");
- sound_category_ambient = sound.getCategory("ambient");
- gambler_inv = inv.new("020202020");
- gambler_inv_id = inv.getId(gambler_inv);
- inv.setItem(gambler_inv, 0, read.item("km:coin_copper", 1, "§f1 snuvi"));
- inv.setItem(gambler_inv, 1, read.item("km:coin_silver", 1, "§f64 snuvis"));
- inv.setItem(gambler_inv, 2, read.item("km:coin_gold", 1, "§f4096 snuvis"));
- inv.setItem(gambler_inv, 3, read.item("minecraft:netherite_block", 1, "§fAll in"));
- bankmenu = inv.new("233302332233302332");
- bankinvid = inv.getId(bankmenu);
- coin_gold = read.item("km:coin_gold", 1, "§f4096 snuvis");
- coin_silver = read.item("km:coin_silver", 1, "§f64 snuvis");
- coin_copper = read.item("km:coin_copper", 1, "§f1 snuvi");
- coin_silver64 = read.item("km:coin_silver", 64, "§f4096 snuvis");
- coin_copper64 = read.item("km:coin_copper", 64, "§f64 snuvis");
- arrow_left = read.item("km:arrow_left", 1, "§fchange to");
- arrow_right = read.item("km:arrow_right", 1, "§fchange to");
- inv.setItem(bankmenu, 0, read.item("km:plus_green", 1, "§fDeposit..."));
- inv.setItem(bankmenu, 1, coin_copper);
- inv.setItem(bankmenu, 2, coin_silver);
- inv.setItem(bankmenu, 3, coin_gold);
- inv.setItem(bankmenu, 4, coin_copper64);
- inv.setItem(bankmenu, 5, arrow_left);
- inv.setItem(bankmenu, 6, arrow_right);
- inv.setItem(bankmenu, 7, coin_silver);
- inv.setItem(bankmenu, 8, read.item("km:minus_red", 1, "§fWithdraw..."));
- inv.setItem(bankmenu, 9, coin_copper);
- inv.setItem(bankmenu, 10, coin_silver);
- inv.setItem(bankmenu, 11, coin_gold);
- inv.setItem(bankmenu, 12, coin_silver64);
- inv.setItem(bankmenu, 13, arrow_left);
- inv.setItem(bankmenu, 14, arrow_right);
- inv.setItem(bankmenu, 15, coin_gold);
- msg("dev", "§bSurvival §rloaded.");
- @wait
- wait();
- if(event == "player_move") {
- if(id == moveid_storyspawn) {
- player.setBackPosLoc(player, world.getServerSpawn());
- player.teleport(player, world.getStorySpawn(), false);
- goto("wait");
- }
- if(id == moveid_gamesspawn) {
- player.setBackPosLoc(player, world.getServerSpawn());
- player.teleport(player, world.getGamesSpawn(), false);
- goto("wait");
- }
- if(id == move_id_afk_loop) {
- player_uuid = player.getUuid(player);
- now_time = time.getMillis();
- time = map.getOrDefault(afk_loop_map, player_uuid, 0);
- if(now_time - time > 9000) { //9 Sekunden
- map.add(afk_loop_map, player_uuid, now_time);
- addMoney(player, 1);
- }
- goto("wait");
- }
- goto("wait");
- }
- //Wenn Event aus Survival-Welten, dann wird er verarbeitet
- if(event == "living_death" || event == "living_pre_hurt") {
- loc = entity.getLocation(living_entity);
- } elseif(event == "pre_explosion") {
- loc = location;
- } elseif(event == "mob_griefing") {
- loc = entity.getLocation(entity);
- } else {
- loc = entity.getLocation(player);
- }
- world_name = world.getName(loc.getWorld(loc));
- if(isSurvWorldName(world_name)) {
- ignoreGoto(event);
- }
- goto("wait");
- @item_air_click
- player_loc = entity.getLocation(player);
- world = loc.getWorld(player_loc);
- if(world.getName(world) != "overworld") {
- goto("wait");
- }
- item = entity.getEquip(player, "hand");
- if(item.getType(item) != "minecraft:clock") {
- goto("wait");
- }
- time = world.getTime(world);
- time_h = math.roundDown(time/1000) + 6;
- while(time_h >= 24) {
- time_h -= 24;
- }
- //m min = t ticks * 60m / 1000 ticks
- time_m = time%1000;
- time_m = math.roundDown(time_m * 60 / 1000);
- if(time_m < 10) {
- time_m = concat("0", text.number(time_m));
- } else {
- time_m = text.number(time_m);
- }
- msg.prefix(player, "§eClock", concat(text.number(time_h), ":", time_m));
- goto("wait");
- @mob_griefing
- if(entity.getType(entity) == "enderman") {
- cancel = true;
- }
- goto("wait");
- @pre_explosion
- plot_list = plot.get(location);
- for(i = 0; i < list.getSize(plot_list); i++) {
- plot = list.getIndex(plot_list, i);
- if(plot.isExplosive(plot)) {
- cancel = false;
- }
- }
- //Kein Grundstück existiert
- if(i == 0) {
- cancel = false;
- }
- goto("wait");
- @player_toss
- target_loc = player.getTarget(player, 5);
- block_type = block.getType(target_loc);
- if(block_type == "minecraft:lectern") {
- cancel = true;
- item.entity.spawn(item.entity.new(loc.mod(target_loc, 0.5, 1.5, 0.5), item));
- }
- goto("wait");
- @living_pre_hurt
- if(!isPlayer(living_entity)) {
- damager = player.getFromDamageSource(damage_source);
- if(!isPlayer(damager)) {
- goto("wait");
- }
- pet_type = entity.getType(living_entity);
- if(pet_type == "wolf" || pet_type == "cat") {
- if(pet.isTamed(living_entity)) {
- owner = pet.getOwner(living_entity);
- if(owner == damager) {
- if(player.getNoPetDamage(player)) {
- cancel = true;
- }
- }
- }
- }
- goto("wait");
- }
- player = living_entity;
- damager = player.getFromDamageSource(damage_source);
- if(!isPlayer(damager)) {
- player_loc = entity.getLocation(player);
- if(loc.hasPlotId(player_loc, 128) && damage.getType(damage_source) == "fall") {
- cancel = true;
- }
- goto("wait");
- }
- if(player == damager) {
- goto("wait");
- }
- if(!hasPvpOn(damager)) {
- cancel = true;
- msg.prefix(damager, "§5PvP", "You have PvP disabled.");
- goto("wait");
- }
- if(!hasPvpOn(player)) {
- cancel = true;
- msg.prefix(damager, "§5PvP", concat(player.getName(player), " has PvP disabled."));
- goto("wait");
- }
- goto("wait");
- @entity_click
- if(hand == "OFF_HAND") {
- goto("wait");
- }
- if(entity.getType(entity) == "human") {
- entity_name = entity.getName(entity);
- if(entity_name == "Info-Point") {
- msg(player, getSpacer());
- msg(player, text.click("§r [§cclick§r] [§eSurvival§r]", "/infopoint1"));
- msg(player, text.click("§r [§cclick§r] [§eAdventure§r]", "/infopoint2"));
- msg(player, text.click("§r [§cclick§r] [§ePlots§r]", "/infopoint3"));
- msg(player, text.click("§r [§cclick§r] [§eClans§r]", "/infopoint4"));
- msg(player, text.click("§r [§cclick§r] [§eCities§r]", "/infopoint5"));
- msg(player, text.click("§r [§cclick§r] [§eShops§r]", "/infopoint6"));
- msg(player, text.click("§r [§cclick§r] [§eMinigames§r]", "/infopoint7"), " ", text.click("§f[§bTeleport§f]", "/games"));
- msg(player, text.click("§r [§cclick§r] [§eQuests§r]", "/infopoint8"), " ", text.click("§f[§bTeleport§f]", "/story"));
- msg(player, text.click("§r [§cclick§r] [§eRanking§r]", "/infopoint9"), " ", text.link("§f[§bRanks§f]", "https://minecraft.hammerle.me/?site=ranks"));
- msg(player, text.click("§r [§cclick§r] [§eRules§r]", "/infopoint10"), " ", text.link("§f[§bFake Rules§f]", "https://minecraft.hammerle.me/?site=rules"));
- msg(player, text.click("§r [§cclick§r] [§eNote§r]", "/infopoint11"));
- goto("wait");
- }
- if(entity_name == "Recipes") {
- recipe_menu = inv.new("333333333333333333333333333333333333333333333200000022");
- recipe.setPage(player, recipe_menu, 1);
- inv.open(recipe_menu, player, "Recipes");
- goto("wait");
- }
- if(entity_name == "Banker") {
- inv.open(bankmenu, player, "Banker");
- goto("wait");
- }
- if(entity_name == "Adventure") {
- if(!player.isOnAdventure(player)) {
- msg.prefix(player, "§5Adventure", "§rYou aren't on an adventure. Click the chest in the teleporter to start an adventure.");
- goto("wait");
- }
- player.setAdventure(player, false);
- adventures = player.getAdventureAmounts(player);
- if(adventures == null) {
- adventures = 0;
- }
- player.setAdventureAmounts(player, ++adventures);
- msg.prefix(player, "§5Adventure", "§rCongratulations, you finished your adventure, here ist your reward!");
- if(adventures == 10) {
- offerRank(player, "rank.pioneer");
- } elseif(adventures == 5) {
- offerRank(player, "rank.explorer");
- } elseif(adventures == 1) {
- offerRank(player, "rank.adventurer");
- }
- removeAdventureDisplay(player);
- safeGiveItemPlayer(player, coin_silver);
- goto("wait");
- }
- }
- goto("wait");
- @player_login
- if(player.isOnAdventure(player)) {
- addAdventureDisplay(player, adventure_aim_loc);
- }
- goto("wait");
- @inv_click
- cancel = true;
- if(inv_id == bankinvid) { //Bankmenü
- gold_inv = player.getItemAmount(player, false, coin_gold);
- silver_inv = player.getItemAmount(player, false, coin_silver);
- copper_inv = player.getItemAmount(player, false, coin_copper);
- //Wechseln
- if(inv_slot == 5 || inv_slot == 6 || inv_slot == 13 || inv_slot == 14) {
- if(inv_slot == 5) {
- //1 Silbermünze --> 64 Kupfermünzen
- amount1 = 1;
- item1 = coin_silver;
- amount2 = 64;
- item2 = coin_copper64;
- message = "No silvercoin in inventory.";
- item_type = "km:coin_copper";
- coin_inv = silver_inv;
- }
- elseif(inv_slot == 6) {
- //64 Kupfermünzen --> 1 Silbermünze
- amount1 = 64;
- item1 = coin_copper64;
- amount2 = 1;
- item2 = coin_silver;
- message = "Not enough coppercoins in inventory.";
- item_type = "km:coin_silver";
- coin_inv = copper_inv;
- }
- elseif(inv_slot == 13) {
- //1 Goldmünze --> 64 Silbermünzen
- amount1 = 1;
- item1 = coin_gold;
- amount2 = 64;
- item2 = coin_silver64;
- message = "No goldcoin in inventory.";
- item_type = "km:coin_silver";
- coin_inv = gold_inv;
- }
- elseif(inv_slot == 14) {
- //64 Silbermünzen --> 1 Goldmünze
- amount1 = 64;
- item1 = coin_silver64;
- amount2 = 1;
- item2 = coin_gold;
- message = "Not enough silvercoins in inventory.";
- item_type = "km:coin_gold";
- coin_inv = silver_inv;
- }
- if(coin_inv < amount1) {
- msg.prefix(player, prefix_money, message);
- goto("wait");
- }
- player.removeItem2(player, item1);
- notgiven = player.giveItem(player, item2);
- if(item.getType(notgiven) != "minecraft:air") {
- amount = item.getAmount(notgiven);
- player.removeItem2(player, read.item(item_type, amount2 - amount));
- player.giveItem(player, item1);
- msg.prefix(player, prefix_money, "Not enough space in inventory.");
- goto("wait");
- }
- inv.update(player);
- msg.prefix(player, prefix_money, "Exchange succesfull.");
- goto("wait");
- }
- //Kontobewegungen
- if(inv_slot == 1 || inv_slot == 9) {
- betrag = 1;
- coin_inv = copper_inv;
- }
- elseif(inv_slot == 2 || inv_slot == 10) {
- betrag = 64;
- coin_inv = silver_inv;
- }
- elseif(inv_slot == 3 || inv_slot == 11) {
- betrag = 4096;
- coin_inv = gold_inv;
- }
- //Einzahlen
- if(inv_slot > 0 && inv_slot < 4) {
- player_id = player.getId(player);
- if(coin_inv < 1) {
- msg.prefix(player, prefix_money, "§rCoin not in inventory.");
- } else {
- addMoney(player, betrag);
- player.removeItem2(player, inv.getItem(bankmenu, inv_slot));
- inv.update(player);
- }
- goto("wait");
- }
- //Auszahlen
- if(inv_slot > 8 && inv_slot < 12) {
- player_id = player.getId(player);
- if(!hasEnoughMoney(player_id, betrag)) {
- msg.prefix(player, prefix_money, "Not enough snuvis on your account.");
- } else {
- subMoney(player, betrag);
- player.giveItem(player, inv.getItem(bankmenu, inv_slot));
- inv.update(player);
- }
- goto("wait");
- }
- goto("wait");
- }
- if(inv_id == gambler_inv_id) {
- if(inv_slot == 0) {
- amount = 1;
- } elseif(inv_slot == 1) {
- amount = 64;
- } elseif(inv_slot == 2) {
- amount = 4096;
- } elseif(inv_slot == 3) {
- amount = getMoney(player);
- if(amount == 0) {
- msg.prefix(player, prefix_money, "You need at least 1 snuvi on your account.");
- goto("wait");
- }
- }
- if(!hasEnoughMoney(player, amount)) {
- msg.prefix(player, prefix_money, "Not enough snuvis on your account.");
- goto("wait");
- }
- win = math.random(1, 2);
- if(win == 1) {
- addMoney(player, amount);
- temp = " won ";
- } else {
- subMoney(player, amount);
- temp = " lost ";
- }
- if(amount == 1) {
- message = concat(player.getName(player), temp, text.number(amount), " snuvi.");
- } else {
- message = concat(player.getName(player), temp, text.number(amount), " snuvis.");
- }
- msg.radius("§2Gambler", message, entity.getLocation(player), 50);
- goto("wait");
- }
- if(inv_name == "Recipes") {
- item_type = item.getType(item);
- if(item_type == "minecraft:air") {
- goto("wait");
- }
- if(item_type == "km:return_red") {
- page = map.getOrDefault($recipe_site_map, player.getUuid(player), 1);
- recipe.setPage(player, inv, page);
- goto("wait");
- }
- if(item_type == "minecraft:paper") {
- name = item.getName(item);
- if(text.contains(name, "<<") || text.contains(name, ">>")) {
- page = removeFormat(name);
- page = text.replace(page, "<<", "");
- page = text.replace(page, ">>", "");
- page = read.number(page);
- if(inv_slot == 46) {
- recipe.setPage(player, inv, page);
- }
- if(inv_slot == 47) {
- recipe.setPage(player, inv, page);
- }
- goto("wait");
- }
- }
- index = recipe.getIndexFromItemType(item_type);
- if(index == null) {
- goto("wait");
- }
- recipe.showRecipe(player, inv, index);
- }
- goto("wait");
- @block_break
- duration = data.getTimer(player, "block_down");
- if(duration > 0) {
- do = true;
- loc = loc.mod(block_loc, 0, -1, 0);
- b_type = block.getType(loc);
- if(b_type == "minecraft:bedrock" || b_type == "minecraft:end_portal_frame") {
- do = false;
- }
- if(!plot.check(loc, player, 2, true)) {
- do = false;
- }
- if(do) {
- item = block.toStack(loc);
- item.drop(loc, item);
- block.set(loc, "minecraft:air");
- }
- }
- duration = data.getTimer(player, "block_up");
- if(duration > 0) {
- do = true;
- loc = loc.mod(block_loc, 0, 1, 0);
- b_type = block.getType(loc);
- if(b_type == "minecraft:bedrock" || b_type == "minecraft:end_portal_frame") {
- do = false;
- }
- if(!plot.check(loc, player, 2, true)) {
- do = false;
- }
- if(do) {
- item = block.toStack(loc);
- item.drop(loc, item);
- block.set(loc, "minecraft:air");
- }
- }
- goto("wait");
- @block_click
- if(hand == "OFF_HAND") {
- goto("wait");
- }
- if(block_type == "minecraft:lectern") {
- if(action == "right") {
- itementity = entity.get(loc.mod(block_loc, 0.5, 0.9, 0.5), 0.2, "net.minecraft.entity.item.ItemEntity");
- if(itementity == null) {
- goto("wait");
- }
- list = entity.near(itementity, 0.2);
- list.add(list, itementity);
- if(list.getSize(list) < 2) {
- //Zu wenig Items am Lesepult
- goto("wait");
- }
- a = array.new(2, 6); //0 = item, 1 = itementity, 2 = enchantments, 3 = enchanted, 4 = enchanted_book, 5 = book
- size = 0;
- for(i = 0; i < list.getSize(list); i++) {
- entity = list.getIndex(list, i);
- item = item.entity.get(entity);
- size += item.getAmount(item);
- if(size > 2) {
- //Zu viele Items am Lesepult
- goto("wait");
- }
- map = enchantment.readFromItem(item);
- a[i, 0] = item;
- a[i, 1] = entity;
- a[i, 2] = map;
- a[i, 4] = false;
- a[i, 5] = false;
- if(map.getSize(map) > 0) {
- //Verzauberte Items
- a[i, 3] = true;
- if(item.getType(item) == "minecraft:enchanted_book") {
- a[i, 4] = true;
- }
- } else {
- //Nicht verzauberte Items
- a[i, 3] = false;
- if(item.getType(item) == "minecraft:book") {
- a[i, 5] = true;
- }
- }
- }
- lectern_action = null;
- if(a[0, 4] == true && a[1, 4] == true) {
- //Beide Items sind verzauberte Bücher
- lectern_action = 0;
- }
- elseif(a[0, 5] == true || a[1, 5] == true) {
- //Eines der beiden Items ist ein normales Buch
- if(a[0, 4] == true || a[1, 4] == true) {
- //Eines der beiden Items ist ein verzaubertes Buch
- lectern_action = 1;
- } elseif(a[0, 3] == true || a[1, 3] == true) {
- //Eines der beiden Items ist ein verzaubertes Item
- lectern_action = 2;
- }
- }
- elseif(a[0, 4] == true || a[1, 4] == true) {
- lectern_action = 3;
- }
- if(lectern_action == null) {
- goto("wait");
- }
-
- if(lectern_action == 0) {
- //Verzauberungsbücher mergen
- item1 = a[0, 0];
- item_entity1 = a[0, 1];
- item_entity2 = a[1, 1];
- map1 = a[0, 2];
- map2 = a[1, 2];
- map_size1 = map.getSize(map1);
- map_size2 = map.getSize(map2);
- iter = map.iterator(map2);
- betrag = 0;
- extra = 0;
- while(hasNext(iter)) {
- element = next(iter);
- key = map.getKey(element);
- level1 = map.getValue(element);
- level2 = map.getOrDefault(map1, key, 0);
- if(level1 == level2) {
- max_lvl = map.get(max_ench_lvl, key);
- //max_lvl = map.getOrDefault(max_ench_lvl, key, enchantment.getMaxLevel(key));
- if(max_lvl != null) {
- if(level1 < max_lvl) {
- extra += 40;
- level1++;
- }
- }
- }
- if(level2 > level1) {
- level1 = level2;
- }
- map.add(map1, key, level1);
- }
- if(map_size1 > map_size2) {
- map = map1;
- } else {
- map = map2;
- }
- iter = map.iterator(map);
- while(hasNext(iter)) {
- element = next(iter);
- level = map.getValue(element);
- betrag += level * 20 + extra;
- }
- if(!hasEnoughMoney(player.getId(player), betrag)) {
- msg.prefix(player, prefix_money, concat("Not enough coins in inventory. This action costs ", text.number(betrag), " snuvis."));
- goto("wait");
- }
- subMoney(player, betrag);
-
- enchantment.writeToItem(map1, item1);
- item.entity.set(item_entity1, item.clone(item1));
- entity.remove(item_entity2);
- } elseif(lectern_action == 1) {
- //Verzauberungsbuch kopieren
- if(a[0, 5]) {
- book_index = 0;
- other_index = 1;
- } else {
- book_index = 1;
- other_index = 0;
- }
- item1 = a[book_index, 0];
- item_entity1 = a[book_index, 1];
- item2 = a[other_index, 0];
- item_entity2 = a[other_index, 1];
- map2 = a[other_index, 2];
-
- map_size = map.getSize(map2);
- betrag = 20 * map_size;
- if(!hasEnoughMoney(player.getId(player), betrag)) {
- msg.prefix(player, prefix_money, concat("Not enough snuvis on your account. This action costs ", text.number(betrag), " snuvis."));
- goto("wait");
- }
- subMoney(player, betrag);
-
- item1 = read.item("minecraft:enchanted_book");
- enchantment.writeToItem(map2, item1);
- item.entity.set(item_entity1, item1);
- item.entity.set(item_entity2, item.clone(item2));
- } elseif(lectern_action == 2) {
- //Einzelne Verzauberung herunterziehen
- if(a[0, 5]) {
- book_index = 0;
- other_index = 1;
- } else {
- book_index = 1;
- other_index = 0;
- }
- item_entity1 = a[book_index, 1];
- map1 = map.new();
- item2 = a[other_index, 0];
- item_entity2 = a[other_index, 1];
- map2 = a[other_index, 2];
- item1 = read.item("minecraft:enchanted_book");
- element = next(map.iterator(map2));
- key = map.getKey(element);
- value = map.getValue(element);
- map.add(map1, key, value);
- map.remove(map2, key);
-
- betrag = 20 * value;
- if(!hasEnoughMoney(player.getId(player), betrag)) {
- msg.prefix(player, prefix_money, concat("Not enough snuvis in your ccount. This action costs ", text.number(betrag), " snuvis."));
- goto("wait");
- }
- subMoney(player, betrag);
-
- enchantment.writeToItem(map1, item1);
- enchantment.writeToItem(map2, item2);
- item.entity.set(item_entity1, item1);
- item.entity.set(item_entity2, item.clone(item2));
- } elseif(lectern_action == 3) {
- //Alle Verzauberungen vom Buch auf das Item übertragen
- betrag = 0;
- if(a[0, 4]) {
- ench_book_index = 0;
- other_index = 1;
- } else {
- ench_book_index = 1;
- other_index = 0;
- }
- item1 = a[ench_book_index, 0];
- item_entity1 = a[ench_book_index, 1];
- map1 = a[ench_book_index, 2];
- item2 = a[other_index, 0];
- item_entity2 = a[other_index, 1];
- map2 = a[other_index, 2];
- map_size1 = map.getSize(map1);
- map_size2 = map.getSize(map2);
-
- iter = map.iterator(map1);
- while(hasNext(iter)) {
- element = next(iter);
- key = map.getKey(element);
- value = map.getValue(element);
- value2 = map.getOrDefault(map2, key, 0);
- if(value2 > value) {
- value = value2;
- }
- map.add(map2, key, value);
- }
-
- if(map_size1 > map_size2) {
- map = map1;
- } else {
- map = map2;
- }
- iter = map.iterator(map);
- while(hasNext(iter)) {
- element = next(iter);
- level = map.getValue(element);
- betrag += level * 20;
- }
- if(!hasEnoughMoney(player.getId(player), betrag)) {
- msg.prefix(player, prefix_money, concat("Not enough snuvis on your account. This action costs ", text.number(betrag), " snuvis."));
- goto("wait");
- }
- subMoney(player, betrag);
-
- enchantment.writeToItem(map2, item2);
- item.entity.set(item_entity2, item.clone(item2));
- entity.remove(item_entity1);
-
- }
- entity.throw(item_entity1, 0, 0.3, 0);
- entity.throw(item_entity2, 0, 0.3, 0);
- particle.spawn(loc.mod(block_loc, 0.5, 1.4, 0.5), par, 20, 0, 0.25, 0.25, 0.25);
- msg.prefix(player, prefix_money, concat("This cost " , text.number(betrag), " snuvis."));
- }
- goto("wait");
- }
- if(block_type == "minecraft:chest") {
- if(isATpReceiver(block_loc)) {
- tp_item = read.item("km:gear", 1, "§rTeleport");
- list = list.new();
- list.add(list, world.getName(loc.getWorld(block_loc)));
- list.add(list, text.number(loc.getX(block_loc)));
- list.add(list, text.number(loc.getY(block_loc)));
- list.add(list, text.number(loc.getZ(block_loc)));
- item.setLore(tp_item, list);
- player.giveItem(player, tp_item);
- goto("wait");
- }
- if(isATpTransmitter(block_loc)) {
- player_uuid = player.getUuid(player);
- clicked = map.getOrDefault(tp_map, player_uuid, 0);
- now_time = time.getMillis();
- if(now_time - clicked < 5000) {
- msg.prefix(player, "§5Adventure", "Wait 5 seconds!");
- goto("wait");
- }
- map.add(tp_map, player_uuid, now_time);
- //Abenteuer-Teleport
- if(block_loc == adventure_chest_loc) {
- if(!player.isOnAdventure(player)) {
- if(!player.hasClearInventory(player)) {
- msg.prefix(player, "§5Adventure", "Your inventory needs to be empty!");
- goto("wait");
- }
- alpha = math.random(0, 360);
- alpha *= math.pi() / 180;
- x = math.round(math.sin(alpha) * 10000) + 0.5;
- z = math.round(math.cos(alpha) * 10000) + 0.5;
- y = 255;
- tp_loc = loc.new(world.getOverWorld(), x, y, z);
- while(block.isAir(tp_loc)) {
- loc.setY(tp_loc, y);
- y--;
- }
- tp_loc = loc.mod(tp_loc, 0, 1, 0);
- setTpWallX(block_loc, "minecraft:lime_stained_glass");
- sound.spawn(block_loc, piston_sound, sound_category_ambient);
- array = array.new(4);
- array[0] = player.getUuid(player);
- array[1] = block_loc;
- array[2] = tp_loc;
- array[3] = true;
- list.add(tp_list, array);
- sgoto(30, "tp_ticker");
- }
- goto("wait");
- }
- //Normaler Teleport
- temp = false;
- inv = block.getInv(block_loc);
- inv_size = inv.getSize(inv);
- for(i = 0; i < inv_size; i++) {
- item = inv.getItem(inv, i);
- if(item.getType(item) == "km:gear") {
- if(item.getName(item) == "§rTeleport") {
- temp = true;
- break;
- }
- }
- }
- if(!temp) {
- msg.prefix(player, "§5Adventure", "No receiver found!");
- goto("wait");
- }
-
- lore_list = item.getLore(item);
- if(list.getSize(lore_list) != 4) {
- msg.prefix(player, "§5Adventure", "No receiver found!");
- goto("wait");
- }
- world = world.get(list.getIndex(lore_list, 0));
- x = read.number(list.getIndex(lore_list, 1));
- y = read.number(list.getIndex(lore_list, 2));
- z = read.number(list.getIndex(lore_list, 3));
- tp_loc = loc.new(world, x, y, z);
- if(!isATpReceiver(tp_loc)) {
- msg.prefix(player, "§5Adventure", "No receiver found!");
- goto("wait");
- }
- loc.add(tp_loc, 0.5, -3, 0.5);
-
- setTpWallX(block_loc, "minecraft:lime_stained_glass");
- sound.spawn(block_loc, piston_sound, sound_category_ambient);
- array = array.new(4);
- array[0] = player.getUuid(player);
- array[1] = block_loc;
- array[2] = tp_loc;
- array[3] = false;
- list.add(tp_list, array);
- sgoto(30, "tp_ticker");
- }
- goto("wait");
- }
- if(block_loc == gambler_loc) {
- cancel = true;
- inv.open(gambler_inv, player, "Choose your amount to bet with");
- goto("wait");
- }
- if(block_loc == lottery_loc_1 || block_loc == lottery_loc_2) {
- if(!hasEnoughMoney(player, 1)) {
- msg.prefix(player, prefix_money, "Not enough snuvis on your account.");
- goto("wait");
- }
- subMoney(player, 1);
- amount = lottery.add(block_loc, 1);
- if(block_loc == lottery_loc_1) {
- winrate = 1000;
- } else {
- winrate = 10000;
- }
- win = math.random(1, winrate);
- if(win == 1) {
- addMoney(player, amount);
- lottery.set(block_loc, 0);
- message = concat(player.getName(player), " has won ", text.number(amount), " snuvis.");
- msg.radius(prefix_money, message, block_loc, 50);
- }
- goto("wait");
- }
- goto("wait");
- @living_death
- if(isPlayer(living_entity)) {
- player = living_entity;
- setDeathLoc(player);
- loc = entity.getLocation(player);
- amount = skill.getAmount(player, "skill.subcu_inv");
- if(skill.isActivated(player, "skill.subcu_inv") && amount > 0) {
- new_amount = amount - 1;
- skill.setAmount(player, "skill.subcu_inv", new_amount);
- msg.prefix(player, prefix_skill, concat("Used Subcutaneous Inventory. New amount: ", text.number(new_amount)));
- } else {
- player.dropInventory(player, loc);
- }
- killer = player.getFromDamageSource(damage_source);
- if(isPlayer(killer)) {
- amount = skill.getAmount(player, "skill.head_human");
- if(amount >= 1) {
- if(perm.has(player, "isTeam")) {
- temp = math.random(1, 20);
- } else {
- temp = math.random(1, 5);
- }
- if(temp == 1) {
- item.drop(loc, player.getHead(player.getUuid(player), player_name));
- }
- }
- }
- goto("wait");
- }
- killer = player.getFromDamageSource(damage_source);
- if(isPlayer(killer)) {
- r = math.random(1, 20);
- if(r == 1) {
- amount = skill.getAmount(killer, "skill.head_monster");
- if(amount >= 1) {
- entity_type = entity.getType(living_entity);
- if(entity_type == "creeper") {
- item.drop(loc, read.item("minecraft:creeper_head"));
- goto("wait");
- }
- if(entity_type == "zombie") {
- item.drop(loc, read.item("minecraft:zombie_head"));
- goto("wait");
- }
- if(entity_type == "skeleton") {
- item.drop(loc, read.item("minecraft:skeleton_skull"));
- goto("wait");
- }
- }
- }
- }
- goto("wait");
- @player_pre_respawn
- if(loc.isInSurvWorld(entity.getLocation(player))) {
- set.add(survival_respawn, player.getUuid(player));
- }
- goto("wait");
- @player_post_respawn
- player_uuid = player.getUuid(player);
- if(set.contains(survival_respawn, player_uuid)) {
- set.remove(survival_respawn, player_uuid);
- if(player.isOnAdventure(player)) {
- tp_loc = player.getAdventureStart(player);
- entity.teleport(player, tp_loc);
- goto("wait");
- }
- amount = skill.getAmount(player, "skill.comeback");
- if(skill.isActivated(player, "skill.comeback") && amount > 0) {
- new_amount = amount - 1;
- skill.setAmount(player, "skill.comeback", new_amount);
- msg.prefix(player, prefix_skill, concat("Used Comeback. New amount: ", text.number(new_amount)));
- entity.teleport(player, getDeathLoc(player));
- goto("wait");
- }
- entity.teleport(player, world.getServerSpawn());
- }
- goto("wait");
- @tp_ticker
- array = list.getIndex(tp_list, 0);
- list.removeIndex(tp_list, 0);
- block_loc = array[1];
- list.add(tp_list, array);
- setTpWallFull(block_loc, "minecraft:lime_stained_glass");
- sound.spawn(block_loc, piston_sound, sound_category_ambient);
- sgoto(30, "tp_final");
- goto("wait");
- @tp_final
- array = list.getIndex(tp_list, 0);
- list.removeIndex(tp_list, 0);
- player_uuid = array[0];
- block_loc = array[1];
- tp_loc = array[2];
- adventure = array[3];
- sound.spawn(block_loc, piston_sound, sound_category_ambient);
- setTpWallFull(block_loc, "minecraft:air");
- player = player.get(player_uuid);
- if(player == null) {
- goto("wait");
- }
- sound.spawn(tp_loc, adv_tp_sound, sound_category_ambient);
- if(adventure) {
- //Party
- if(player.isInParty(player) && player.isPartyLeader(player)) {
- party_id = player.getPartyId(player);
- party_list = party.getList(party_id);
- iter = list.iterator(party_list);
- while(hasNext(iter)) {
- p = player.get(next(iter));
- p_name = player.getName(p);
- p_loc = entity.getLocation(p);
- if(!loc.isSameWorld(adventure_chest_loc, p_loc)) {
- msg.prefix(player, "§5Party", concat(p_name, "§c is in another world."));
- msg.prefix(p, "§5Party", "§cYou are in another world.");
- continue;
- }
- if(loc.distance(adventure_chest_loc, p_loc) > 5) {
- msg.prefix(player, "§5Party", concat(p_name, "§c is too far away."));
- msg.prefix(p, "§5Party", "§cYou are too far away.");
- continue;
- }
- if(player.hasMinigame(p)) {
- msg.prefix(player, "§5Party", concat(p_name, "§c is in a game."));
- msg.prefix(p, "§5Party", "§cYou are in a game.");
- continue;
- }
- if(player.hasQuest2(p)) {
- msg.prefix(player, "§5Party", concat(p_name, "§c is doing a quest."));
- msg.prefix(p, "§5Party", "§cYou are doing a quest.");
- continue;
- }
- if(player.isOnAdventure(p)) {
- msg.prefix(player, "§5Party", concat(p_name, "§c is already on an adventure."));
- msg.prefix(p, "§5Party", "§cYou are already on an adventure.");
- continue;
- }
- if(player.isAfk(p)) {
- msg.prefix(player, "§5Party", concat(p_name, "§c is afk."));
- msg.prefix(p, "§5Party", "§cYou are afk.");
- continue;
- }
- if(!player.hasClearInventory(p)) {
- msg.prefix(player, "§5Party", concat(p_name, "§c has no clear inventory."));
- msg.prefix(p, "§5Party", "§cYou have no clear inventory.");
- continue;
- }
- player.teleport(p, tp_loc, false);
- player.setAdventure(p, true);
- player.setAdventureStart(p, tp_loc);
- addAdventureDisplay(p, adventure_aim_loc);
- title.reset(p);
- title.setSub(p, "Have fun!");
- title.send(p, "§cAdventure");
- msg.prefix(p, "§5Adventure", "§rTo complete your adventure, go to the survival spawn. You cannot teleport. If you die, you start again!");
- }
- goto("wait");
- }
- if(!player.hasClearInventory(player)) {
- msg.prefix(player, "§5Adventure", "Your inventory needs to be empty!");
- goto("wait");
- }
- player.teleport(player, tp_loc, false);
- player.setAdventure(player, true);
- player.setAdventureStart(player, tp_loc);
- addAdventureDisplay(player, adventure_aim_loc);
- title.reset(player);
- title.setSub(player, "Have fun!");
- title.send(player, "§cAdventure");
- msg.prefix(player, "§5Adventure", "§rTo complete your adventure, go to the survival spawn. You cannot teleport. If you die, you start again!");
- goto("wait");
- }
- player.teleport(player, tp_loc, false);
- goto("wait");
- function lottery.set(location, amount) {
- location = loc.mod(location, 0.5, 0, 0.5);
- list = living.near(location, 0.1);
- text_entity = list.getIndex(list, 0);
- name = entity.getName(text_entity);
- if(!text.startsWith(name, "Snuvis: ", 0)) {
- msg("dev", "Lottery error");
- goto("wait");
- }
- entity.setName(text_entity, concat("Snuvis: ", text.number(amount)), true);
- }
- function lottery.add(location, amount) {
- location = loc.mod(location, 0.5, 0, 0.5);
- list = living.near(location, 0.1);
- text_entity = list.getIndex(list, 0);
- name = entity.getName(text_entity);
- if(!text.startsWith(name, "Snuvis: ", 0)) {
- msg("dev", "Lottery error");
- goto("wait");
- }
- amount = text.convert(text.subString(name, 8, text.length(name))) + 1;
- entity.setName(text_entity, concat("Snuvis: ", text.number(amount)), true);
- return amount;
- }
- function recipe.add(result_amount, result_item, item1, item2, item3, item4, item5, item6, item7, item8, item9) {
- array = array.new(11);
- array[0] = result_amount;
- array[1] = result_item;
- array[2] = item1;
- array[3] = item2;
- array[4] = item3;
- array[5] = item4;
- array[6] = item5;
- array[7] = item6;
- array[8] = item7;
- array[9] = item8;
- array[10] = item9;
- list.add($items_list, array);
- }
- function recipe.getIndexFromItemType(item_type) {
- for(i = 0; i < list.getSize($items_list); i++) {
- array = list.getIndex($items_list, i);
- if(array[1] == item_type) {
- return i;
- }
- }
- return null;
- }
- function recipe.showRecipe(player, menu, index) {
- for(i = 0; i < 48; i++) {
- inv.setItem(menu, i, $air_item);
- }
- array = list.getIndex($items_list, index);
- inv.setItem(menu, 23, read.item("km:arrow_right"));
- inv.setItem(menu, 45, read.item("km:return_red", 1, "§fReturn to overview"));
- inv.setItem(menu, 10, read.item(array[2]));
- inv.setItem(menu, 11, read.item(array[3]));
- inv.setItem(menu, 12, read.item(array[4]));
- inv.setItem(menu, 19, read.item(array[5]));
- inv.setItem(menu, 20, read.item(array[6]));
- inv.setItem(menu, 21, read.item(array[7]));
- inv.setItem(menu, 28, read.item(array[8]));
- inv.setItem(menu, 29, read.item(array[9]));
- inv.setItem(menu, 30, read.item(array[10]));
- inv.setItem(menu, 25, read.item(array[1], array[0]));
- inv.update(player);
- }
- function recipe.setPage(player, menu, page) {
- map.add($recipe_site_map, player.getUuid(player), page);
- size = list.getSize($items_list);
- max_page = math.roundUp(size / 45);
- if(page > max_page) {
- return;
- }
- inv.setItem(menu, 45, $air_item);
- if(page > 1) {
- inv.setItem(menu, 46, read.item("minecraft:paper", 1, concat("§e", text.number(page - 1), " <<")));
- } else {
- inv.setItem(menu, 46, $air_item);
- }
- if(page < max_page) {
- inv.setItem(menu, 47, read.item("minecraft:paper", 1, concat("§e>> ", text.number(page + 1))));
- } else {
- inv.setItem(menu, 47, $air_item);
- }
- max_index = size - 1;
- for(i = 0; i < 45; i++) {
- list_index = i + 45 * (page - 1);
- if(list_index > max_index) {
- inv.setItem(menu, i, $air_item);
- } else {
- array = list.getIndex($items_list, list_index);
- inv.setItem(menu, i, read.item(array[1]));
- }
- }
- inv.update(player);
- }
- function setDeathLoc(player) {
- map.add($death_loc_map, player.getUuid(player), entity.getLocation(player));
- }
- function getDeathLoc(player) {
- return map.getOrDefault($death_loc_map, player.getUuid(player), world.getServerSpawn());
- }
|