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

player.hasPermission() > null pointer #117

Closed
mmonkey opened this issue Aug 2, 2015 · 15 comments
Closed

player.hasPermission() > null pointer #117

mmonkey opened this issue Aug 2, 2015 · 15 comments
Assignees

Comments

@mmonkey
Copy link

mmonkey commented Aug 2, 2015

I get a null pointer error when checking player.hasPermission("warp.admin").

using sponge build 533, forge 1499 in single player.

Also, I am not using a permission plugin of any kind.

@mmonkey mmonkey changed the title player.hasPermission("something.permission") breaks player.hasPermission() > null pointer Aug 2, 2015
@zml2008
Copy link
Member

zml2008 commented Aug 2, 2015

Post the stacktrace...

@mrgoodrich
Copy link

Speaking of which, @zml2008 is it better to post question in a git issue or on the forums? I want to do what is the most convenient for those who will likely answer.

@zml2008
Copy link
Member

zml2008 commented Aug 2, 2015

@mrgoodrich for Sponge bugs, post on GH, especially if you can provide useful corroborating information -- this is where most of us go to look for issues, and what is linked to more people's email, and is more directly connected with actual code changes.

@mmonkey
Copy link
Author

mmonkey commented Aug 2, 2015

[01:05:45] [Server thread/FATAL] [FML/]: Exception caught executing FutureTask: java.util.concurrent.ExecutionException: java.lang.NullPointerException
java.util.concurrent.ExecutionException: java.lang.NullPointerException
    at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_25]
    at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_25]
    at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:715) [FMLCommonHandler.class:?]
    at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:656) [MinecraftServer.class:?]
    at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:598) [MinecraftServer.class:?]
    at net.minecraft.server.integrated.IntegratedServer.func_71217_p(IntegratedServer.java:164) [cyk.class:?]
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:478) [MinecraftServer.class:?]
    at java.lang.Thread.run(Thread.java:745) [?:1.8.0_25]
Caused by: java.lang.NullPointerException
    at net.minecraft.server.management.UserListOps.func_152699_b(SourceFile:39) ~[sp.class:?]
    at net.minecraft.server.management.UserListOps.func_152681_a(SourceFile:9) ~[sp.class:?]
    at net.minecraft.server.management.UserList.func_152683_b(SourceFile:56) ~[ss.class:?]
    at org.spongepowered.common.service.permission.UserSubject.getOpLevel(UserSubject.java:93) ~[UserSubject.class:1.8-1499-2.1DEV-533+unknown-b533.git-unknown]
    at org.spongepowered.common.service.permission.UserSubject$1.getParent(UserSubject.java:55) ~[UserSubject$1.class:1.8-1499-2.1DEV-533+unknown-b533.git-unknown]
    at org.spongepowered.common.service.permission.base.SingleParentMemorySubjectData.getParents(SingleParentMemorySubjectData.java:51) ~[SingleParentMemorySubjectData.class:1.8-1499-2.1DEV-533+unknown-b533.git-unknown]
    at org.spongepowered.common.service.permission.base.SpongeSubject.getDataPermissionValue(SpongeSubject.java:65) ~[SpongeSubject.class:1.8-1499-2.1DEV-533+unknown-b533.git-unknown]
    at org.spongepowered.common.service.permission.base.SpongeSubject.getPermissionValue(SpongeSubject.java:58) ~[SpongeSubject.class:1.8-1499-2.1DEV-533+unknown-b533.git-unknown]
    at org.spongepowered.common.service.permission.UserSubject.getPermissionValue(UserSubject.java:115) ~[UserSubject.class:1.8-1499-2.1DEV-533+unknown-b533.git-unknown]
    at net.minecraft.entity.player.EntityPlayerMP.getPermissionValue(EntityPlayerMP.java:147) ~[qw.class:?]
    at net.minecraft.entity.player.EntityPlayerMP.hasPermission(EntityPlayerMP.java:129) ~[qw.class:?]
    at net.minecraft.entity.player.EntityPlayerMP.hasPermission(EntityPlayerMP.java:141) ~[qw.class:?]
    at org.spongepowered.api.service.command.SimpleCommandService.process(SimpleCommandService.java:279) ~[SimpleCommandService.class:1.8-1499-2.1DEV-533+unknown-b533.git-unknown]
    at net.minecraft.command.ServerCommandManager.func_71556_a(SourceFile:80) ~[cl.class:?]
    at net.minecraft.network.NetHandlerPlayServer.func_147361_d(NetHandlerPlayServer.java:812) ~[rj.class:?]
    at net.minecraft.network.NetHandlerPlayServer.func_147354_a(NetHandlerPlayServer.java:791) ~[rj.class:?]
    at net.minecraft.network.play.client.C01PacketChatMessage.func_180757_a(SourceFile:37) ~[lu.class:?]
    at net.minecraft.network.play.client.C01PacketChatMessage.func_148833_a(SourceFile:9) ~[lu.class:?]
    at net.minecraft.network.PacketThreadUtil$1.run(SourceFile:13) ~[ih.class:?]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_25]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_25]
    at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:714) ~[FMLCommonHandler.class:?]
    ... 5 more

@mmonkey
Copy link
Author

mmonkey commented Aug 2, 2015

I actually get this error when running any command that checks permissions (/time set day)

@zml2008
Copy link
Member

zml2008 commented Aug 2, 2015

Are you running the server in offline mode?

@mmonkey
Copy link
Author

mmonkey commented Aug 2, 2015

no, I am just running in single player worlds. Well, I guess I am not sure if that is flagged as "offline" mode automatically or not.

@zml2008
Copy link
Member

zml2008 commented Aug 2, 2015

is the client running in offline mode? But yeah, this issue has been seen before, and seems to be an issue with game profile resolution clientside -- @simon816 changed that code recently.

@bloodmc
Copy link
Contributor

bloodmc commented Aug 2, 2015

This issue can be caused by 2 things:

  1. Running the client in offline mode which we will not support.
  2. Mojang auth server temporarily blocking your request for GameProfile properties on login. This is what you would see in log
[12:37:02] [pool-4-thread-1/WARN]: Couldn't look up profile properties for com.mojang.authlib.GameProfile@a1d2215[id=uuid,name=UserName,properties={},legacy=false]
com.mojang.authlib.exceptions.AuthenticationException: The client has sent too many requests within a certain amount of time

If this occurs, simply wait a minute and try again to make sure you do not receive this error.

@ST-DDT
Copy link
Member

ST-DDT commented Aug 2, 2015

Is this exception happening client side or server side?
I'm asking because of this:

Running the client in offline mode which we will not support.

Developing and testing plugins is quite hard if you only have one player, i usually use offline mode to allow my test players to connect and interact with the world (and i don't want to buy more accounts just for testing purposes). I don't need real/full offline support, but at least it should not throw an exception everytime i try to do anything. Testing an arena plugin is impossible with just one player.

@JBYoshi
Copy link
Member

JBYoshi commented Aug 2, 2015

@ST-DDT mmonkey said he "was just running in singleplayer worlds". Based on the stack trace, it's on the server thread.

@ST-DDT
Copy link
Member

ST-DDT commented Aug 2, 2015

Okay, I got that from the stack trace as well, but i wasnt sure which one.
I just thought it would affect dedicated servers as well.

@bloodmc
Copy link
Contributor

bloodmc commented Aug 2, 2015

@ST-DDT agreed, I'll look into a fix for testing purposes.

@simon816
Copy link
Contributor

simon816 commented Aug 8, 2015

I think I know what's happening here

It's because forge has used up the request limit for a player's profile. The session service limits to once per UUID per minute.
In fact, forge actually surpasses the limit and suffers The client has sent too many requests within a certain amount of time itself.
Due to the changes in MinecraftForge/MinecraftForge#1832, the game makes a request to fill the game profile, but uses the secure flag, which means the response isn't cached.
Later on (but less than a minute) the SkinManager makes a request, but this fails due to the limit.
Adding sponge to the mix, a third request is also made.
The first request adds the profile as the Minecraft.getMinecraft().getSession() profile.
What I can do is fix forge by using that profile instead (because it's already been filled), and add a special case to sponge in SpongeProfileResolver to use the session profile if on client and if requesting the client's profile.

@JBYoshi
Copy link
Member

JBYoshi commented Sep 9, 2015

I've been looking into this, and I've found it to happen:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants