event.load("entity_click"); //event.load("inv_click"); event.load("snuvi_click"); event.load("player_pre_respawn"); event.load("player_post_respawn"); event.load("living_death"); //event.load("player_join"); event.load("player_move"); event.load("block_click"); event.load("entity_damage"); event.load("explosion"); event.load("entity_change_block"); clan.loadData(); tp_list = list.new(); tp_map = map.new(); tp_set = set.new(); afk_loop_map = map.new(); survival_respawn = set.new(); overworld = world.getOverWorld(); moveid_gamesspawn = event.addMoveData(loc.new(overworld, 93, 61, -31), loc.new(overworld, 97, 65, -30), 5, -1); moveid_creaspawn = event.addMoveData(loc.new(overworld, 102, 60, -20), loc.new(overworld, 103, 64, -16), 5, -1); moveid_mobarena = event.addMoveData(loc.new(overworld, 81, 59, -28), loc.new(overworld, 82, 63, -24), 5, -1); config = getScriptVar("server_config"); adventure_chest_loc = loc.new(overworld, 177, 74, 237); adventure_aim_loc = loc.new(overworld, 180, 70, 241); mobarena_spawn = loc.new(overworld, 1150.5, -5, 1087, 90, 0); prefix_money = "§2Money"; death_loc_map = map.new(); redstone_mat = material.get("redstone"); ice_mat = material.get("ice"); blue_ice_mat = material.get("blue_ice"); packed_ice_mat = material.get("packed_ice"); ench_flame = enchantment.get("flame"); ench_unbreaking = enchantment.get("unbreaking"); ench_sharpness = enchantment.get("sharpness"); piston_sound = sound.get("BLOCK_PISTON_EXTEND"); adv_tp_sound = sound.get("BLOCK_PORTAL_TRAVEL"); sound_category_ambient = sound.getCategory("AMBIENT"); sound_category_master = sound.getCategory("MASTER"); sound_flute = sound.get("BLOCK_NOTE_BLOCK_FLUTE"); sound_harp = sound.get("BLOCK_NOTE_BLOCK_HARP"); sound_pling = sound.get("BLOCK_NOTE_BLOCK_PLING"); sound_cat = sound.get("ENTITY_CAT_AMBIENT"); sound_stray_cat = sound.get("ENTITY_CAT_STRAY_AMBIENT"); sound_purreow = sound.get("ENTITY_CAT_PURREOW"); sound_drink_milk = sound.get("ENTITY_WANDERING_TRADER_DRINK_MILK"); sound_slime_place = sound.get("BLOCK_SLIME_BLOCK_PLACE"); sound_eating = sound.get("ENTITY_GENERIC_EAT"); music_chirp = sound.get("MUSIC_DISC_CHIRP"); Sound_Pitch_List = list.new(); for(a = -12; a <= 12; a++){ list.add(Sound_Pitch_List, math.pow(2, -a / 12)); } casino_inv = inv.new("022200200", text.new("Casino")); casino_inv_id = inv.getId(casino_inv); lore_list = list.new(); list.add(lore_list, text.new("§dClick to lose or double")); list.add(lore_list, text.new("§dWinrate: 45%")); inv.setItem(casino_inv, 1, item.custom.create("COPPER_COIN", 1, "§fGamble 1 Snuvi", lore_list)); inv.setItem(casino_inv, 2, item.custom.create("SILVER_COIN", 1, "§fGamble 64 Snuvis", lore_list)); inv.setItem(casino_inv, 3, item.custom.create("GOLD_COIN", 1, "§fGamble 4096 Snuvis", lore_list));; lore_list = list.new(); lottery_value = lottery.getValue(); list.add(lore_list, text.new(string.concat("§dWin value: ", string.number(lottery_value)))); list.add(lore_list, text.new("§dBuy a ticket for 10 snuvis.")); list.add(lore_list, text.new("§dWinrate 1:500")); inv.setItem(casino_inv, 6, item.custom.create("COPPER_COIN", 1, "§fLottery", lore_list));; bankmenu = inv.new("222200000", text.new("Banker")); bankinvid = inv.getId(bankmenu); inv.setItem(bankmenu, 0, item.custom.create("COPPER_COIN", 1, "§f1 Snuvi", null)); inv.setItem(bankmenu, 1, item.custom.create("SILVER_COIN", 1, "§f64 Snuvis", null)); inv.setItem(bankmenu, 2, item.custom.create("GOLD_COIN", 1, "§f4096 Snuvis", null)); inv.setItem(bankmenu, 3, item.create("NETHERITE_BLOCK", 1, "§fAll Snuvis", null)); msg.string("dev", "§bSurvival §rloaded."); @wait wait(); if(event == "player_move") { if(id == moveid_mobarena) { player.setBackPosLoc(player, world.getServerSpawn()); player.teleport(player, mobarena_spawn, false); goto("wait"); } if(id == moveid_gamesspawn) { player.setBackPosLoc(player, world.getServerSpawn()); player.teleport(player, world.getGamesSpawn(), false); goto("wait"); } if(id == moveid_creaspawn) { player.setBackPosLoc(player, world.getServerSpawn()); player.teleport(player, world.getCreativeSpawn(), false); goto("wait"); } goto("wait"); } //Wenn Event aus Survival-Welten, dann wird er verarbeitet if(event == "living_death") { loc = entity.getLocation(living_entity); } elseif(event == "explosion" || event == "entity_damage" || event == "entity_change_block") { loc = entity.getLocation(entity); } else { loc = entity.getLocation(player); } world_name = world.getName(loc.getWorld(loc)); if(world.isSurvName(world_name)) { ignoreGoto(event); } goto("wait"); @living_death if(isPlayer(living_entity)) { player = living_entity; setDeathLoc(player); } goto("wait"); @entity_change_block if(entity.getType(entity) == "enderman") { cancel = true; } goto("wait"); @explosion plot_list = plot.get(loc); plot_amount = list.getSize(plot_list); for(i = 0; i < plot_amount; i++) { plot = list.getIndex(plot_list, i); if(plot.isExplosive(plot)) { cancel = false; } else { cancel = true; break; } } //Kein Grundstück existiert if(plot_amount == 0) { cancel = false; } goto("wait"); @entity_damage if(!isPlayer(entity)) { damager = player.getFromDamageSource(damage_source); if(!isPlayer(damager)) { goto("wait"); } pet_type = entity.getType(entity); if(pet_type == "wolf" || pet_type == "cat" || pet_type == "parrot" || pet_type == "horse") { if(pet.isTamed(entity)) { owner = pet.getOwner(entity); if(owner == damager) { if(player.getNoPetDamage(damager)) { cancel = true; } } } } goto("wait"); } player = entity; damager = player.getFromDamageSource(damage_source); if(damager == null) { 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", string.concat(player.getName(player), " has PvP disabled.")); goto("wait"); } goto("wait"); @entity_click if(slot.isOffHand(hand)) { goto("wait"); } if(!entity.isHuman(entity)) { goto("wait"); } human_name = human.getName(entity); if(human_name == "Casino") { inv.open(casino_inv, player); } if(human_name == "Banker") { inv.open(bankmenu, player); goto("wait"); } if(human_name == "§cMarvin") { item = living.getHand(player); item_name = item.getName(item); if(item_name != null && string.text(item_name) == "§fBeer") { sound.spawnForPlayer(player, $sound_drink_milk, $sound_category_master, 1, 1); msg.prefix(player, "§cmarvinius", "Prost!"); } else { msg.prefix(player, "§cmarvinius", "Ich mag Gösser."); } goto("wait"); } if(human_name == "§4Kajetan") { item = living.getHand(player); item_type = item.getType(item); sound.spawnForPlayer(player, $sound_slime_place, $sound_category_master, 1, 1); if(item_type == redstone_mat) { rand_number = math.random(0, 3); if(rand_number == 0){ temp_message = "WUSIWUSIWUSIWUSIWUSIWUSIWUSIWUSI"; } if(rand_number == 1){ temp_message = "Wusi!"; } if(rand_number == 2){ temp_message = "Wusi?"; } if(rand_number == 3){ temp_message = "Wusi."; } msg.prefix(player, "§4kajetanjohannes", temp_message); goto("wait"); } if(item_type == ice_mat || item_type == blue_ice_mat || item_type == packed_ice_mat){ msg.prefix(player, "§4kajetanjohannes", "§bDas sieht nach mir aus."); }else{ msg.prefix(player, "§4kajetanjohannes", "wusi"); } goto("wait"); } if(human_name == "§bNico") { rand_number = math.random(0, 25); if(rand_number > 13){ sound.spawnForPlayer(player, $sound_cat, $sound_category_master, 1, 1); msg.prefix(player, "§bImKillerKatze", "Miau"); goto("wait"); } if(rand_number < 12){ sound.spawnForPlayer(player, $sound_stray_cat, $sound_category_master, 1, 1); msg.prefix(player, "§bImKillerKatze", "Miau!"); goto("wait"); } else { sound.spawnForPlayer(player, $sound_purreow, $sound_category_master, 1, 1); msg.prefix(player, "§bImKillerKatze", "Schnurrr!"); goto("wait"); } goto("wait"); } if(human_name == "§cFabio") { msg.prefix(player, "§cwertibaldi", "Kann grad nicht, bin im Einsatz für den Katastrophenschutz."); goto("wait"); } if(human_name == "§cLucas") { item = living.getHand(player); item_name = item.getName(item); if(item_name != null && string.text(item_name) == "§fBeer") { msg.prefix(player, "§cMentorMentos", "Folg mir auf Twitch! "); msg(player, string.getLinkText("Klick mich an :D","https://www.twitch.tv/Mentor_Mentos")); } else { msg.prefix(player, "§cMentorMentos", "Ich mag Kölsch."); } goto("wait"); } if(human_name == "§9Jan") { if(player.isSneaking(player)){ msg.prefix(player, "§9SirTerence7", "Very secretive yes yes."); goto("wait"); } rand_number = math.random(0, 7); if(rand_number < 4){ msg.prefix(player, "§9SirTerence7", "Mathe bla... bla... bla..."); } if(rand_number == 4){ msg.prefix(player, "§9SirTerence7", "Fraktale bla... bla... bla..."); } if(rand_number == 5){ msg.prefix(player, "§9SirTerence7", "Höhere Dimensionen bla... bla... bla..."); } if(rand_number == 6){ msg.prefix(player, "§9SirTerence7", "*redet mit Händen weiter*"); } if(rand_number == 7){ msg.prefix(player, "§9SirTerence7", "*wechselt voller Faszination zwischen scheinbar zusammenhangslosen Themen hin und her*"); } rand_number = math.random(0, 500); if(rand_number <= 2){ sound.spawnForPlayer(player, $music_chirp, $sound_category_master, 1, 1); } else { rand_pitch = math.random(4, list.getSize(Sound_Pitch_List) - 5); if(rand_number < 200){ pitch1 = list.getIndex(Sound_Pitch_List, rand_pitch-4); pitch2 = list.getIndex(Sound_Pitch_List, rand_pitch); pitch3 = list.getIndex(Sound_Pitch_List, rand_pitch+3); } else { if(rand_number < 300){ pitch1 = list.getIndex(Sound_Pitch_List, rand_pitch-4); pitch1_2 = list.getIndex(Sound_Pitch_List, rand_pitch-2); pitch2 = list.getIndex(Sound_Pitch_List, rand_pitch); pitch3_2 = list.getIndex(Sound_Pitch_List, rand_pitch+1); pitch3 = list.getIndex(Sound_Pitch_List, rand_pitch+3); sound.spawnForPlayer(player, $sound_harp, $sound_category_master, 0.5, pitch1_2); sound.spawnForPlayer(player, $sound_harp, $sound_category_master, 0.5, pitch3_2); sound.spawnForPlayer(player, $sound_flute, $sound_category_master, 0.75, pitch1_2); sound.spawnForPlayer(player, $sound_flute, $sound_category_master, 0.75, pitch3_2); } else { pitch1 = list.getIndex(Sound_Pitch_List, rand_pitch-3); pitch2 = list.getIndex(Sound_Pitch_List, rand_pitch); pitch3 = list.getIndex(Sound_Pitch_List, rand_pitch+4); } } sound.spawnForPlayer(player, $sound_harp, $sound_category_master, 0.8, pitch1); sound.spawnForPlayer(player, $sound_harp, $sound_category_master, 0.9, pitch2); sound.spawnForPlayer(player, $sound_harp, $sound_category_master, 0.8, pitch2); sound.spawnForPlayer(player, $sound_flute, $sound_category_master, 0.9, pitch1); sound.spawnForPlayer(player, $sound_flute, $sound_category_master, 1, pitch2); sound.spawnForPlayer(player, $sound_flute, $sound_category_master, 0.9, pitch3); } goto("wait"); } if(human_name == "§9Mareen") { rand_number = math.random(0, 5); if(rand_number > 1){ msg.prefix(player, "§9Mareeeen", "Wo ist die Schokolade versteckt!?"); }else{ msg.prefix(player, "§9Mareeeen", "Ich esse deine Schokolade!"); sound.spawnForPlayer(player, $sound_eating, $sound_category_master, 1, 1); } goto("wait"); } goto("wait"); if(entity_name == "Info-Point") { msg(player, string.getSpacer()); msg(player, string.getClickText("§r [§cclick§r] [§eSurvival§r]", "/infopoint1")); msg(player, string.getClickText("§r [§cclick§r] [§eAdventure§r]", "/infopoint2")); msg(player, string.getClickText("§r [§cclick§r] [§ePlots§r]", "/infopoint3")); msg(player, string.getClickText("§r [§cclick§r] [§eClans§r]", "/infopoint4")); msg(player, string.getClickText("§r [§cclick§r] [§eCities§r]", "/infopoint5")); msg(player, string.getClickText("§r [§cclick§r] [§eShops§r]", "/infopoint6")); msg(player, string.getClickText("§r [§cclick§r] [§eMinigames§r]", "/infopoint7"), " ", string.getClickText("§f[§bTeleport§f]", "/games")); msg(player, string.getClickText("§r [§cclick§r] [§eQuests§r]", "/infopoint8")); msg(player, string.getClickText("§r [§cclick§r] [§eCreative§r]", "/infopoint12"), " ", string.getClickText("§f[§bTeleport§f]", "/creative")); msg(player, string.getClickText("§r [§cclick§r] [§eRanking§r]", "/infopoint9"), " ", string.getLinkText("§f[§bRanks§f]", "https://minecraft.hammerle.me/?site=ranks")); msg(player, string.getClickText("§r [§cclick§r] [§eRules§r]", "/infopoint10"), " ", string.getLinkText("§f[§bFake Rules§f]", "https://minecraft.hammerle.me/?site=rules")); msg(player, string.getClickText("§r [§cclick§r] [§eNote§r]", "/infopoint11")); goto("wait"); } if(entity_name == "Adventure") { if(!player.isOnAdventure(player)) { msg.prefix(player, "§5Adventure", "You 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", "Congratulations, 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); player.safeGiveItem(player, item.getAmber()); money.addBoost(player, 4096); goto("wait"); } goto("wait"); @player_join if(player.isOnAdventure(player)) { addAdventureDisplay(player, adventure_aim_loc); } goto("wait"); @inv_click //Verhindert während eines (Abenteuer-)Teleports, die Benutzung des Spielerinventars (inkl. Crafting-Bereich!) player_uuid = player.getUuid(player); if(set.contains(tp_set, player_uuid)) { cancel = true; } goto("wait"); @snuvi_click inv_id = inv.getId(inv); if(inv_id == bankinvid) { //Bankmenü //Einzahlen if(click == "RIGHT" || click == "SHIFT_RIGHT") { amount_items = 1; if(click == "SHIFT_RIGHT") { amount_items = 64; } player_inv = player.getInv(player); gold_item = item.custom.create("GOLD_COIN", 1, null, null); silver_item = item.custom.create("SILVER_COIN", 1, null, null); copper_item = item.custom.create("COPPER_COIN", 1, null, null); gold_inv = inv.getItemAmount(player_inv, gold_item); silver_inv = inv.getItemAmount(player_inv, silver_item); copper_inv = inv.getItemAmount(player_inv, copper_item); if(inv_slot == 0) { depositSnuvis(player, amount_items, 0, 0); } elseif(inv_slot == 1) { depositSnuvis(player, 0, amount_items, 0); } elseif(inv_slot == 2) { depositSnuvis(player, 0, 0, amount_items); } elseif(inv_slot == 3) { gold_inv = inv.getItemAmount(player_inv, item.custom.create("GOLD_COIN", 1, null, null)); silver_inv = inv.getItemAmount(player_inv, item.custom.create("SILVER_COIN", 1, null, null)); copper_inv = inv.getItemAmount(player_inv, item.custom.create("COPPER_COIN", 1, null, null)); depositSnuvis(player, copper_inv, silver_inv, gold_inv); } goto("wait"); } //Auszahlen if(click == "LEFT" || click == "SHIFT_LEFT") { amount_items = 1; if(click == "SHIFT_LEFT") { amount_items = 64; } if(inv_slot == 0) { withdrawSnuvis(player, amount_items, 0, 0); } elseif(inv_slot == 1) { withdrawSnuvis(player, 0, amount_items, 0); } elseif(inv_slot == 2) { withdrawSnuvis(player, 0, 0, amount_items); } elseif(inv_slot == 3) { a = money.split(getMoney(player)); withdrawSnuvis(player, a[2], a[1], a[0]); } } goto("wait"); } if(inv_id == casino_inv_id) { //Lottery if(inv_slot == 6) { ticket_price = 10; if(!hasEnoughMoney(player, ticket_price)) { msg.action(player, "Not enough snuvis on your account."); goto("wait"); } money.sub(player, ticket_price); new_value = lottery.addValue(10); item = inv.getItem(inv, inv_slot); lore_list = item.getLore(item); list.setIndex(lore_list, 0, text.new(string.concat("§dWin value: ", string.number(new_value)))); item.setLore(item, lore_list); win = math.random(1, 500); if(win == 1) { message = string.concat(player.getName(player), " won ", string.number(new_value), " snuvis."); msg.online("§dLottery", message); money.add(player, new_value); list.setIndex(lore_list, 0, text.new(string.concat("§dWin value: 0"))); item.setLore(item, lore_list); lottery.setValue(0); } goto("wait"); } //Gambler if(inv_slot == 1) { amount = 1; } elseif(inv_slot == 2) { amount = 64; } elseif(inv_slot == 3) { amount = 4096; } if(!hasEnoughMoney(player, amount)) { msg.action(player, "Not enough snuvis on your account."); goto("wait"); } win = math.random(1, 100); if(win < 45) { money.add(player, amount); temp = " won "; } else { money.sub(player, amount); temp = " lost "; } if(amount == 4096) { message = string.concat(player.getName(player), temp, string.number(amount), " snuvis."); msg.radius("§dGambler", message, entity.getLocation(player), 10); } } goto("wait"); function depositSnuvis(player, copper, silver, gold) { gold_item = item.custom.create("GOLD_COIN", 1, null, null); silver_item = item.custom.create("SILVER_COIN", 1, null, null); copper_item = item.custom.create("COPPER_COIN", 1, null, null); player_inv = player.getInv(player); gold_inv = inv.getItemAmount(player_inv, gold_item); silver_inv = inv.getItemAmount(player_inv, silver_item); copper_inv = inv.getItemAmount(player_inv, copper_item); if(copper > copper_inv || silver > silver_inv || gold > gold_inv) { player.action(player, text.new("Not enough coins in inventory.")); return; } if(copper > 0) { item.setAmount(copper_item, copper); inv.removeItem(player_inv, copper_item); } if(silver > 0) { item.setAmount(silver_item, silver); inv.removeItem(player_inv, silver_item); } if(gold > 0) { item.setAmount(gold_item, gold); inv.removeItem(player_inv, gold_item); } sum = copper + silver * 64 + gold * 4096; money.add(player, sum); } function withdrawSnuvis(player, copper, silver, gold) { sum = copper + silver * 64 + gold * 4096; if(!hasEnoughMoney(player, sum)) { player.action(player, text.new("Not enough snuvis on your account.")); return; } if(copper > 0) { copper_item = item.custom.create("COPPER_COIN", 1, null, null); item.setAmount(copper_item, copper); player.safeGiveItem(player, copper_item); } if(silver > 0) { silver_item = item.custom.create("SILVER_COIN", 1, null, null); item.setAmount(silver_item, silver); player.safeGiveItem(player, silver_item); } if(gold > 0) { gold_item = item.custom.create("GOLD_COIN", 1, null, null); item.setAmount(gold_item, gold); player.safeGiveItem(player, gold_item); } sum = copper + silver * 64 + gold * 4096; money.sub(player, sum); } function fire_ring(location, block_string, radius){ loc_x = loc.getX(location); loc_y = loc.getY(location); loc_z = loc.getZ(location); for(a = -radius; a < radius + 1; a++){ loc.setX(location, loc_x + a); for(b = -radius; b < radius + 1; b++){ loc.setY(location, loc_y + b); for(c = -radius; c < radius + 1; c++){ loc.setZ(location, loc_z + c); if(block.isAir(location)){ block.set(location, block_string); } } } } } @block_click if(action == "RIGHT_CLICK_AIR") { player_loc = entity.getLocation(player); world = loc.getWorld(player_loc); if(!world.isOverworld(world.getName(world))) { goto("wait"); } item = living.getHand(player); if(!item.isType(item, "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 = string.concat("0", string.number(time_m)); } else { time_m = string.number(time_m); } msg.prefix(player, "§eClock", string.concat(string.number(time_h), ":", time_m)); goto("wait"); } if(action == "RIGHT_CLICK_BLOCK") { if(block.isType(block, "SPAWNER")) { if(!player.isCreative(player)) { cancel = true; 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: ", string.number(new_amount))); entity.teleport(player, getDeathLoc(player)); goto("wait"); }*/ //entity.teleport(player, world.getServerSpawn()); } 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 to win: ", 0)) { snuvi.debug("Lottery error"); return; } entity.setName(text_entity, string.concat("Snuvis to win: ", string.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 to win:", 0)) { snuvi.debug("Lottery error"); return null; } amount = text.convert(text.subString(name, 15, text.length(name))) + 1; entity.setName(text_entity, string.concat("Snuvis to win: ", string.number(amount)), true); return amount; } 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()); } function lottery.addValue(value) { config = getServerConfig(); new_value = config.getDouble(config, "lottery_value", 0) + value; config.set(config, "lottery_value", new_value); config.saveAsync(config); return new_value; } function lottery.setValue(value) { config = getServerConfig(); config.set(config, "lottery_value", value); config.saveAsync(config); } function lottery.getValue() { config = getServerConfig(); return config.getDouble(config, "lottery_value", 0); }