Search in sources :

Example 11 with Response

use of util.Response in project Botnak by Gocnak.

the class SoundEngine method getSoundState.

public Response getSoundState(String name) {
    Response toReturn = new Response();
    if ("".equals(name)) {
        toReturn.setResponseText(getSoundStateString());
        toReturn.wasSuccessful();
    } else {
        if (soundMap.containsKey(name)) {
            Sound toCheck = soundMap.get(name);
            toReturn.setResponseText("The sound \"!" + name + "\" is currently turned " + (toCheck.isEnabled() ? "ON" : "OFF"));
            toReturn.wasSuccessful();
        } else {
            toReturn.setResponseText("The sound \"!" + name + "\" does not exist!");
        }
    }
    return toReturn;
}
Also used : Response(util.Response)

Example 12 with Response

use of util.Response in project Botnak by Gocnak.

the class SoundEngine method setSoundDelay.

public Response setSoundDelay(String first) {
    Response toReturn = new Response();
    if (!"".equals(first)) {
        int soundTime;
        soundTime = Utils.getTime(first);
        if (soundTime < 0) {
            toReturn.setResponseText("Failed to set sound delay; could not parse the given time!");
            return toReturn;
        }
        soundTime = Utils.handleInt(soundTime);
        int delay = soundTime / 1000;
        toReturn.setResponseText("Sound delay " + (delay < 2 ? (delay == 0 ? "off." : "is now 1 second.") : ("is now " + delay + " seconds.")));
        setDelay(soundTime);
        toReturn.wasSuccessful();
    } else {
        toReturn.setResponseText("Failed to set sound delay, usage: !setsound (time)");
    }
    return toReturn;
}
Also used : Response(util.Response)

Example 13 with Response

use of util.Response in project Botnak by Gocnak.

the class SoundEngine method toggleSound.

public Response toggleSound(String name, boolean individualSound) {
    Response toReturn = new Response();
    boolean newBool;
    if (individualSound) {
        if (soundMap.containsKey(name)) {
            Sound s = soundMap.get(name);
            newBool = !s.isEnabled();
            s.setEnabled(newBool);
            toReturn.wasSuccessful();
            toReturn.setResponseText("The sound " + name + " is now turned " + (newBool ? "ON" : "OFF"));
        } else {
            toReturn.setResponseText("Cannot toggle sound; the sound \"" + name + "\" does not exist!");
        }
    } else {
        newBool = !shouldPlay();
        setShouldPlay(newBool);
        GUIMain.instance.updateSoundToggle(newBool);
        toReturn.wasSuccessful();
        toReturn.setResponseText("Sound is now turned " + (newBool ? "ON" : "OFF"));
    }
    return toReturn;
}
Also used : Response(util.Response)

Example 14 with Response

use of util.Response in project Botnak by Gocnak.

the class SoundEngine method removeSound.

public Response removeSound(String name) {
    Response toReturn = new Response();
    if (!"".equals(name)) {
        if (soundMap.containsKey(name)) {
            soundMap.remove(name);
            toReturn.wasSuccessful();
            toReturn.setResponseText("Successfully removed sound \"!" + name + "\" !");
        } else {
            toReturn.setResponseText("Failed to remove sound, the sound \"!" + name + "\" does not exist!");
        }
    } else {
        toReturn.setResponseText("Failed to remove sound, no specified name!");
    }
    return toReturn;
}
Also used : Response(util.Response)

Aggregations

Response (util.Response)14 File (java.io.File)4 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 FaceManager (face.FaceManager)1 BotnakTrayIcon (gui.BotnakTrayIcon)1 ChatPane (gui.ChatPane)1 CombinedChatPane (gui.CombinedChatPane)1 DraggableTabbedPane (gui.DraggableTabbedPane)1 ListenerUserChat (gui.listeners.ListenerUserChat)1 NewTabListener (gui.listeners.NewTabListener)1 IRCBot (irc.IRCBot)1 IRCViewer (irc.IRCViewer)1 Message (irc.message.Message)1 MessageQueue (irc.message.MessageQueue)1 java.awt (java.awt)1 java.awt.event (java.awt.event)1 PrintWriter (java.io.PrintWriter)1 StringWriter (java.io.StringWriter)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1