KP56 / Fake-Players-Spigot-Plugin

A simple bot spawning tool.
MIT License
23 stars 19 forks source link

Multiple errors on summon fake player #2

Closed SlimeDog closed 3 years ago

SlimeDog commented 3 years ago

Spigot or Paper 1.16.5 FakePlayers 1.4

Executed FakePlayers summon B from the console. This produced many errors from interactions with other plugins, including

Many of these have to do with the plugins trying to obtain information (sometimes from Vault) about the fake player, who has been assigned a UUID (in this case, c132c49c-385e-4d28-87a3-7a72f101a4cd) that does not exist IRL, so produces NPEs for player name. Probably, FakePlayers needs to intercept player lookups, to provide the fake name in response to the fake UUID. (It would be very bad to use an IRL UUID, although it is unclear how that can be avoided, since more will be randomly assigned in future.)

On our servers, a new player has to do -- at a minimum -- the following:

I have removed the stack traces for brevity. They can be provided on request.

[09:19:09 INFO]: [ViaVersionStatus] B is using version UNKNOWN(-1).

[09:19:09 ERROR]: Could not pass event ProcessPlayerEvent to WorldGuard v7.0.5-SNAPSHOT+2109-de22a5c
com.google.common.util.concurrent.UncheckedExecutionException: me.lucko.luckperms.bukkit.vault.ServerThreadLookupException: A Vault API request has been made on the main server thread that LuckPerms cannot safely respond to.
This is NOT a bug - please do not report it to LuckPerms.
Instead, please carefully read the information given below.

LuckPerms cannot respond to the request because to do so:
- it needs to lookup user data for 'c132c49c-385e-4d28-87a3-7a72f101a4cd' (an offline player) from the database

Performing this lookup on the main server thread would cause your server to lag.
There are two solutions to this problem:
  a) Ask the author of the plugin making the request to perform Vault calls for
     offline players "asynchronously" (using the scheduler). Additionally, prefer
     using the methods that accept 'Player' or 'OfflinePlayer' instead of usernames.
     You should be able to identify the plugin making the request in the trace below.
  b) As a server admin, you can disable this exception by setting 'vault-unsafe-lookups'
     to true in the LuckPerms configuration file. However, please use this only as
     a last resort.

[09:19:09 INFO]: [Essentials] Found player B by UUID c132c49c-385e-4d28-87a3-7a72f101a4cd but not by their actual name. They may have changed their username.

[09:19:09 INFO]: [LP] A user for B could not be found.

[09:19:09 ERROR]: [Plan] Ran into NullPointerException - logged to plugins/Plan/logs/NullPointerException-7ecbea1b67.txt

[09:19:09 INFO]: Fake Players » Successfully summoned a Fake Player.

[09:19:09 ERROR]: Could not pass event PlayerTeleportEvent to WorldGuard v7.0.5-SNAPSHOT+2109-de22a5c
com.google.common.util.concurrent.UncheckedExecutionException:

[09:19:09 WARN]: [Essentials] Task #58838 for Essentials v2.19.0-dev+103-195148a generated an exception
me.lucko.luckperms.bukkit.vault.ServerThreadLookupException: A Vault API request has been made on the main server thread that LuckPerms cannot safely respond to.
This is NOT a bug - please do not report it to LuckPerms.
Instead, please carefully read the information given below.

LuckPerms cannot respond to the request because to do so:
- it needs to lookup user data for 'c132c49c-385e-4d28-87a3-7a72f101a4cd' (an offline player) from the database

[09:19:09 INFO]: B lost connection: Sorry, you must enable the BlackDog resourcepacks
Edit the configuration for the server and try again

[09:19:09 FATAL]: Error executing task on Server
java.lang.NullPointerException: null
        at net.minecraft.server.v1_16_R3.NetworkManager.handleDisconnection(NetworkManager.java:529) ~[patched_1.16.5.jar:git-Paper-592]
        at com.denizenscript.denizen.nms.v1_16.impl.network.handlers.DenizenNetworkManagerImpl.handleDisconnection(DenizenNetworkManagerImpl.java:978) ~[?:?]

[09:19:10 WARN]: [ItemJoin] Task #60060 for ItemJoin v5.2.2-SNAPSHOT-b700 generated an exception
java.lang.NullPointerException: null
KP56 commented 3 years ago

I have managed to find a way around. LuckPerms had the same issue with Citizens and to fix that, they made it so if uuid's version() is equal to 2, the plugin treats a player as it is an npc.

KP56 commented 3 years ago

After looking deeper, I have realized that this issue is actually related to me not calling PlayerPreLoginEvent, when creating bots.

SlimeDog commented 3 years ago

Thanks. It is standard practice (not universally observed, unfortunately) to leave a ticket open until the fix has been incorporated into a release. Extra credit for remaining open until the fix is verified by the reporter. The fix(es) for this issue aren't even in the public codebase.

KP56 commented 3 years ago

Ok, thank you. As you said, it is my first plugin and I still don't know this kind of stuff.

SlimeDog commented 3 years ago

Please reopen (this is an example of why an issue shouldn't be close prematurely).

Much improved. The ProtocolLib- and Vault-related problems seem to be resolved, but errors are still generated on summon. Most of it is probably related to inability to force the resourcepack, but ItemJoin (for example) should not be processed for a fake player, since there is no GUI accessible to them.

Paper 1.16.5-594 FakePlayers 1.5

Plugins producing errors (see below) are

Executed FakePlayers summon B from the console.

[06:38:36 INFO]: [Disease] Loading player B
[06:38:36 INFO]: Fake Players » Successfully summoned a Fake Player.
[06:38:36 INFO]: [Essentials] Creating empty config: /home/ram/MC/plugins/Essentials/userdata/eac9a680-4b22-430f-a9d4-749e99556799.yml
[06:38:36 INFO]: [LP] Set blackdog.visited.world to true for B in context global.
[06:38:36 INFO]: B lost connection: Sorry, you must enable the BlackDog resourcepacks
Edit the configuration for the server and try again
[06:38:36 FATAL]: Error executing task on Server
java.lang.NullPointerException: null
        at net.minecraft.server.v1_16_R3.NetworkManager.handleDisconnection(NetworkManager.java:529) ~[patched_1.16.5.jar:git-Paper-594]
        at com.denizenscript.denizen.nms.v1_16.impl.network.handlers.DenizenNetworkManagerImpl.handleDisconnection(DenizenNetworkManagerImpl.java:978) ~[?:?]
        at net.minecraft.server.v1_16_R3.TickTask.run(SourceFile:18) ~[patched_1.16.5.jar:git-Paper-594]
        at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.executeTask(IAsyncTaskHandler.java:136) ~[patched_1.16.5.jar:git-Paper-594]
        at net.minecraft.server.v1_16_R3.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23) ~[patched_1.16.5.jar:git-Paper-594]
        at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.executeNext(IAsyncTaskHandler.java:109) ~[patched_1.16.5.jar:git-Paper-594]
        at net.minecraft.server.v1_16_R3.MinecraftServer.bb(MinecraftServer.java:1262) ~[patched_1.16.5.jar:git-Paper-594]
        at net.minecraft.server.v1_16_R3.MinecraftServer.executeNext(MinecraftServer.java:1255) ~[patched_1.16.5.jar:git-Paper-594]
        at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.awaitTasks(IAsyncTaskHandler.java:119) ~[patched_1.16.5.jar:git-Paper-594]
        at net.minecraft.server.v1_16_R3.MinecraftServer.a(MinecraftServer.java:1329) ~[patched_1.16.5.jar:git-Paper-594]
        at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1126) ~[patched_1.16.5.jar:git-Paper-594]
        at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:289) ~[patched_1.16.5.jar:git-Paper-594]
        at java.lang.Thread.run(Thread.java:834) [?:?]
[06:38:37 WARN]: [ItemJoin] Task #15867 for ItemJoin v5.2.2-SNAPSHOT-b700 generated an exception
java.lang.NullPointerException: null
        at me.RockinChaos.itemjoin.item.ItemUtilities.lambda$setInvSlots$5(ItemUtilities.java:593) ~[?:?]
        at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftTask.run(CraftTask.java:100) ~[patched_1.16.5.jar:git-Paper-594]
        at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:468) ~[patched_1.16.5.jar:git-Paper-594]
        at net.minecraft.server.v1_16_R3.MinecraftServer.b(MinecraftServer.java:1423) ~[patched_1.16.5.jar:git-Paper-594]
        at net.minecraft.server.v1_16_R3.DedicatedServer.b(DedicatedServer.java:418) ~[patched_1.16.5.jar:git-Paper-594]
        at net.minecraft.server.v1_16_R3.MinecraftServer.a(MinecraftServer.java:1338) ~[patched_1.16.5.jar:git-Paper-594]
        at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1126) ~[patched_1.16.5.jar:git-Paper-594]
        at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:289) ~[patched_1.16.5.jar:git-Paper-594]
        at java.lang.Thread.run(Thread.java:834) [?:?]
[06:38:37 WARN]: [ItemJoin] Task #15868 for ItemJoin v5.2.2-SNAPSHOT-b700 generated an exception
java.lang.NullPointerException: null
        at me.RockinChaos.itemjoin.item.ItemUtilities.lambda$setInvSlots$5(ItemUtilities.java:593) ~[?:?]
        at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftTask.run(CraftTask.java:100) ~[patched_1.16.5.jar:git-Paper-594]
        at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:468) ~[patched_1.16.5.jar:git-Paper-594]
        at net.minecraft.server.v1_16_R3.MinecraftServer.b(MinecraftServer.java:1423) ~[patched_1.16.5.jar:git-Paper-594]
        at net.minecraft.server.v1_16_R3.DedicatedServer.b(DedicatedServer.java:418) ~[patched_1.16.5.jar:git-Paper-594]
        at net.minecraft.server.v1_16_R3.MinecraftServer.a(MinecraftServer.java:1338) ~[patched_1.16.5.jar:git-Paper-594]
        at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1126) ~[patched_1.16.5.jar:git-Paper-594]
        at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:289) ~[patched_1.16.5.jar:git-Paper-594]
        at java.lang.Thread.run(Thread.java:834) [?:?]
SlimeDog commented 3 years ago

If I disable ForceResourcepacks, and summon B again, I get more errors. Some are related to the fact that B has a different UUID than the one already stored by plugins.

SlimeDog commented 3 years ago
> FakePlayers list
[07:14:45 INFO]: Fake Players (2):
[07:14:45 INFO]: B, B