123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463 |
- event.load("living_pre_hurt");
- event.load("player_login");
- event.load("player_pre_respawn");
- event.load("player_post_respawn");
- event.load("block_click");
- event.load("block_break");
- event.load("entity_click");
- event.load("custom_command");
- event.load("player_logout");
- event.load("term_script");
- event.load("player_move");
- event.load("item_air_click");
- event.load("inv_click");
- script_ids = map.new();
- script_players = list.new();
- script_paths = list.new();
- games_respawn = set.new();
- gamesign_ground_block = set.new();
- block_click_catcher = set.new();
- gamesignsmap = map.new();
- openedgames = map.new();
- gamepaths = map.new();
- gamemappaths = map.new();
- singleplayergames = set.new();
- compass_loc_list = list.new();
- prefix_party = "§5Party";
- gamesworld = world.getGames();
- sign_tag = block.getTag("minecraft:wall_signs");
- facing_property = block.getProperty("horizontal_facing");
- marv_loc = loc.new(gamesworld, -410, 161, -60);
- dice_loc = loc.new(gamesworld, -416, 156, -57);
- dice_loc_rm5 = loc.new(gamesworld, -3064, 156, 1061);
- dice_time = time.getMillis();
- move_id_to_spawn = event.addMoveData(loc.new(gamesworld, -415, 148, -62), loc.new(gamesworld, -411, 153, -58), 5, -1);
- minigame.addSign("bwmapsign1", true, loc.new(gamesworld, -423, 158, -42), "minigames/bedwars/bedwars", "minigames/bedwars/region_bwmap1", false);
- minigame.addSign("bwmapsign2", true, loc.new(gamesworld, -423, 158, -43), "minigames/bedwars/bedwars", "minigames/bedwars/region_bwmap2", false);
- minigame.addSign("bwmapsign3", true, loc.new(gamesworld, -423, 158, -44), "minigames/bedwars/bedwars", "minigames/bedwars/region_bwmap3", false);
- minigame.addSign("bwmapsign4", true, loc.new(gamesworld, -423, 157, -42), "minigames/bedwars/bedwars", "minigames/bedwars/region_bwmap4", false);
- minigame.addSign("bwmapsign5", true, loc.new(gamesworld, -423, 157, -43), "minigames/bedwars/bedwars", "minigames/bedwars/region_bwmap5", false);
- minigame.addSign("bwmapsign6", true, loc.new(gamesworld, -423, 157, -44), "minigames/bedwars/bedwars", "minigames/bedwars/region_bwmap6", false);
- minigame.addSign("bwmapsign7", true, loc.new(gamesworld, -423, 156, -42), "minigames/bedwars/bedwars", "minigames/bedwars/region_bwmap7", false);
- minigame.addSign("bwmapsign8", true, loc.new(gamesworld, -423, 156, -43), "minigames/bedwars/bedwars", "minigames/bedwars/region_bwmap8", false);
- minigame.addSign("bwmapsign9", true, loc.new(gamesworld, -423, 156, -44), "minigames/bedwars/bedwars", "minigames/bedwars/region_bwmap9", false);
- minigame.addSign("letterssign1", true, loc.new(gamesworld, -396, 158, -63), "minigames/letters/letters", "minigames/letters/region_lettersmap1", true);
- minigame.addSign("letterssign2", true, loc.new(gamesworld, -396, 158, -62), "minigames/letters/letters", "minigames/letters/region_lettersmap2", true);
- minigame.addSign("letterssign3", true, loc.new(gamesworld, -396, 158, -61), "minigames/letters/letters", "minigames/letters/region_lettersmap3", true);
- minigame.addSign("rmmaploc1", true, loc.new(gamesworld, -411, 158, -44), "minigames/ragemode/ragemode", "minigames/ragemode/rmmap1", false);
- minigame.addSign("rmmaploc2", true, loc.new(gamesworld, -411, 158, -43), "minigames/ragemode/ragemode", "minigames/ragemode/rmmap2", false);
- minigame.addSign("rmmaploc3", true, loc.new(gamesworld, -411, 158, -42), "minigames/ragemode/ragemode", "minigames/ragemode/rmmap3", false);
- minigame.addSign("rmmaploc4", true, loc.new(gamesworld, -411, 157, -44), "minigames/ragemode/ragemode", "minigames/ragemode/rmmap4", false);
- minigame.addSign("rmmaploc5", true, loc.new(gamesworld, -411, 157, -43), "minigames/ragemode/ragemode", "minigames/ragemode/rmmap5", false);
- minigame.addSign("sfsign1", true, loc.new(gamesworld, -398, 158, -47), "minigames/sammelfieber/sfranked", "minigames/sammelfieber/sfmap1", true);
- minigame.addSign("sfsign2", true, loc.new(gamesworld, -398, 157, -47), "minigames/sammelfieber/sfranked", "minigames/sammelfieber/sfmap2", true);
- minigame.addSign("sfsign3", true, loc.new(gamesworld, -399, 158, -47), "minigames/sammelfieber/sammelfieber", "minigames/sammelfieber/sfmap3", false);
- minigame.addSign("buttonssign1", true, loc.new(gamesworld, -399, 158, -65), "minigames/buttons/buttons", "minigames/buttons/buttonsmap1", true);
- minigame.addSign("buttonssign2", true, loc.new(gamesworld, -398, 158, -65), "minigames/buttons/buttons", "minigames/buttons/buttonsmap2", true);
- minigame.addSign("spleefsign1", true, loc.new(gamesworld, -419, 156, -40), "minigames/spleef/spleef", "minigames/spleef/spleefmap1", false);
- minigame.addSign("spleefsign2", true, loc.new(gamesworld, -420, 156, -40), "minigames/spleef/spleef", "minigames/spleef/spleefmap2", false);
- minigame.addSign("spleefsign3", true, loc.new(gamesworld, -421, 156, -40), "minigames/spleef/spleef", "minigames/spleef/spleefmap3", false);
- minigame.addSign("knockfightsign1", true, loc.new(gamesworld, -419, 157, -40), "minigames/knockfight/knockfight", "minigames/knockfight/knockmap1", false);
- minigame.addSign("knockfightsign2", true, loc.new(gamesworld, -420, 157, -40), "minigames/knockfight/knockfight", "minigames/knockfight/knockmap2", false);
- minigame.addSign("knockfightsign3", true, loc.new(gamesworld, -421, 157, -40), "minigames/knockfight/knockfight", "minigames/knockfight/knockmap3", false);
- minigame.addSign("invertingsign1", true, loc.new(gamesworld, -396, 158, -57), "minigames/inverting/inverting", "minigames/inverting/invertingmap1", true);
- minigame.addSign("invertingsign2", true, loc.new(gamesworld, -396, 158, -56), "minigames/inverting/inverting", "minigames/inverting/invertingmap2", true);
- minigame.addSign("invertingsign3", true, loc.new(gamesworld, -396, 158, -55), "minigames/inverting/inverting", "minigames/inverting/invertingmap3", true);
- minigame.addSign("invertingclsign1", true, loc.new(gamesworld, -396, 157, -57), "minigames/inverting/inverting", "minigames/inverting/invertingclmap1", true);
- minigame.addSign("invertingclsign2", true, loc.new(gamesworld, -396, 157, -56), "minigames/inverting/inverting", "minigames/inverting/invertingclmap2", true);
- minigame.addSign("invertingclsign3", true, loc.new(gamesworld, -396, 157, -55), "minigames/inverting/inverting", "minigames/inverting/invertingclmap3", true);
- //minigame.addSign("ctfsign1", false, loc.new(gamesworld, 13, 75, 64), "minigames/capturetheflag/capturetheflag", "minigames/capturetheflag/ctfmap1", false);
- minigame.addSign("jrmap", true, loc.new(gamesworld, -396, 158, -51), "minigames/jumpnrun/jumpnrun", "minigames/jumpnrun/jumpnrun", true);
- minigame.addSign("parcoursign1", true, loc.new(gamesworld, -396, 158, -50), "minigames/parcour/parcour", "minigames/parcour/parcour_map1", true);
- minigame.addSign("tjrsign", true, loc.new(gamesworld, -396, 157, -51), "minigames/jumpnrun/todesjumpnrun", "minigames/jumpnrun/todesjumpnrun", true);
- minigame.addSign("icejrsign", true, loc.new(gamesworld, -404, 157, -75), "minigames/jumpnrun/icejumpnrun", "minigames/jumpnrun/icejumpnrun", true);
- minigame.addSign("fastbridgesign1", true, loc.new(gamesworld, -413, 157, -40), "minigames/fastbridge/fastbridge", "minigames/fastbridge/region_fastbridgemap1", false);
- minigame.addSign("fastbridgesign2", true, loc.new(gamesworld, -414, 157, -40), "minigames/fastbridge/fastbridge", "minigames/fastbridge/region_fastbridgemap2", false);
- minigame.addSign("halmasign1", true, loc.new(gamesworld, -413, 156, -40), "minigames/halma/halma", "minigames/halma/halma_map1", false);
- minigame.addSign("halmasign2", true, loc.new(gamesworld, -414, 156, -40), "minigames/halma/halma", "minigames/halma/halma_map2", false);
- minigame.addSign("rebuildsign1", true, loc.new(gamesworld, -405, 158, -75), "minigames/rebuild/rebuild", "minigames/rebuild/rebuildmap1", false);
- minigame.addSign("rebuildsign2", true, loc.new(gamesworld, -404, 158, -75), "minigames/rebuild/rebuild", "minigames/rebuild/rebuildmap2", false);
- minigame.addSign("hideandseeksign1", true, loc.new(gamesworld, -413, 158, -40), "minigames/hideandseek/hideandseek", "minigames/hideandseek/hideandseekmap1", false);
- minigame.addSign("hideandseeksign2", true, loc.new(gamesworld, -414, 158, -40), "minigames/hideandseek/hideandseek", "minigames/hideandseek/hideandseekmap2", false);
- minigame.addSign("shoppingsign1", true, loc.new(gamesworld, -415, 158, -40), "minigames/shoppingchaos/shoppingchaos", "minigames/shoppingchaos/shopping_map1", false);
- minigame.addSign("mengersign1", true, loc.new(gamesworld, -405, 157, -75), "minigames/mengerrun/mengerrun", "minigames/mengerrun/menger_map1", false);
- minigame.addSign("leapfrogsign1", true, loc.new(gamesworld, -399, 157, -65), "minigames/leapfrog/leapfrog", "minigames/leapfrog/leapfrogmap1", true);
- minigame.addSign("snowsign1", true, loc.new(gamesworld, -419, 158, -40), "minigames/snowgame/snowgame", "minigames/snowgame/snowmap1", false);
- minigame.addSign("snowsign2", true, loc.new(gamesworld, -420, 158, -40), "minigames/snowgame/snowgame", "minigames/snowgame/snowmap2", false);
- //minigame.addSign("damesign1", false, loc.new(gamesworld, -411, 158, -44), "minigames/dame/dame", "minigames/dame/dame_map1", false);
- minigame.addSign("among_us_sign1", true, loc.new(gamesworld, -417, 157, -41), "minigames/among_us/among_us", "minigames/among_us/among_us_map1", false);
- setScriptVar("gamesigns", gamesignsmap);
- games_inv = inv.new("333333333333333333333333333");
- minigame.addCompass(0, read.item("minecraft:red_bed", 1, "§fBedWars"), loc.new(gamesworld, -420.5, 156, -41.5, 90, 0.0001));
- minigame.addCompass(1, read.item("minecraft:iron_axe", 1, "§fRageMode"), loc.new(gamesworld, -412.5, 156, -43.5, -90, 0.0001));
- minigame.addCompass(2, read.item("minecraft:snowball", 1, "§fSnowgame"), loc.new(gamesworld, -418.5, 156, -41.5, 0.0001, -20));
- minigame.addCompass(3, read.item("minecraft:diamond_block", 1, "§fHide and Seek"), loc.new(gamesworld, -412.5, 156, -41.5, 0.0001, -20));
- minigame.addCompass(4, read.item("minecraft:emerald", 1, "§fShoppingChaos"), loc.new(gamesworld, -414.5, 156, -41.5, 0.0001, -20));
- minigame.addCompass(5, read.item("minecraft:light_blue_terracotta", 1, "§fFastBridge"), loc.new(gamesworld, -412.5, 156, -41.5, 0.0001, 0.0001));
- minigame.addCompass(6, read.item("minecraft:blue_banner", 1, "§fHalma"), loc.new(gamesworld, -412.5, 156, -41.5, 0.0001, 25));
- minigame.addCompass(7, read.item("km:bronze_dagger", 1, "§fAmong Us"), loc.new(gamesworld, -416.5, 156, -42.5, 0.0001, 0.0001));
- minigame.addCompass(8, read.item("minecraft:grass_block", 1, "§fSammelfieber"), loc.new(gamesworld, -397.5, 156, -48.5, 0.0001, 0.0001));
- minigame.addCompass(9, read.item("minecraft:slime_block", 1, "§fJ&R / Parcour"), loc.new(gamesworld, -397.5, 156, -50.5, -90, 0.0001));
- minigame.addCompass(10, read.item("minecraft:lapis_block", 1, "§fInverting"), loc.new(gamesworld, -397.5, 156, -56.5, -90, 0.0001));
- minigame.addCompass(11, read.item("minecraft:oak_sign", 1, "§fLetters"), loc.new(gamesworld, -397.5, 156, -62.5, -90, -20));
- minigame.addCompass(12, read.item("minecraft:oak_button", 1, "§fButtons"), loc.new(gamesworld, -398.5, 156, -62.5, 180, -20));
- minigame.addCompass(13, read.item("minecraft:redstone_torch", 1, "§fLeapfrog"), loc.new(gamesworld, -398.5, 156, -62.5, 180, 0.0001));
- minigame.addCompass(14, read.item("minecraft:stick", 1, "§fKnockfight"), loc.new(gamesworld, -418.5, 156, -41.5, 0.0001, 0.0001));
- minigame.addCompass(15, read.item("minecraft:diamond_shovel", 1, "§fSpleef"), loc.new(gamesworld, -418.5, 156, -41.5, 0.0001, 25));
- iter = map.iterator(gamemappaths);
- while(hasNext(iter)) {
- entry = next(iter);
- gamesignloc = map.getKey(entry);
- facing = block.property.getValue(gamesignloc, facing_property);
- if(facing == "north") {
- ground_block = loc.mod(gamesignloc, 0, 0, 1);
- } elseif(facing == "east") {
- ground_block = loc.mod(gamesignloc, -1, 0, 0);
- } elseif(facing == "south") {
- ground_block = loc.mod(gamesignloc, 0, 0, -1);
- } elseif(facing == "west") {
- ground_block = loc.mod(gamesignloc, 1, 0, 0);
- }
- set.add(gamesign_ground_block, ground_block);
- if(map.get(openedgames, gamesignloc)) {
- if(!sign.ready(gamesignloc)) {
- snuvi.debug(concat("No Sign: ", text.location(gamesignloc)));
- }
- } else {
- if(!sign.closed(gamesignloc)) {
- snuvi.debug(concat("No Sign: ", text.location(gamesignloc)));
- }
- }
- }
- msg("dev", "§bGamecenter §rloaded.");
- @wait
- wait();
- ignoreGoto(event);
- goto("wait");
- @item_air_click
- item = living.getEquip(player, "hand");
- if(item.getType(item) == "km:cross_red") {
- cancel = true;
- goto("wait");
- }
- if(item.getType(item) == "minecraft:compass") {
- player_loc = entity.getLocation(player);
- if(loc.isInGamesWorld(player_loc)) {
- if(!player.hasMinigame(player)) {
- inv.open(games_inv, player, "Minigames");
- }
- }
- }
- goto("wait");
- @inv_click
- if(inv_name == "Minigames") {
- if(item.getType(item) == "minecraft:air") {
- goto("wait");
- }
- loc = list.getIndex(compass_loc_list, inv_slot);
- entity.teleport(player, loc);
- }
- goto("wait");
- @player_move
- if(id == move_id_to_spawn) {
- player.setBackPosLoc(player, world.getGamesSpawn());
- player.teleport(player, world.getServerSpawn(), false);
- }
- goto("wait");
- @term_script
- map.remove(script_ids, getScriptVar("sign_loc"));
- goto("wait");
- @custom_command
- if(player == null) {
- goto("wait");
- }
- if(!perm.has(player, command)) {
- goto("wait");
- }
- size = list.getSize(args);
- if(command == "game") {
- if(size != 1) {
- msg(player, "§6/game §r<open/close>");
- } else {
- arg0 = list.getIndex(args, 0);
- block_loc = player.getTarget(player, 5, false, false);
- if(!block.hasTag(sign_tag, block.get(block_loc))) {
- msg.prefix(player, "§6Games", "Look at a sign.");
- goto("wait");
- }
- if(arg0 == "open") {
- sign.ready(block_loc);
- map.add(openedgames, block_loc, true);
- } elseif(arg0 == "close") {
- sign.closed(block_loc);
- map.add(openedgames, block_loc, false);
- } else {
- msg(player, "§6/game §r<open/close>");
- }
- }
- }
- goto("wait");
- @entity_click
- if(hand == "OFF_HAND") {
- goto("wait");
- }
- if(loc.distance(marv_loc, entity.getLocation(player)) < 3) {
- msg.prefix(player, "§cGamerMarv", "Help! I'm being held here against my will!");
- }
- goto("wait");
- @block_break
- if(set.contains(gamesign_ground_block, block_loc) || map.contains(gamepaths, block_loc)) {
- cancel = true;
- msg.prefix(player, "§6Games", "You can´t break this block.");
- goto("wait");
- }
- goto("wait");
- @block_click
- item = living.getEquip(player, "hand");
- if(item.getType(item) == "km:cross_red") {
- cancel = true;
- }
- if(hand == "OFF_HAND") {
- goto("wait");
- }
- if(action == "left" && set.contains(block_click_catcher, player)) {
- set.remove(block_click_catcher, player);
- goto("wait");
- } else {
- set.add(block_click_catcher, player);
- }
- if(block_loc == dice_loc || block_loc == dice_loc_rm5) {
- now_time = time.getMillis();
- if(now_time - dice_time < 1000) {
- goto("wait");
- }
- dice_time = now_time;
- if(player.getName(player) == "ssiooo") {
- message = concat(player.getName(player), " has rolled a 6, cause he is the Oberf*****.");
- } else {
- message = concat(player.getName(player), " has rolled a ", text.number(math.random(1, 6)), ".");
- }
- msg.radius("§6Dice", message, block_loc, 20);
- goto("wait");
- }
- if(!block.hasTag(sign_tag, block.get(block_loc))) {
- goto("wait");
- }
- if(!map.contains(gamemappaths, block_loc)) {
- goto("wait");
- }
- cancel = true;
- if(!map.get(openedgames, block_loc)) {
- msg.prefix(player, "§6Games", "Closed game.");
- goto("wait");
- }
- if(minigame.isStarted(block_loc)) {
- script_id = map.get(script_ids, block_loc);
- if(script_id == null) {
- goto("error_on_gamejoin");
- }
- script = script.getFromId(script_id);
- if(script == null) {
- goto("error_on_gamejoin");
- }
- msg.prefix(player, "§6Games", "Could not enter.");
- goto("wait");
- }
- //Start/Get Script
- @startnewgame
- if(player.hasMinigame(player)) {
- //prevent double game join
- goto("wait");
- }
- pfad = map.get(gamemappaths, block_loc);
- pfad2 = map.get(gamepaths, block_loc);
- script_id = map.get(script_ids, block_loc);
- if(script_id == null) {
- if(pfad2 != null) {
- if(pfad2 == "minigames/sammelfieber/sammelfieber" || pfad2 == "minigames/sammelfieber/sfranked") {
- script = script.start(pfad, "minigames/sammelfieber/sammelfieberitems", pfad2, "utils/u_games", "utils/u_general");
- } else {
- script = script.start(pfad, pfad2, "utils/u_games", "utils/u_general");
- }
- } else {
- script = script.start(pfad, "utils/u_games", "utils/u_general");
- }
- if(script == null) {
- snuvi.debug("Minigame throws error on gamestart");
- goto("wait");
- }
- map.add(script_ids, block_loc, script.getId(script));
- } else {
- script = script.getFromId(script_id);
- }
- if(script == null) {
- goto("error_on_gamejoin");
- }
- //Add player to script
- script_id = script.getId(script);
- maxplayers = script.getVar(script, "maxplayers");
- script.setVar(script, "script_id", script_id);
- if(player.isInParty(player)) {
- if(player.isPartyLeader(player)) {
- if(set.contains(singleplayergames, block_loc)) {
- minigame.singleJoin(script, player);
- goto("wait");
- }
- party_list = party.getList(player.getPartyId(player));
- party_size = list.getSize(party_list);
- if(party_size > maxplayers) {
- msg.prefix(player, prefix_party, "Not enough space.");
- goto("wait");
- }
- minigame.partyJoin(script, player, party_list);
- goto("wait");
- }
- msg.prefix(player, prefix_party, "§cAttention! You are not the leader.");
- }
- minigame.singleJoin(script, player);
- goto("wait");
- @error_on_gamejoin
- snuvi.debug(concat("Started gamesign existing without game behind ", script_id, " ", block_loc));
- map.remove(script_ids, block_loc);
- goto("startnewgame");
- @player_login
- player_loc = entity.getLocation(player);
- if(loc.isInGamesWorld(player_loc)) {
- resetplayer(player);
- entity.teleport(player, world.getGamesSpawn());
- }
- goto("wait");
- @living_pre_hurt
- if(!isPlayer(living_entity)) {
- goto("wait");
- }
- player = living_entity;
- player_loc = entity.getLocation(player);
- if(!loc.isInGamesWorld(player_loc)) {
- goto("wait");
- }
- plot_id = plot.getIdFromLocation(player_loc);
- if(plot_id == 32 || plot_id == 106) {
- living.setHealth(player, 20);
- player.setHunger(player, 20);
- player.setSaturation(player, 5);
- cancel = true;
- }
- goto("wait");
- @player_pre_respawn
- if(loc.isInGamesWorld(entity.getLocation(player))) {
- if(!player.hasMinigame(player)) {
- set.add(games_respawn, player.getUuid(player));
- }
- }
- goto("wait");
- @player_post_respawn
- player_uuid = player.getUuid(player);
- if(set.contains(games_respawn, player_uuid)) {
- set.remove(games_respawn, player_uuid);
- entity.teleport(player, world.getGamesSpawn());
- }
- goto("wait");
- function minigame.addCompass(index, item, location) {
- list.add($compass_loc_list, location);
- item.hide(item, "attributes");
- inv.setItem($games_inv, index, item);
- }
- function minigame.addSign(map_string, opened, sign_loc, core_path, map_path, singleplayer) {
- map.add($gamesignsmap, map_string, sign_loc);
- map.add($openedgames, sign_loc, opened);
- map.add($gamepaths, sign_loc, core_path);
- map.add($gamemappaths, sign_loc, map_path);
- if(singleplayer) {
- set.add($singleplayergames, sign_loc);
- }
- }
- function minigame.joinPlayer(script, player) {
- id_set = player.getMinigameIds(player);
- player_uuid = player.getUuid(player);
- //Sicherheits-Handling 1
- if(player.hasMinigame(player)) {
- iter = set.iterator(id_set);
- while(hasNext(iter)) {
- s_id = next(iter);
- s = script.getFromId(s_id);
- if(s != null) {
- list.remove(minigame.getPlayers(s_id), player_uuid);
- }
- }
- set.clear(id_set);
- }
- minigame.setLastPos(player);
- script_id = script.getId(script);
- //Script-ID dem Set des Spielers hinzufügen
- set.add(id_set, script_id);
- //Spieler-UUID der Spielerliste des Scripts hinzufügen
- player_list = minigame.getPlayers(script_id);
- if(!list.contains(player_list, player_uuid)) { //Sicherheits-Handling 2
- list.add(player_list, player.getUuid(player));
- }
- stacks.setActive(player, false);
- //Event player_join
- script.setVar(script, "player", player);
- script.callEvent("player_join", script);
- sign.players($block_loc, list.getSize(player_list), $maxplayers);
- }
- function minigame.singleJoin(script, player) {
- player_list = minigame.getPlayers(script.getId(script));
- if(list.getSize(player_list) >= $maxplayers) {
- msg.prefix(player, "§6Games", "Not enough space.");
- return;
- }
- minigame.joinPlayer(script, player);
- }
- function minigame.partyJoin(script, party_leader, party_list) {
- minigame.joinPlayer(script, party_leader); //Party-Leader soll der 1.Spieler sein, der joint
- party_leader_uuid = player.getUuid(party_leader);
- iter = list.iterator(party_list);
- while(hasNext(iter)) {
- p_uuid = next(iter);
- if(p_uuid == party_leader_uuid) {
- continue;
- }
- p = player.get(p_uuid);
- p_name = player.getName(p);
- if(!loc.isInGamesWorld(entity.getLocation(p))) {
- msg.prefix(party_leader, $prefix_party, concat(p_name, "§c is not in the world 'games'."));
- continue;
- }
- if(player.hasMinigame(p)) {
- msg.prefix(party_leader, $prefix_party, concat(p_name, "§c is in another game."));
- continue;
- }
- if(player.isAfk(p)) {
- msg.prefix(party_leader, $prefix_party, concat(p_name, "§c is afk."));
- continue;
- }
- sign.ready($block_loc);
- minigame.joinPlayer(script, p);
- }
- }
|