/** * Settler test * * @global type $UMC_USER * @global type $UMC_SETTING * @global type $UMC_DOMAIN * @return string */ function umc_settler_new() { global $UMC_USER, $UMC_SETTING, $UMC_DOMAIN; $out = ''; if (!$UMC_USER) { return "You have to be <a href=\"{$UMC_DOMAIN}/wp-login.php\">logged in</a> to use this!"; } $steps = array(1 => array('begging' => true, 'griefing' => true, 'pixel_art' => true, 'minimaps' => false, 'xray_and_cheats' => true, 'not_reading_the_website' => true, 'swearing' => true, 'walls_around_your_lot' => true, 'shaders' => false)); $player = strtolower($UMC_USER['username']); $uuid = $UMC_USER['uuid']; $userlevel = $UMC_USER['userlevel']; $email = $UMC_USER['email']; if ($userlevel != 'Guest') { $out .= "You are not a Guest and can use the <a href=\"http://uncovery.me/server-access/lot-manager/\">Lot manager</a> to get a lot!"; } if (umc_user_is_banned($uuid)) { return "Sorry, you are banned from the server!"; } $icon_url = umc_user_get_icon_url($player); $user_icon = "<img src=\"{$icon_url}\">"; // get user location $s_post = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING); $step = 0; if (isset($s_post['step'])) { $step = $s_post['step']; } $loc = umc_read_markers_file('array'); $lot = false; if (isset($s_post['lot'])) { $lot = $s_post['lot']; } $world = false; if (isset($s_post['world'])) { $world = $s_post['world']; } if (isset($loc[$player])) { $player_world = $loc[$player]['world']; $player_lot = umc_lot_get_from_coords($loc[$player]['x'], $loc[$player]['z'], $loc[$player]['world']); $x = $loc[$player]['x']; $z = $loc[$player]['z']; } else { $player_lot = false; $player_world = false; $x = false; $z = false; } $error = ''; // answer check switch ($step) { case 2: if (!isset($s_post['stepone'])) { $step = 1; umc_log('settler_test', 'step_1_fail', "{$player} did not answer any questions!"); $error = "You need to answer the questions on the previous page!"; } else { $problem = false; $answers = array(); foreach ($steps[1] as $choice => $value) { if ($value == true && !in_array($choice, $s_post['stepone'])) { // Bad stuff $problem = true; $answers[] = $choice; } else { if ($value == false && in_array($choice, $s_post['stepone'])) { // but is $problem = true; $answers[] = $choice; } } } if ($problem) { umc_log('settler_test', 'step_1_fail', "{$player} failed step 1 with wrong answers " . implode("|", $answers)); $error = "<h1>Error</h1>One or more answers in the previous page were wrong.<br>Please go back and check before proceeding.<br>" . "If you need help, please read the <a href=\"{$UMC_DOMAIN}/about-this-server/rules/\">rest of the rules</a>"; $step = 1; } } break; case 3: if (!isset($s_post['world'])) { $step = 2; umc_log('settler_test', 'step_2_fail', "{$player} failed step 2"); $error = 'You need to choose a playing mode to continue!'; } break; case 4: if (!isset($s_post['lot'])) { $step = 3; umc_log('settler_test', 'step_3_fail', "{$player} failed step 3"); $error = 'You need to choose lot to continue!'; } break; case 5: if (!$player_world) { $step = 4; umc_log('settler_test', 'step_4_fail', "{$player} failed step 4 (not in game)"); $error = 'You need to be in the game to continue!'; // var_dump($loc); } else { if ($player_world != 'city' || $x > 953 || $x < 938 || $z < -814 || $z > -793) { $step = 4; umc_log('settler_test', 'step_4_fail', "{$player} failed step 4 (not in spawn house)"); $error = 'You need to type /warp spawn and then continue!'; } } break; case 6: if ($player_world != $s_post['world']) { $step = 5; umc_log('settler_test', 'step_5_fail', "{$player} failed step 5"); $error = "You need to go through the {$s_post['world']} portal! Type <strong>/warp spawn</strong> and try again!"; } break; case 8: if (strtolower($player_lot) != strtolower($s_post['check_lot'])) { $step = 7; umc_log('settler_test', 'step_7_fail', "{$player} failed step 7 by entering " . $s_post['check_lot'] . "instead of {$player_lot}"); $error = 'You need to enter the lot you see on-screen into the form to continue!'; } break; case 9: if (!$player_lot) { $step = 8; umc_log('settler_test', 'step_8_fail', "{$player} failed step 8"); $error = "We could not find you on the map. Please make sure you are on the server!"; } else { if ($player_lot != $s_post['lot']) { $step = 8; umc_log('settler_test', 'step_8_fail', "{$player} failed step 8"); $error = "You need to get lot {$s_post['lot']} before you can continue. Please either walk there or use /jump {$s_post['lot']}. You are now in lot {$player_lot}!"; } } break; } // questions $out .= "<strong>{$error}</strong><br>"; switch ($step) { case 0: umc_log('settler_test', 'start', "{$player} started the settler test"); $out .= "<form action=\"{$UMC_DOMAIN}/server-access/buildingrights/\" method=\"post\">\n" . "<h1>Step 1: Welcome!</h1>\n" . "<h2>Once you finish this test, you will be settler!</h2>\n" . "<h2>Before Applying</h2>\n" . "<ul>\n" . " <li>You must have some experience playing Minecraft.</li>\n" . " <li>Read the <a href=\"{$UMC_DOMAIN}/faq/\">FAQ</a></li>\n" . " <li>Read the <a href=\"{$UMC_DOMAIN}/rules/\">Rules</a></li>\n" . " <li>Read the <a href=\"{$UMC_DOMAIN}/user-levels/\">User Levels and Commands</a> page.</li>\n" . "</ul>\n" . "This process will guide you through the process of getting building rights on the server and at the same time give you a lot and make sure you get there. " . "You will need to login to the server with your minecraft client during the process and keep this website open.<br>" . "<input type=\"hidden\" name=\"step\" value=\"1\">\n" . "<input type=\"submit\" name=\"Next\" value=\"Next\">\n"; break; case 1: $warning = ''; $failcount = umc_settler_get_fails($player); if ($failcount > 10) { $warning = "<div style=\"color:red;font-weight:bold;font-size:120%;\">You have failed the test more than 10 times. If you fail too often, you will be banned from the server!</div>"; } else { if ($failcount > 20) { umc_user_ban($player, "Settler test failed"); return $warning = "<div style=\"color:red;font-weight:bold;font-size:120%;\">You have failed the test too often. You are now banned from the server!</div>"; } } umc_log('settler_test', 'step_1', "{$player} is at step 1"); $out .= "<form action=\"{$UMC_DOMAIN}/server-access/buildingrights/\" method=\"post\">\n" . "<h1>Step 2: Rules & regulations</h1>\n" . $warning . "Here are some basic rules you should know:" . "<ul>\n<li><strong>Do not beg for anything</strong> - Including upgrades, handouts or help with this process.</li>\n" . "<li><strong>No pixel-art</strong>. This is not 'paint by numbers'. We build stuff.</li>\n" . "<li><strong>Be considerate of others</strong>. No griefing, no stealing, no killing. We log everything, we will find out.</li>\n" . "<li><strong>Don't cheat!</strong> No Xray, no mods, no bug abuse.</li>\n" . "<li><strong>Learn yourself!</strong> Look on the <a href=\"{$UMC_DOMAIN}/about-this-server/\">website</a> for answers first, then ask other users.</li>\n" . "<li><strong>We ban forever - no appeals!</strong> You better read the <a href=\"{$UMC_DOMAIN}/about-this-server/rules/\">rest of the rules</a>.</li>\n" . "</ul>\n" . "<strong>Pick the items that are not allowed (and will therefore get you banned) (Note: Asking others about the answers will get you banned, too!): </strong><br>\n" . "<input type=\"hidden\" name=\"step\" value=\"2\">\n"; foreach ($steps[1] as $image => $check) { $image_text = umc_pretty_name($image); $out .= "<span style=\"float:left; text-align:center;\"><img height=\"180\" src=\"{$UMC_DOMAIN}/websend/{$image}.png\"><br>" . "<input type=\"checkbox\" name=\"stepone[]\" value=\"{$image}\">{$image_text}</span>\n"; } $out .= '<br style="clear:both;">' . "<input type=\"submit\" name=\"Next\" value=\"Next\">\n"; break; case 2: umc_log('settler_test', 'step_2', "{$player} is at step 2"); $out .= "<form action=\"{$UMC_DOMAIN}/server-access/buildingrights/\" method=\"post\">\n" . '<h1>Step 3: Creative or Survival?</h1>' . 'You can either build in a flat, creative world or a wild, survival world!<br>Choose one:<br>' . "<span style=\"float:left; text-align:center;\"><img width=\"400\" src=\"{$UMC_DOMAIN}/websend/empire.png\"><br><input type=\"radio\" name=\"world\" value=\"empire\">Survival mode in the Empire world</span>" . "<span style=\"float:left; text-align:center;\"><img width=\"400\" src=\"{$UMC_DOMAIN}/websend/flatlands.png\"><br><input type=\"radio\" name=\"world\" value=\"flatlands\">Creative mode in the Flatlands world</span><br style=\"clear:both;\">" . "<input type=\"hidden\" name=\"step\" value=\"3\">\n" . "<input type=\"submit\" name=\"Next\" value=\"Next\">\n"; break; case 3: umc_log('settler_test', 'step_3', "{$player} is at step 3"); $spawn_lot = $UMC_SETTING['world_data'][$world]['spawn']; $tile = umc_user_get_lot_tile(strtolower($spawn_lot)); $out .= "<form action=\"{$UMC_DOMAIN}/admin/index.php?function=create_map&world={$world}&freeonly=true\" method=\"post\">\n" . "<h1>Step 4: Find a lot!</h1>\n" . "<img style=\"float:right;\" width=\"300\" src=\"{$UMC_DOMAIN}/websend/{$world}.png\">Great! You chose to build in the <strong>{$world}</strong> world!<br>" . "You are now ready to pick a lot!<br>" . "If you made a mistake and want to play a different mode, please go back now and chose another mode. There will be no going back later.<br><br>" . "<strong>Now you need to find a lot that you like.</strong><br>" . "When you click 'Next', a map of the {$world} world will open.<br>" . "Click on the \"Find Spawn\" button in the top-left corner. It looks like this:<br>" . "<img src=\"/websend/find_spawn.png\"><br>" . "You will now see a flashing lot, which is the entrance to the {$world} world.<br>" . "It's convenient to find a lot close to it. <br>" . "The spawn lot looks like this:<br>{$tile}" . "<input type=\"hidden\" name=\"settler_test\" value=\"settler_test\">\n" . "<br><br><input type=\"submit\" name=\"Next\" value=\"Next\">\n"; break; case 4: umc_log('settler_test', 'step_4', "{$player} is at step 4"); $tile = umc_user_get_lot_tile(strtolower($lot)); $out .= "<form action=\"{$UMC_DOMAIN}/server-access/buildingrights/\" method=\"post\">\n" . '<h1>Step 5: You chose a lot!</h1>' . "<span style=\"float:left;\">{$tile}</span>The lot you have chosen is <strong>{$lot} in the {$world}</strong> world. You can see a satellite image of it on the left.<br>You should now go there, to make sure it's what you want!<br>"; if ($player_world) { $out .= "<br>To go there, you need to go to the portal house. From there you can get into the {$world} world.<br>" . "Please type <strong>/warp spawn</strong> in game to get there, it should look like this inside:<br><img src=\"/websend/portals.png\">" . "Once you see this, please come back here and press " . "<input type=\"submit\" name=\"Next\" value=\"Next\">\n" . "<input type=\"hidden\" name=\"lot\" value=\"{$lot}\">\n" . "<input type=\"hidden\" name=\"world\" value=\"{$world}\">\n" . "<input type=\"hidden\" name=\"step\" value=\"5\">\n"; } else { $out .= "Please <strong>login to the server</strong> now with your minecraft client at <strong>uncovery.me</strong> and then press " . "<input type=\"hidden\" name=\"world\" value=\"{$world}\">\n" . "<input type=\"submit\" name=\"action\" value=\"Continue\">\n" . "<input type=\"hidden\" name=\"lot\" value=\"{$lot}\">\n" . "<input type=\"hidden\" name=\"step\" value=\"5\">\n"; } break; case 5: umc_log('settler_test', 'step_5', "{$player} is at step 5"); $out .= "<form action=\"{$UMC_DOMAIN}/server-access/buildingrights/\" method=\"post\">\n" . "<h1>Step 6: Get to the {$world} world</h1>"; // check if the player is actually in the portal house // player is not in portal house if ($player_world != 'city' || $x > 953 || $x < 938 || $z < -814 || $z > -793) { $out .= "You need to be in the portal house to continue. Please type <strong>/warp spawn</strong> again to get there. " . "It should look like this inside:<br><img src=\"/websend/portals.png\"> Once you see this, press\n" . "<input type=\"submit\" name=\"Next\" value=\"Next\">\n" . "<input type=\"hidden\" name=\"lot\" value=\"{$lot}\">\n" . "<input type=\"hidden\" name=\"world\" value=\"{$world}\">\n" . "<input type=\"hidden\" name=\"step\" value=\"5\">\n"; } else { $out .= "Since you chose a lot in the {$world} world, you need to go through the {$world} portal. " . "It looks like this: Notice the name of the world is written on the sign." . "<img src=\"/websend/{$world}_portal.png\">" . "Please step through and press " . "<input type=\"submit\" name=\"Next\" value=\"Next\">\n" . "<input type=\"hidden\" name=\"lot\" value=\"{$lot}\">\n" . "<input type=\"hidden\" name=\"world\" value=\"{$world}\">\n" . "<input type=\"hidden\" name=\"step\" value=\"6\">\n"; } break; case 6: umc_log('settler_test', 'step_6', "{$player} is at step 6"); $spawn_lot = strtoupper($UMC_SETTING['world_data'][$world]['spawn']); $lower_lot = strtolower($lot); $lot_sql = "SELECT region_cuboid.region_id AS lot, sqrt(pow(max_x,2)+pow(max_z,2)) AS distance, max_x, max_z\r\n FROM minecraft_worldguard.world\r\n LEFT JOIN minecraft_worldguard.region_cuboid ON world.id=region_cuboid.world_id\r\n WHERE region_cuboid.region_id='{$lower_lot}';"; $D = umc_mysql_fetch_all($lot_sql); $lot_data = $D[0]; // north/south difference if ($lot_data['max_x'] < 0) { $direction1 = "north"; } else { if ($lot_data['max_x'] >= 0) { $direction1 = "south"; } } // north/south difference if ($lot_data['max_z'] < 0) { $direction2 = "west"; } else { if ($lot_data['max_z'] >= 0) { $direction2 = "east"; } } $out .= "<form action=\"{$UMC_DOMAIN}/admin/index.php?function=create_map&world={$world}&freeonly=true\" method=\"post\">\n" . "<h1>Step 7: Getting to lot {$lot} in the {$world} world</h1>" . "Getting to your world is easy! You are now at the center of the {$world} world." . "Your lot is <strong>{$direction1}/{$direction2}</strong> from spawn! <br>" . "You can find out which direction you are looking with the <strong>/compass</strong> command.<br>" . "As a Guest level player, you cannot be killed by mobs until you finished this here.<br>" . "So you have to leave the spawn lot either through the {$direction1} or the {$direction2} exit.<br>" . "To know where you are, you can follow your icon {$user_icon} on the map while you get around.<br>" . "Please click NEXT to open the map, there you find your icon click the button next to it!<br><br>" . "<input type=\"submit\" name=\"next\" value=\"Next\">\n" . "<input type=\"hidden\" name=\"track_player\" value=\"{$player}\">\n" . "<input type=\"hidden\" name=\"world\" value=\"{$world}\">\n" . "<input type=\"hidden\" name=\"lot\" value=\"{$lot}\">\n"; $x = $loc[$player]['x']; $z = $loc[$player]['z']; break; case 7: umc_log('settler_test', 'step_7', "{$player} is at step 7"); // whereami $out .= "<h1>Step 8: Find out where you are in-game</h1>" . "<form action=\"{$UMC_DOMAIN}/server-access/buildingrights/\" method=\"post\">\n" . "Now that you know how to find yourself on the map, you need to find out where you are when in-game.<br>" . "The command to find your location in-game is called <strong>/whereami</strong>.<br>" . "Please go into the game and type <strong>/whereami</strong><br>" . "You will see something like this:<br>" . "<img src=\"/websend/whereami.png\"><br>" . "In this example, you can see the Lot (in the first line) is <img src=\"/websend/whereami_detail.png\"> So you would enter 'emp_z7'.<br>" . "Please go now into the game, type <strong>/whereami</strong>, and enter the information here:<br>" . "I am now in lot <input type=\"text\" name=\"check_lot\" value=\"\" size=\"7\"> and then press " . "<input type=\"submit\" name=\"next\" value=\"Next\">\n" . "<input type=\"hidden\" name=\"step\" value=\"8\">\n" . "<input type=\"hidden\" name=\"world\" value=\"{$world}\">\n" . "<input type=\"hidden\" name=\"lot\" value=\"{$lot}\">\n"; // enter which lot you are in right now break; case 8: // walk to your lot umc_log('settler_test', 'step_8', "{$player} is at step 8"); $lower_lot = strtolower($lot); $out .= "<form action=\"{$UMC_DOMAIN}/admin/index.php\" method=\"post\">\n" . "<h1>Step 9: Walk to your lot {$lot}!</h1>" . "Now you have everything you need to get to your lot!<br>You should follow your steps on the 2D map.<br>" . "You can either walk there, or use the command <pre>/lot warp {$lot}</pre> to get there. Please note that this command is only available while you are Guest.<br>" . "Press 'Next' to open the 2D map and follow your icon to lot {$lot}!<br>" . "<input type=\"submit\" name=\"next\" value=\"Next\">\n" . "<input type=\"hidden\" name=\"guide_lot\" value=\"{$player}\">\n" . "<input type=\"hidden\" name=\"world\" value=\"{$world}\">\n" . "<input type=\"hidden\" name=\"freeonly\" value=\"true\">\n" . "<input type=\"hidden\" name=\"function\" value=\"create_map\">\n" . "<input type=\"hidden\" name=\"step\" value=\"9\">\n" . "<input type=\"hidden\" name=\"world\" value=\"{$world}\">\n" . "<input type=\"hidden\" name=\"lot\" value=\"{$lower_lot}\">\n"; break; case 9: umc_log('settler_test', 'step_9', "{$player} is at step 9"); // do you like it? claim it $out .= "<h1>Step 10: Do you like the lot {$s_post['lot']}?</h1>" . "<form action=\"{$UMC_DOMAIN}/server-access/buildingrights/\" method=\"post\">\n" . '<input type="radio" name="step" value="10" checked>Yes! I take it! I will type <strong>/homes buy ' . $world . '</strong> now so I can warp back here!<br>' . '<input type="radio" name="step" value="1">No,I would like to start over!<br>' . "<input type=\"hidden\" name=\"lot\" value=\"{$lot}\">\n" . "<input type=\"hidden\" name=\"world\" value=\"{$world}\">\n" . "<input type=\"submit\" name=\"next\" value=\"Finish!\">\n"; break; case 10: umc_log('settler_test', 'step_10', "{$player} is at step 10"); // final confirmation $out .= "<h1>Step 11: Congratulations!</h1>" . "You have been promoted to Settler!<br>"; if ($userlevel == 'Guest') { $cmd = "pex promote {$UMC_USER['uuid']}"; umc_exec_command($cmd); // update UUID database $sql = "UPDATE minecraft_srvr.UUID SET userlevel='Settler' WHERE UUID='{$UMC_USER['uuid']}';"; umc_mysql_query($sql); umc_exec_command('pex reload'); umc_exec_command("ch qm u Congrats {$player} for becoming Settler!"); XMPP_ERROR_send_msg("{$userlevel} {$player} got promoted with command " . $cmd); umc_log('settler_test', 'promotion', "{$player} ({$UMC_USER['uuid']})was promoted to settler (new test)"); $headers = "From: minecraft@uncovery.me\r\n" . "Reply-To: minecraft@uncovery.me\r\n" . 'X-Mailer: PHP/' . phpversion(); $subject = "[Uncovery Minecraft] Settler applicaton"; $mailtext = "The user: {$player} (email: {$email}) was promoted to Settler and got lot {$lot}.\n\n"; $check = mail('*****@*****.**', $subject, $mailtext, $headers); if (!$check) { XMPP_ERROR_trigger("The settler promotion email could not be sent!"); } // check userlevel to make sure $new_level = umc_get_userlevel($player); if ($new_level != 'Settler') { XMPP_ERROR_trigger("{$userlevel} {$player} did NOT got promoted with command " . $cmd . " he's still {$new_level}"); } } else { $out .= "Thanks for taking this test! Since you are {$userlevel} already, we will not promote you to Settler.<br>"; } // try to assign the lot $check = umc_lot_manager_check_before_assign($uuid, $lot); $out .= "Trying to assign this lot to you: <strong>{$check['text']}</strong><br>"; if ($check['result'] == false) { XMPP_ERROR_send_msg("Settler Test lot assignment failed!"); $out .= "There was an error giving the lot you reserved to you. You can get any other through your <a hreaf=\"{$UMC_DOMAIN}/server-access/lot-manager/\">lot manager</a>!<br>"; } else { umc_lot_add_player($uuid, $lot, 1, $check['cost']); $out .= $check['text']; } break; default: $out .= "This option was not recognized, please reload the page!"; } $out .= "</form>\n"; return $out; }
function umc_restore_from_backup() { XMPP_ERROR_trace(__FUNCTION__, func_get_args()); global $UMC_PATH_MC; // king_s11_b, king_r11_a, king_r11_b, king_q11_a, king_q11_b, king_p11_a, king_p11_b, king_o11_a, king_o11_b, king_n11_a, king_n11_b, and king_n12_c. // emp_k7, emp_j7, king_h21_a, king_h22, king_h22_c, king_g22, king_h22_a, king h22_b, king_g22_a, king_h23, king_h23_c, and king_g23. $lots = array('king_s9' => 'f1', 'king_s9_b' => 'f1', 'king_s9_c' => 'f1', 'king_s8_a' => 'f1', 'king_s8_b' => 'f1', 'king_s8_c' => 'f1', 'king_s10_b' => 'f1', 'king_s10_c' => 'f1', 'king_s11_b' => 'f1', 'king_s11_c' => 'f1', 'king_r9' => 'f1', 'king_r9_a' => 'f1', 'king_r8_a' => 'f1', 'king_r8_b' => 'f1', 'king_r11_b' => 'f1', 'king_r15_b' => 'psychodrea', 'king_r11_a' => 'f1', 'king_r10' => 'f1', 'king_q16' => 'psychodrea', 'king_q15' => 'psychodrea', 'king_q15_a' => 'psychodrea', 'king_q14_a' => 'psychodrea', 'king_q14' => 'psychodrea', 'king_q11_a' => 'f1', 'king_q11_b' => 'f1', 'king_p13' => 'butifuldzastr', 'king_p11_a' => 'f1', 'king_p11_b' => 'f1', 'king_n11_b' => 'f1', 'king_n12_c' => 'f1', 'king_o11_a' => 'f1', 'king_o11_b' => 'f1', 'king_i22_c' => 'chenoa', 'king_n11_a' => 'f1', 'king_h23' => 'chenoa', 'king_h23_c' => 'chenoa', 'king_h22_c' => 'chenoa', 'king_h22' => 'chenoa', 'king_h22_a' => 'chenoa', 'king_h22_b' => 'chenoa', 'king_g23' => 'chenoa', 'king_h21_a' => 'chenoa', 'king_g22' => 'chenoa', 'king_g22_a' => 'chenoa', 'emp_x9' => 'patpat2211', 'emp_w17' => 'dueldragonoid', 'emp_w9' => 'patpat2211', 'emp_x10' => 'patpat2211', 'emp_v19' => 'dueldragonoid', 'emp_w10' => 'patpat2211', 'emp_t8' => 'silver82', 'emp_u7' => 'silver82', 'emp_u8' => 'silver82', 'emp_q6' => 'azjaguar', 'emp_q7' => 'azjaguar', 'emp_t7' => 'silver82', 'emp_q11' => 'doriryo92', 'emp_q20' => 'cyanlaser121', 'emp_p7' => 'azjaguar', 'emp_o4' => 'nerfherd315', 'emp_p6' => 'mrturtl3_97', 'emp_m22' => 'psychodrea', 'emp_m23' => 'psychodrea', 'emp_n22' => 'psychodrea', 'emp_n23' => 'psychodrea', 'emp_j7' => 'chenoa', 'emp_k7' => 'chenoa', 'emp_m20' => 'zataros', 'emp_i17' => 'f1', 'emp_j17' => 'bissellc', 'emp_h17' => 'f1', 'emp_ac6' => 'pilotrange', 'emp_f15' => 'pilotrange', 'emp_aa18' => 'butifuldzastr', 'emp_ab21' => 'masetrix', 'block_g7' => 'zataros', 'block_g9' => 'psychodrea', 'aet_g8' => 'nerfherd315', 'aet_j12' => 'mattdholloway', 'aet_f11' => 'f1', 'aet_d6' => 'azjaguar', 'aet_a12' => 'psychodrea', 'aet_a5' => 'dueldragonoid', 'emp_g27' => 'uncovery'); $source_folder = "/disk2/tmp/minecraft/server/worlds/save/"; $dest_folder = "{$UMC_PATH_MC}/server/bukkit/"; foreach ($lots as $lot => $owner) { echo "processing lot {$lot}\n"; umc_lot_add_player($owner, $lot, 1); $world = umc_get_lot_world($lot); if (!$world) { die("World of lot {$lot} could not be found!"); } //echo "Restoring with $lot, $source_folder . $world, $lot, $dest_folder . $world"; umc_move_chunks($lot, $source_folder . $world, $lot, $dest_folder . $world, true); } }
function umc_lot_addrem() { global $UMC_USER; $player = $UMC_USER['username']; $args = $UMC_USER['args']; /// /lotmember lot world add target if (count($args) <= 3) { umc_echo("{red}Not enough arguments given"); umc_show_help($args); return; } $addrem = $args[1]; $lot = strtolower($args[2]); $action = $args[3]; $worlds = array('emp' => 'empire', 'fla' => 'flatlands', 'dar' => 'darklands', 'aet' => 'aether', 'kin' => 'kingdom', 'dra' => 'draftlands', 'blo' => 'skyblock', 'con' => 'aether'); $world_abr = substr($lot, 0, 3); if (!isset($worlds[$world_abr])) { umc_error("Your used an invalid lot name!"); } $world = $worlds[$world_abr]; if ($player == '@Console') { $player = 'uncovery'; } $user_id = umc_get_worldguard_id('user', strtolower($player)); if (!$user_id) { umc_error("Your user id cannot be found!"); } $player_group = umc_get_userlevel($player); $world_id = umc_get_worldguard_id('world', $world); if (!$world_id) { umc_show_help($args); umc_error("The lot '{$lot}' cannot be found in any world!"); } if (!umc_check_lot_exists($world_id, $lot)) { umc_show_help($args); umc_error("There is no lot {$lot} in world {$world}!"); } if ($action == 'snow' || $action == 'ice') { // check if the user has DonatorPlus status. if ($player_group !== 'Owner') { if (!stristr($player_group, 'DonatorPlus')) { umc_error("You need to be DonatorPlus level to use the snow/ice features!;"); } $owner_switch = 0; // check if player is Owner of lot $sql = "SELECT * FROM minecraft_worldguard.region_players WHERE region_id='{$lot}' AND world_id={$world_id} AND user_id={$user_id} and Owner=1;"; $D = umc_mysql_fetch_all($sql); $num = count($D); if ($num != 1) { umc_error("It appears you {$player} ({$user_id}) are not Owner of lot {$lot} in world {$world}!"); } } // get the current status of the flags if ($addrem == 'add') { $flag = 'allow'; umc_echo("Allowing {$action} forming on lot {$lot}... "); } else { if ($addrem == 'rem') { $flag = 'deny'; umc_echo("Preventing {$action} forming on lot {$lot}... "); } else { umc_show_help($args); } } if ($action == 'snow') { $flagname = 'snow-fall'; } else { if ($action == 'ice') { $flagname = 'ice-form'; } } // does flag exist? $check_sql = "SELECT * FROM minecraft_worldguard.region_flag WHERE region_id='{$lot}' AND world_id={$world_id} AND flag='{$flagname}';"; $D2 = umc_mysql_fetch_all($check_sql); $count = count($D2); if ($count == 0) { // insert $ins_sql = "INSERT INTO minecraft_worldguard.region_flag (region_id, world_id, flag, value) VALUES ('{$lot}', {$world_id}, '{$flagname}', '{$flag}');"; umc_mysql_query($ins_sql, true); } else { // update $upd_sql = "UPDATE minecraft_worldguard.region_flag SET value='{$flag}' WHERE region_id='{$lot}' AND world_id={$world_id} AND flag='{$flagname}';"; umc_mysql_query($upd_sql, true); } umc_echo("done!"); umc_log('lot', 'addrem', "{$player} changed {$action} property of {$lot}"); } else { if ($action == 'owner' || $action == 'give') { if ($player != 'uncovery' && $player != '@Console') { umc_error("Nice try, {$player}. Think I am stupid? Want to get banned?"); } $owner_switch = 1; } else { if ($action == 'member') { $user_id = umc_get_worldguard_id('user', strtolower($player)); if (!$user_id && $player !== 'uncovery') { umc_error("Your user id cannot be found!"); } $owner_switch = 0; // check if player is Owner of lot if ($player_group !== 'Owner') { $sql = "SELECT * FROM minecraft_worldguard.region_players WHERE region_id='{$lot}' AND world_id={$world_id} AND user_id={$user_id} and Owner=1;"; $D3 = umc_mysql_fetch_all($sql); $count = count($D3); if ($count != 1) { umc_error("It appears you ({$player} {$user_id}) are not Owner of lot {$lot} in world {$world}!"); } } } else { umc_echo("Action {$action} not recognized!"); umc_show_help($args); return; } } // get list of active users $active_users = umc_get_active_members(); for ($i = 4; $i < count($args); $i++) { $target = strtolower($args[$i]); // check if target player exists $target_id = umc_get_worldguard_id('user', strtolower($target)); if (!$target_id) { umc_error("The user {$target} does not exist in the database. Please check spelling of username"); } if ($player != 'uncovery') { $targ_group = umc_get_userlevel($target); if ($targ_group == 'Guest') { umc_error("You cannnot add Guests to your lot!;"); } else { if (!in_array($target, $active_users)) { XMPP_ERROR_trigger("{$player} tried to add {$target} to his lot {$lot}, but {$target} is not an active member!"); umc_error("{$target} is not an active user! You can only add people who have their own lot! See FAQ entry #32 please."); } } } // add / remove target player from lot if ($addrem == 'add') { // make sure target is not already there $sql = "SELECT * FROM minecraft_worldguard.region_players WHERE region_id='{$lot}' AND world_id={$world_id} AND user_id={$target_id};"; $D3 = umc_mysql_fetch_all($sql); $num = count($D3); if ($num == 1) { umc_error("It appears {$target} is already member of lot {$lot} in world {$world}!"); } // add to the lot umc_lot_add_player($target, $lot, 0); umc_echo("Added {$target} to {$lot} in the {$world}!"); } else { if ($addrem == 'rem') { // check if target is there at all $sql = "SELECT * FROM minecraft_worldguard.region_players WHERE region_id='{$lot}' AND world_id={$world_id} AND user_id={$target_id} AND Owner={$owner_switch} LIMIT 1;"; $D3 = umc_mysql_fetch_all($sql); $num = count($D3); if ($num !== 1) { umc_error("It appears user {$target} is not a member of lot {$lot} in world {$world}!"); } umc_lot_rem_player($target, $lot, 0); umc_echo("Removed {$target} from {$lot} in the {$world}!"); } else { if ($addrem == 'give') { // remove all members and owners umc_lot_remove_all($lot); umc_lot_add_player($target, $lot, 1); umc_echo("Gave {$lot} to {$target} in the {$world}! All other user removed!"); // logfile entry umc_log('lot', 'addrem', "{$player} gave lot to {$target}"); } else { umc_show_help($args); } } } } } umc_ws_cmd("region load -w {$world}", 'asConsole'); }