Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple entries with same key: a=ChannelModeHandler(mode=a) and a=ChannelModeHandler(mode=a) #240

Closed
webgori opened this issue May 9, 2015 · 3 comments

Comments

@webgori
Copy link

webgori commented May 9, 2015

    <dependency>
        <groupId>org.pircbotx</groupId>
        <artifactId>pircbotx</artifactId>
        <version>2.1-SNAPSHOT</version>
    </dependency>

<repositories>
    <repository>
        <id>sonatype-nexus-snapshots</id>
        <name>Sonatype Nexus Snapshots</name>
        <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        <releases>
            <enabled>false</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>

package meltyway.kr.Bot_MW;

import org.pircbotx.Configuration;
import org.pircbotx.MultiBotManager;
import org.pircbotx.PircBotX;
import org.pircbotx.hooks.ListenerAdapter;
import org.pircbotx.hooks.types.GenericMessageEvent;

public class BotMW extends ListenerAdapter {
        @Override
        public void onGenericMessage(GenericMessageEvent event) {
        Configuration.Builder templateConfig = new Configuration.Builder()
            .setName("Bot-MW")
            .setRealName("Bot-MW")
            .setLogin("Bot-MW")
            .addAutoJoinChannel("#webgori")
            .setAutoNickChange(true);

    MultiBotManager manager = new MultiBotManager();
    manager.addBot(templateConfig.buildForServer("irc.luatic.net", 7778));
    manager.addBot(templateConfig.buildForServer("irc.mizuumi.net", 6667));
    manager.start();
        }
}
Exception in thread "main" java.lang.IllegalArgumentException: Multiple entries with same key: a=ChannelModeHandler(mode=a) and a=ChannelModeHandler(mode=a)
    at com.google.common.collect.ImmutableMap.checkNoConflict(ImmutableMap.java:150)
    at com.google.common.collect.ImmutableSortedMap.validateEntries(ImmutableSortedMap.java:300)
    at com.google.common.collect.ImmutableSortedMap.fromEntries(ImmutableSortedMap.java:286)
    at com.google.common.collect.ImmutableSortedMap$Builder.build(ImmutableSortedMap.java:408)
    at org.pircbotx.Configuration.<init>(Configuration.java:218)
    at org.pircbotx.Configuration$Builder.buildConfiguration(Configuration.java:776)
    at org.pircbotx.Configuration$Builder.buildForServer(Configuration.java:800)
    at meltyway.kr.Bot_MW.BotMW.main(BotMW.java:59)

what happand!

@Cypherke
Copy link
Member

Cypherke commented May 18, 2015

This code doesn't make any sense. You 're creating a bot whenever a GenericMessageEvent gets triggered, which is... a lot.

@TheLQ
Copy link
Member

TheLQ commented Jul 3, 2015

Is this still an issue?

TheLQ added a commit that referenced this issue Jul 12, 2015
@TheLQ
Copy link
Member

TheLQ commented Jul 12, 2015

Fixed in f175b4c . Thanks for the bug report

@TheLQ TheLQ closed this as completed Jul 12, 2015
@TheLQ TheLQ added this to the 2.1 milestone Jul 12, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants