dmulloy2/ChestShop-3

IllegalArgumentException: value already present

Closed this issue · 3 comments

[23:51:01 INFO]: RobiBvB[/x.x.x.x:48954] logged in with entity id 53979496 at ([ASkyBlock_nether]-5615.5, 117.0, -8254.5)
[23:51:01 WARN]: Exception in thread "Craft Scheduler Thread - 262"
[23:51:01 WARN]: org.apache.commons.lang.UnhandledException: Plugin ChestShop v3.8.13 generated an exception while executing task 739443
        at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:56)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: value already present: RobiBvB
        at com.google.common.collect.HashBiMap.putInverse(HashBiMap.java:267)
        at com.google.common.collect.HashBiMap.access$1000(HashBiMap.java:52)
        at com.google.common.collect.HashBiMap$Inverse.put(HashBiMap.java:514)
        at com.Acrobot.ChestShop.UUIDs.NameManager.storeUsername(NameManager.java:208)
        at com.Acrobot.ChestShop.Listeners.Player.PlayerConnect$1.run(PlayerConnect.java:28)
        at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftTask.run(CraftTask.java:59)
        at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:53)
        ... 3 more

Latest TacoSpigot 1.8, latest CS, latest Vault and latest Essentials.

I'm guessing

        if (!usernameToUUID.inverse().containsKey(uuid)) {
            usernameToUUID.remove(player.getName()); // https://github.com/dmulloy2/ChestShop-3/issues/11
            usernameToUUID.inverse().put(uuid, player.getName());
        }

would do the trick.

For this issue, that's the fix.