Skip to content

Make usermap non-player warnings configurable - #5125

Merged
JRoy merged 2 commits into
2.xfrom
debug/limit-non-user-warns
Oct 11, 2022
Merged

Make usermap non-player warnings configurable#5125
JRoy merged 2 commits into
2.xfrom
debug/limit-non-user-warns

Conversation

@mdcfe

@mdcfemdcfe commented Oct 7, 2022

Copy link
Copy Markdown
Member

Information

Adds system properties to control the non-player usermap warnings.

Details

Proposed fix:
-Dnet.essentialsx.usermap.max-warns=N (default: 100) limits how many warnings EssentialsX will print per non-real Player type.

-Dnet.essentialsx.usermap.print-stack=true (default: false) enables printing stack traces with the warning message.

Environments tested:

OS: Windows 11 22H2

Java version: 17.0.4.1+1 (Temurin)

  • Most recent Paper version (1.19.2, git-Paper-196)
  • CraftBukkit/Spigot/Paper 1.12.2
  • CraftBukkit 1.8.8

Demonstration:

[11:29:54 INFO]: [Essentials] Created a User for PaperMC (5ee25fa6-3072-2c3a-b0a4-f08e9b6b350a) for non Bukkit type: net.citizensnpcs.nms.v1_19_R1.entity.EntityHumanNPC$PlayerNPC
java.lang.Throwable: null
at com.earth2me.essentials.userstorage.ModernUserMap.debugLogUncachedNonPlayer(ModernUserMap.java:199) ~[EssentialsX-2.20.0-dev+7-f7cbc7b.jar:?]
at com.earth2me.essentials.userstorage.ModernUserMap.loadUncachedUser(ModernUserMap.java:131) ~[EssentialsX-2.20.0-dev+7-f7cbc7b.jar:?]
at com.earth2me.essentials.Essentials.getUser(Essentials.java:1076) ~[EssentialsX-2.20.0-dev+7-f7cbc7b.jar:?]
at com.earth2me.essentials.EssentialsEntityListener.onEntityDamage(EssentialsEntityListener.java:126) ~[EssentialsX-2.20.0-dev+7-f7cbc7b.jar:?]
at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor78.execute(Unknown Source) ~[?:?]
at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:75) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:git-Paper-196]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:670) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R1.event.CraftEventFactory.callEvent(CraftEventFactory.java:249) ~[paper-1.19.2.jar:git-Paper-196]
at org.bukkit.craftbukkit.v1_19_R1.event.CraftEventFactory.callEntityDamageEvent(CraftEventFactory.java:1142) ~[paper-1.19.2.jar:git-Paper-196]
at org.bukkit.craftbukkit.v1_19_R1.event.CraftEventFactory.handleEntityDamageEvent(CraftEventFactory.java:1001) ~[paper-1.19.2.jar:git-Paper-196]
at org.bukkit.craftbukkit.v1_19_R1.event.CraftEventFactory.handleEntityDamageEvent(CraftEventFactory.java:953) ~[paper-1.19.2.jar:git-Paper-196]
at org.bukkit.craftbukkit.v1_19_R1.event.CraftEventFactory.handleLivingEntityDamageEvent(CraftEventFactory.java:1176) ~[paper-1.19.2.jar:git-Paper-196]
at net.minecraft.world.entity.LivingEntity.damageEntity0(LivingEntity.java:2122) ~[?:?]
at net.minecraft.world.entity.player.Player.damageEntity0(Player.java:1075) ~[?:?]
at net.minecraft.world.entity.LivingEntity.hurt(LivingEntity.java:1369) ~[?:?]
at net.minecraft.world.entity.player.Player.hurt(Player.java:982) ~[?:?]
at net.minecraft.server.level.ServerPlayer.hurt(ServerPlayer.java:1025) ~[?:?]
at net.citizensnpcs.nms.v1_19_R1.entity.EntityHumanNPC.a(EntityHumanNPC.java:292) ~[Citizens-2.0.30-b2705.jar:?]
at net.minecraft.world.entity.player.Player.attack(Player.java:1322) ~[?:?]
at net.minecraft.server.level.ServerPlayer.attack(ServerPlayer.java:2053) ~[?:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl$5.a(ServerGamePacketListenerImpl.java:2983) ~[?:?]
at net.minecraft.network.protocol.game.ServerboundInteractPacket$1.dispatch(ServerboundInteractPacket.java:24) ~[?:?]
at net.minecraft.network.protocol.game.ServerboundInteractPacket.dispatch(ServerboundInteractPacket.java:80) ~[?:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.handleInteract(ServerGamePacketListenerImpl.java:2905) ~[?:?]
at net.minecraft.network.protocol.game.ServerboundInteractPacket.handle(ServerboundInteractPacket.java:67) ~[?:?]
at net.minecraft.network.protocol.game.ServerboundInteractPacket.handle(ServerboundInteractPacket.java:12) ~[?:?]
at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$1(PacketUtils.java:51) ~[?:?]
at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.19.2.jar:git-Paper-196]
at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?]
at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[?:?]
at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1341) ~[paper-1.19.2.jar:git-Paper-196]
at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:185) ~[paper-1.19.2.jar:git-Paper-196]
at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?]
at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1318) ~[paper-1.19.2.jar:git-Paper-196]
at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1311) ~[paper-1.19.2.jar:git-Paper-196]
at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?]
at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1289) ~[paper-1.19.2.jar:git-Paper-196]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1177) ~[paper-1.19.2.jar:git-Paper-196]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:305) ~[paper-1.19.2.jar:git-Paper-196]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
[11:29:54 WARN]: [Essentials] Essentials will not log any more warnings for net.citizensnpcs.nms.v1_19_R1.entity.EntityHumanNPC$PlayerNPC. Please report this to the EssentialsX team.

Adds system properties to control the non-player usermap warnings.
`-Dnet.essentialsx.usermap.max-warns=N` (default: 100) limits how many warnings EssentialsX will print per non-real Player type.
`-Dnet.essentialsx.usermap.print-stack=true` (default: false) enables printing stack traces with the warning message.
@mdcfe
mdcfe requested a review from JRoyOctober 7, 2022 10:35
@mdcfemdcfe added type: enhancement Features and feature requests. type: problem Problems that are not strictly bugs. labels Oct 7, 2022
@mdcfemdcfe added this to the 2.20.0 milestone Oct 7, 2022
@JRoy

JRoy commented Oct 7, 2022

Copy link
Copy Markdown
Member

We should solve the underlying problem here instead of making it configurable, or move them to debug

@JRoyJRoy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment

@JRoy
JRoy enabled auto-merge (squash) October 11, 2022 01:04
@JRoy
JRoy merged commit dc7fb91 into 2.xOct 11, 2022
@JRoy
JRoy deleted the debug/limit-non-user-warns branch October 11, 2022 01:11
ressidell pushed a commit to ressidell/Essentials that referenced this pull request Apr 27, 2025
Co-authored-by: Josh Roy <10731363+JRoy@users.noreply.github.com>
rewsdjad1 pushed a commit to rewsdjad1/EssentialsXPlus that referenced this pull request Aug 13, 2026
Co-authored-by: Josh Roy <10731363+JRoy@users.noreply.github.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: enhancementFeatures and feature requests.type: problemProblems that are not strictly bugs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@mdcfe@JRoy