All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.cassite.tofpcap.messages.ChatChannel Maven / Gradle / Ivy

The newest version!
package net.cassite.tofpcap.messages;

public enum ChatChannel {
    WORLD(1),
    TEAM(3),
    GUILD(8),
    COOP(9),
    PRIVATE(16), // TODO i'm not sure about this
    ;

    public final int num;

    ChatChannel(int num) {
        this.num = num;
    }

    public static ChatChannel valueOfOrNull(int channel) {
        if (channel == WORLD.num) return WORLD;
        if (channel == TEAM.num) return TEAM;
        if (channel == GUILD.num) return GUILD;
        if (channel == COOP.num) return COOP;
        if (channel == PRIVATE.num) return PRIVATE;
        return null;
    }

    public static ChatChannel valueOf0(String s) {
        return switch (s) {
            case "WORLD", "world" -> WORLD;
            case "TEAM", "team" -> TEAM;
            case "GUILD", "guild" -> GUILD;
            case "COOP", "coop" -> COOP;
            case "PRIVATE", "private" -> PRIVATE;
            default -> throw new IllegalArgumentException("unknown string for ChatChannel: " + s);
        };
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy