public function ban($reason) { XMPP_ERROR_trace(__CLASS__ . " // " . __FUNCTION__, func_get_args()); global $UMC_USERS; $cmd = "ban {$this->username} {$reason}"; if ($this->context == 'websend') { umc_ws_cmd($cmd, 'asConsole', false, false); $admin = $UMC_USERS['current_user']->username; } else { umc_exec_command($cmd, 'asConsole', false); $admin = 'wordpress'; } $sql = "INSERT INTO minecraft_srvr.`banned_users`(`username`, `reason`, `admin`, `uuid`) VALUES ('{$this->username}','{$reason}', '{$admin}', '{$this->uuid}');"; umc_mysql_query($sql, true); // remove shop inventory umc_shop_cleanout_olduser($this->uuid); // remove from teamspeak umc_ts_clear_rights($this->uuid); $text = "{$admin} banned \${$this->username} ({$this->uuid}) because of {$reason}"; umc_log('mod', 'ban', $text); XMPP_ERROR_send_msg($text); // iterate plugins to check for plugin relared post ban processes }
/** * Do an actual lot reset * * @param type $lot * @param type $a */ function umc_lot_manager_reset_lot($lot, $a) { XMPP_ERROR_trace(__FUNCTION__, func_get_args()); $debug = $a['reason']; // we assume reseting of chunks, unless the dibs owner does not want to $a['reset_chunks'] = true; $reason = $a['reason']; $a['new_owner'] = false; // check dibs if ($a['dibs']) { if (count($a['dibs']) > 1) { $debug .= "Lot {$lot} has more than 1 dibs applicant, aborting! "; return; } $debug .= "Lot {$lot} has dibs! "; // we iterate the people who asked for the lot, and // once we found a valid one, execute the actions // // this can only be done AFTER current owners have been removed // since the check_before_assign fails if the lot is owned by someone umc_lot_remove_all($lot); $a['remove_users'] = false; foreach ($a['dibs'] as $dibs_info) { $dibs_uuid = $dibs_info['uuid']; $debug .= " user {$dibs_uuid}: "; $dibs_check = umc_lot_manager_check_before_assign($dibs_uuid, $lot); XMPP_ERROR_trace('umc_lot_manager_check_before_assign result', $dibs_check); if ($dibs_check['result']) { $debug .= " OK!"; $reason .= "user {$dibs_uuid} had dibs and got the lot"; $a['new_owner'] = $dibs_uuid; $a['new_owner_costs'] = $dibs_check['cost']; if ($dibs_info['action'] == 'none') { $a['reset_chunks'] = false; $reason .= " but dibs owner did not want to reset!"; } break; } else { $debug .= " NOT OK, going for next!"; } umc_lot_manager_dib_delete($dibs_uuid, $lot); XMPP_ERROR_send_msg("{$debug}"); } //echo $debug . "<br>"; } // reset all lots $debug .= "Lot ready for reset!"; $source_lot = $lot; if ($a['user_shop_clean']) { $debug .= " Shop cleanout user " . $a['user_shop_clean'] . ", "; umc_shop_cleanout_olduser($a['user_shop_clean']); // also remove teamspeak priviledges umc_ts_clear_rights($a['user_shop_clean'], false); } if ($a['remove_users']) { $debug .= " Removing all users "; umc_lot_remove_all($lot); } if ($a['reset_to']) { $source_lot = $a['reset_to']; } if ($a['del_skyblock_inv']) { // value is false or the uuid umc_lot_skyblock_inv_reset($a['del_skyblock_inv']); } if ($a['reset_chunks']) { umc_move_chunks($source_lot, $a['source_world'], $lot, $a['dest_world'], false); } umc_log('lot_manager', 'reset', $reason); if ($a['version_sql']) { umc_mysql_query($a['version_sql'], true); } if ($a['new_owner']) { // give lot to dibs owner and charge money umc_lot_add_player($a['new_owner'], $lot, 1, $a['new_owner_costs']); // remove dibs from database // umc_lot_manager_dib_delete($a['new_owner'], $lot); } $debug .= "{$source_lot}, {$a['source_world']}, {$lot}, {$a['dest_world']}"; XMPP_ERROR_trace(__FUNCTION__, $debug); }
/** * Bans a user * can make the difference between UUID and username * can make the difference between websend and wordpress * * @param type $user */ function umc_user_ban($user, $reason) { XMPP_ERROR_trace(__FUNCTION__, func_get_args()); global $UMC_ENV, $UMC_USER; $U = umc_uuid_getboth($user); $uuid = $U['uuid']; $username = $U['username']; $cmd = "ban {$username} {$reason}"; if ($UMC_ENV == 'websend') { umc_ws_cmd($cmd, 'asConsole', false, false); $admin = $UMC_USER['username']; } else { umc_exec_command($cmd, 'asConsole', false); $admin = 'wordpress'; } $sql = "INSERT INTO minecraft_srvr.`banned_users`(`username`, `reason`, `admin`, `uuid`) VALUES ('{$username}','{$reason}', '{$admin}', '{$uuid}');"; umc_mysql_query($sql, true); // remove shop inventory umc_shop_cleanout_olduser($uuid); // remove from teamspeak umc_ts_clear_rights($uuid); umc_wp_ban_user($uuid); umc_log('mod', 'ban', "{$admin} banned {$username}/{$uuid} because of {$reason}"); XMPP_ERROR_send_msg("{$admin} banned {$username} because of {$reason}"); }