CodeCrafter47 / BungeeTabListPlus

GNU General Public License v3.0
147 stars 70 forks source link

LuckPerms getPrimaryGroup #368

Open Yann151924 opened 6 years ago

Yann151924 commented 6 years ago

Hello , i have this error when the tablist want to check the primarygroup of a player and this spam the console :

[01:26:52] [pool-2-thread-6/ERROR]: Unexpected exception
java.lang.ClassCastException: me.lucko.luckperms.sponge.service.reference.CachedSubjectReference cannot be cast to org.spongepowered.api.service.permission.Subject
    at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174) ~[?:1.8.0_171]
    at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958) ~[?:1.8.0_171]
    at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126) ~[?:1.8.0_171]
    at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498) ~[?:1.8.0_171]
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485) ~[?:1.8.0_171]
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[?:1.8.0_171]
    at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152) ~[?:1.8.0_171]
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:1.8.0_171]
    at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464) ~[?:1.8.0_171]
    at de.codecrafter47.data.sponge.sponge5.Sponge5.getPrimaryGroup(Sponge5.java:26) ~[Sponge5.class:?]
    at de.codecrafter47.data.api.AbstractDataAccess.lambda$addProvider$0(AbstractDataAccess.java:30) ~[AbstractDataAccess.class:?]
    at de.codecrafter47.data.api.AbstractDataAccess.get(AbstractDataAccess.java:44) ~[AbstractDataAccess.class:?]
    at de.codecrafter47.data.sponge.AbstractSpongeDataAccess.get(AbstractSpongeDataAccess.java:35) ~[AbstractSpongeDataAccess.class:?]
    at de.codecrafter47.data.api.JoinedDataAccess.get(JoinedDataAccess.java:40) ~[JoinedDataAccess.class:?]
    at de.codecrafter47.bungeetablistplus.bridge.AbstractBridge.updatePlayerData(AbstractBridge.java:369) ~[AbstractBridge.class:?]
    at de.codecrafter47.bungeetablistplus.bridge.AbstractBridge.updateData(AbstractBridge.java:304) ~[AbstractBridge.class:?]
    at codecrafter47.bungeetablistplus.spongebridge.SpongePlugin.lambda$onServerStart$3(SpongePlugin.java:146) ~[SpongePlugin.class:?]
    at org.spongepowered.api.scheduler.Task$Builder.lambda$execute$0(Task.java:139) ~[Task$Builder.class:1.12.2-2705-7.1.0-BETA-3206]
    at org.spongepowered.common.scheduler.SchedulerBase.lambda$startTask$0(SchedulerBase.java:186) ~[SchedulerBase.class:1.12.2-2705-7.1.0-BETA-3206]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_171]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_171]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_171]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_171]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_171]

If it's logic the prob come from this i think : at de.codecrafter47.data.sponge.sponge5.Sponge5.getPrimaryGroup(Sponge5.java:26) ~[Sponge5.class:?]

Version :

CodeCrafter47 commented 6 years ago

Which version of BungeeTabListPlus_SpongeBridge are you using? If it's an old version (e.g. from last year) the issue can probably be fixed by updating to the latest version.

Yann151924 commented 6 years ago

I use the latest release 2.8.4.

CodeCrafter47 commented 6 years ago

I just tested these versions and it works just fine. Can you use the /sponge plugins bungeetablistplus command and see whether you get the desired output:

> sponge plugins bungeetablistplus 
[13:41:02] [Server thread/INFO] [minecraft/DedicatedServer]: BungeeTabListPlus-SpongeBridge v2.8.4
    ID: bungeetablistplus
    Main class: codecrafter47.bungeetablistplus.spongebridge.SpongePlugin
Yann151924 commented 6 years ago

I re-tested with the last version 2.8.8 but i have the same error, i don't know if the prob come from this :

        if (!classExists("org.spongepowered.api.service.permission.SubjectReference")) {
            addProvider(MinecraftData.Permissions_PermissionGroup, Sponge5::getPrimaryGroup);
        } else {
            addProvider(MinecraftData.Permissions_PermissionGroup, Sponge7::getPrimaryGroup);
        }

In your data library you check if the class exist but the class exist in sponge7, so the plugin use the sponge5 which cause the spam i think.

CodeCrafter47 commented 6 years ago

That code has been replaced with an actual version check a long time ago: https://github.com/CodeCrafter47/minecraft-data-api/commit/24f707e6a84b1f0e74b5e5ab3db5b8e215e6c464. The fix is present in version 2.8.8 of the SpongeBridge.

Yann151924 commented 6 years ago

Woops my bad, so i don't know where the prob is, but it seems the plugin want to use the sponge5 class :(