/** * register the user to the whitelist * ad the uuid to the UUID table * add the UUID to the Meta data in wordpress * * @param type $user_id */ function umc_wp_register_addWhitelist($user_id) { XMPP_ERROR_trace(__FUNCTION__, func_get_args()); $current_user = get_user_by('id', $user_id); $username = $current_user->user_login; require_once '/home/minecraft/server/bin/index_wp.php'; //$check = umc_read_data('whitelist'); // umc_update_data('whitelist', array($username => $username)); umc_exec_command("whitelist add {$username}", 'asConsole', false); // add UUID to use meta $UUID = umc_user2uuid($username); add_user_meta($user_id, 'minecraft_uuid', $UUID); // add user to UUID table umc_uuid_record_usertimes('firstlogin'); }
function umc_ws_eventhandler($event) { global $WS_INIT, $UMC_USER; XMPP_ERROR_trace(__FUNCTION__, func_get_args()); $player = $UMC_USER['username']; // iterate all plugins foreach ($WS_INIT as $data) { // check if there is a setting for the current event if ($data['events'] != false && isset($data['events'][$event])) { // execute function $function = $data['events'][$event]; if (!is_string($function)) { XMPP_ERROR_trigger("plugin eventhandler failed event {$event}"); } // execute the function $function(); } } // non-plugin events switch ($event) { case 'PlayerQuitEvent': umc_log('system', 'logout', "{$player} logged out"); umc_uuid_record_usertimes('lastlogout'); break; case 'PlayerJoinEvent': umc_uuid_check_usernamechange($UMC_USER['uuid']); umc_donation_level($player); umc_promote_citizen($player, false); umc_log('system', 'login', "{$player} logged in"); umc_uuid_record_usertimes('lastlogin'); // check if the user has a skin stored, if not, get it umc_usericon_get($UMC_USER['uuid'], false); break; case 'PlayerPreLoginEvent': // nothing needed since the fact that websend is called makes it register the UUID already break; default: // all the events not covered above // XMPP_ERROR_send_msg("Event $event not assigned to action (umc_ws_eventhandler)"); } }