com.jagrosh.discordipc.exceptions.NoDiscordClientException Java Examples

The following examples show how to use com.jagrosh.discordipc.exceptions.NoDiscordClientException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DiscordHelper.java    From iTunes-Discord-RP with MIT License 5 votes vote down vote up
boolean connect() {
	try {
		client.connect();
	} catch(NoDiscordClientException | RuntimeException e) {
		logger.log(Level.SEVERE, "Something went wrong while trying to connect: {0}", e.getMessage());
		view.showMessage(DISCORD_CONNECTION_ERROR_MESSAGE);
		return false;
	}
	logger.log(Level.INFO, "Client successfully connected.");
	sendCommand(ScriptCommand.EXECUTE);
	return true;
}
 
Example #2
Source File: IPCClient.java    From DiscordIPC with Apache License 2.0 5 votes vote down vote up
/**
 * Opens the connection between the IPCClient and Discord.<p>
 *
 * <b>This must be called before any data is exchanged between the
 * IPCClient and Discord.</b>
 *
 * @param preferredOrder the priority order of client builds to connect to
 *
 * @throws IllegalStateException
 *         There is an open connection on this IPCClient.
 * @throws NoDiscordClientException
 *         No client of the provided {@link DiscordBuild build type}(s) was found.
 */
public void connect(DiscordBuild... preferredOrder) throws NoDiscordClientException
{
    checkConnected(false);
    callbacks.clear();
    pipe = null;

    pipe = Pipe.openPipe(this, clientId, callbacks, preferredOrder);

    LOGGER.debug("Client is now connected and ready!");
    if(listener != null)
        listener.onReady(this);
    startReading();
}