Twitch chatbot commands not responding except one using PircBot

I’m currently developing a Twitch chat bot using PircBot, but I’m facing a problem. Only the !track command functions correctly; all other commands do not respond. I’ve carefully reviewed my code, but I still can’t figure out what might be wrong.

Here is my code implementation:

import org.jibble.pircbot.*;
import java.io.*;

public class StreamBot extends PircBot {

    // Retrieve the current song from the specified file
    public String getCurrentTrack() throws Exception {
        FileReader fileReader = new FileReader("C:/Music/current_track.txt");
        BufferedReader buffReader = new BufferedReader(fileReader);
        
        String trackInfo = "";
        String currentLine = buffReader.readLine();
        while (currentLine != null){
            trackInfo += currentLine;
            currentLine = buffReader.readLine();
        }
        
        return trackInfo;
    }

    public StreamBot() {
        this.setName("StreamBot");
    }

    public static String serverIP = "";
    public static String coStreamUser = "";

    public void onMessage(String channel, String sender,
                        String login, String hostname, String message) {

        String broadcaster = "myusername";

        if (message.startsWith("!request")) {
            sendMessage(channel, "Music requests are currently disabled. Use !track to see the current song.");
        }

        if (message.startsWith("!server ")) {
            if(sender.equals(broadcaster)) {
                serverIP = message.split(" ")[1];
                sendMessage(channel, "Server IP has been updated to: " + serverIP);
            } 
        } else {
            if (message.equalsIgnoreCase("!server")){
                sendMessage(channel, "Currently playing on server: " + serverIP);
            }
        }

        if (message.startsWith("!multi ")) {
            if(sender.equals(broadcaster)) {
                coStreamUser = message.split(" ")[1];
            } 
        } else {
            if (message.equalsIgnoreCase("!multi")){
                sendMessage(channel, "Multi-stream link: http://multitwitch.tv/myusername/" + coStreamUser);
            }
        }

        if (message.equalsIgnoreCase("!track")){
            String currentTrack = "";
            try {
                currentTrack = getCurrentTrack();
            } catch (Exception e) { e.printStackTrace(); }
            sendMessage(channel, currentTrack);
        }
    }
}

I’d appreciate any advice on why the other commands aren’t functioning. Thank you!

looks like your if-else logic is messed up. the !server and !multi commands are nested in else blocks that only trigger when the message doesnt start with those commands. try restructuring without the else or use separate if statements for each command