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

Make usermap non-player warnings configurable #5125

Merged
merged 2 commits into from
Oct 11, 2022
Merged

Conversation

mdcfe
Copy link
Member

@mdcfe mdcfe commented Oct 7, 2022

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 JRoy October 7, 2022 10:35
@mdcfe mdcfe added type: enhancement Features and feature requests. type: problem Problems that are not strictly bugs. labels Oct 7, 2022
@mdcfe mdcfe added this to the 2.20.0 milestone Oct 7, 2022
@JRoy
Copy link
Member

JRoy commented Oct 7, 2022

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

Copy link
Member

@JRoy JRoy left a comment

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.x Oct 11, 2022
@JRoy JRoy deleted the debug/limit-non-user-warns branch October 11, 2022 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Features and feature requests. type: problem Problems that are not strictly bugs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants