kangarko / ChatControl-Red

Issue tracker and documentation for the next generation ChatControl Red, the most advanced chat management plugin.
49 stars 23 forks source link

1.21: Player is null in Variable #2793

Closed bobhenl closed 1 month ago

bobhenl commented 1 month ago

Are you using MySQL?

Yes

Are you using a proxy?

Yes - Velocity

"/version ChatControlRed" - plugin version

10.27.8

Optional: Error log

No response

Optional: "/chc debug" file

No response

Steps to reproduce

Hello, so I have this variable file:

Type: FORMAT
Key: "tag"
Value: |-
    checkTag();

    function checkTag() {
        var tag = "%eternaltags_tag%"
        if (tag == '') {
            return " ";
        }
        return " %eternaltags_tag% ";
    }

Sender_Condition: ""
Receiver_Condition: ""
Sender_Permission: ""
Receiver_Permission: ""

that's used when someone joins the server:

group default
delay 1 seconds
message:
- [&a+&r] &a&l{player}{tag}

I received this error:

[10:53:41] [Server thread/INFO]: mahe[/xxx:60974] logged in with entity id 115532 at ([world]-1.6235123215319314, 125.0, -0.5332894690701847)
[10:53:41] [luckperms-command-executor/INFO]: [LP] mahe no longer inherits permissions from packon in context global.
[10:53:41] [luckperms-worker-7/INFO]: [LuckPerms] [Messaging] Sending user ping for 'mahe' with id: 7fb50d1b-c481-43f4-9984-4e2d5aa85538
[10:53:41] [Server thread/INFO]: mahe lost connection: Disconnected
[10:53:41] [Server thread/ERROR]: ChatControlRed 10.27.8 encountered a NullPointerException! Please check your error.log and report this issue with the information in that file. Running Purpur 1.21-R0.1-SNAPSHOT and Java 21.0.3
[10:53:41] [Server thread/INFO]: java.lang.NullPointerException: Cannot invoke "org.bukkit.entity.Player.getUniqueId()" because "player" is null
[10:53:41] [Server thread/INFO]:    at EternalTags-1.3.2.jar//xyz.oribuin.eternaltags.manager.TagsManager.getUserTag(TagsManager.java:296)
[10:53:41] [Server thread/INFO]:    at EternalTags-1.3.2.jar//xyz.oribuin.eternaltags.hook.Expansion.onPlaceholderRequest(Expansion.java:40)
[10:53:41] [Server thread/INFO]:    at PlaceholderAPI-2.11.6.jar//me.clip.placeholderapi.PlaceholderHook.onRequest(PlaceholderHook.java:35)
[10:53:41] [Server thread/INFO]:    at ChatControl-Red-10.27.8.jar//org.mineacademy.chatcontrol.lib.model.PlaceholderAPIHook.setPlaceholders(HookManager.java:2602)
[10:53:41] [Server thread/INFO]:    at ChatControl-Red-10.27.8.jar//org.mineacademy.chatcontrol.lib.model.PlaceholderAPIHook.setPlaceholders(HookManager.java:2543)
[10:53:41] [Server thread/INFO]:    at ChatControl-Red-10.27.8.jar//org.mineacademy.chatcontrol.lib.model.PlaceholderAPIHook.replacePlaceholders(HookManager.java:2519)
[10:53:41] [Server thread/INFO]:    at ChatControl-Red-10.27.8.jar//org.mineacademy.chatcontrol.lib.model.HookManager.replacePlaceholders(HookManager.java:1473)
[10:53:41] [Server thread/INFO]:    at ChatControl-Red-10.27.8.jar//org.mineacademy.chatcontrol.lib.model.Variables.replace(Variables.java:256)
[10:53:41] [Server thread/INFO]:    at ChatControl-Red-10.27.8.jar//org.mineacademy.chatcontrol.lib.model.Variable.getValue(Variable.java:210)
[10:53:41] [Server thread/INFO]:    at ChatControl-Red-10.27.8.jar//org.mineacademy.chatcontrol.lib.model.Variable.buildPlain(Variable.java:296)
[10:53:41] [Server thread/INFO]:    at ChatControl-Red-10.27.8.jar//org.mineacademy.chatcontrol.lib.model.Variables.replaceJavascriptVariables0(Variables.java:304)
[10:53:41] [Server thread/INFO]:    at ChatControl-Red-10.27.8.jar//org.mineacademy.chatcontrol.lib.model.Variables.replaceJavascriptVariables0(Variables.java:291)
[10:53:41] [Server thread/INFO]:    at ChatControl-Red-10.27.8.jar//org.mineacademy.chatcontrol.lib.model.Variables.replace(Variables.java:268)
[10:53:41] [Server thread/INFO]:    at ChatControl-Red-10.27.8.jar//org.mineacademy.chatcontrol.lib.model.Variables.replace(Variables.java:217)
[10:53:41] [Server thread/INFO]:    at ChatControl-Red-10.27.8.jar//org.mineacademy.chatcontrol.lib.model.Variables.replace(Variables.java:201)
[10:53:41] [Server thread/INFO]:    at ChatControl-Red-10.27.8.jar//org.mineacademy.chatcontrol.lib.model.Variables.replace(Variables.java:186)
[10:53:41] [Server thread/INFO]:    at ChatControl-Red-10.27.8.jar//org.mineacademy.chatcontrol.operator.Operator$OperatorCheck.replaceVariables(Operator.java:1156)
[10:53:41] [Server thread/INFO]:    at ChatControl-Red-10.27.8.jar//org.mineacademy.chatcontrol.operator.Operator$OperatorCheck.replaceVariables(Operator.java:1142)
[10:53:41] [Server thread/INFO]:    at ChatControl-Red-10.27.8.jar//org.mineacademy.chatcontrol.operator.PlayerMessage$PlayerMessageCheck.executeOperators(PlayerMessage.java:1198)
[10:53:41] [Server thread/INFO]:    at ChatControl-Red-10.27.8.jar//org.mineacademy.chatcontrol.operator.PlayerMessage$PlayerMessageCheck.filter(PlayerMessage.java:807)
[10:53:41] [Server thread/INFO]:    at ChatControl-Red-10.27.8.jar//org.mineacademy.chatcontrol.operator.PlayerMessage$PlayerMessageCheck.filter(PlayerMessage.java:677)
[10:53:41] [Server thread/INFO]:    at ChatControl-Red-10.27.8.jar//org.mineacademy.chatcontrol.operator.Operator$OperatorCheck.start(Operator.java:811)
[10:53:41] [Server thread/INFO]:    at ChatControl-Red-10.27.8.jar//org.mineacademy.chatcontrol.operator.PlayerMessages.broadcast(PlayerMessages.java:182)
[10:53:41] [Server thread/INFO]:    at ChatControl-Red-10.27.8.jar//org.mineacademy.chatcontrol.SenderCache.lambda$sendJoinMessage$0(SenderCache.java:226)
[10:53:41] [Server thread/INFO]: [ChatControlRed] !-----------------------------------------------------!
[10:53:41] [Server thread/INFO]: [ChatControlRed]  PlaceholderAPI failed to replace variables!
[10:53:41] [Server thread/INFO]: [ChatControlRed]  Player: mahe
[10:53:41] [Server thread/INFO]: [ChatControlRed]  Message: checkTag();
[10:53:41] [Server thread/INFO]: [ChatControlRed] 
[10:53:41] [Server thread/INFO]: [ChatControlRed] function checkTag() {
[10:53:41] [Server thread/INFO]: [ChatControlRed]     var tag = "%eternaltags_tag%"
[10:53:41] [Server thread/INFO]: [ChatControlRed]     if (tag == '') {
[10:53:41] [Server thread/INFO]: [ChatControlRed]         return " ";
[10:53:41] [Server thread/INFO]: [ChatControlRed]     }
[10:53:41] [Server thread/INFO]: [ChatControlRed]     return " %eternaltags_tag% ";
[10:53:41] [Server thread/INFO]: [ChatControlRed] }
[10:53:41] [Server thread/INFO]: [ChatControlRed]  Error: NullPointerException: Cannot invoke "org.bukkit.entity.Player.getUniqueId()" because "player" is null
[10:53:41] [Server thread/INFO]: [ChatControlRed] !-----------------------------------------------------!
[10:53:41] [luckperms-command-executor/INFO]: [LP] mahe does not inherit from packon_bedrock in context global.
[10:53:42] [Server thread/INFO]: [ChatControlRed] !-----------------------------------------------------!
[10:53:42] [Server thread/INFO]: [ChatControlRed]  IMPORTANT: PREVENTED SERVER CRASH FROM PLACEHOLDERAPI
[10:53:42] [Server thread/INFO]: [ChatControlRed]  
[10:53:42] [Server thread/INFO]: [ChatControlRed]  Replacing PlaceholderAPI variable took over 1.5 sec
[10:53:42] [Server thread/INFO]: [ChatControlRed]  and was interrupted to prevent hanging the server.
[10:53:42] [Server thread/INFO]: [ChatControlRed]  
[10:53:42] [Server thread/INFO]: [ChatControlRed]  This is typically caused when a variable sends a
[10:53:42] [Server thread/INFO]: [ChatControlRed]  blocking HTTP request, such as checking stuff on
[10:53:42] [Server thread/INFO]: [ChatControlRed]  the Internet or resolving offline player names.
[10:53:42] [Server thread/INFO]: [ChatControlRed]  This is NOT an error in ChatControlRed, you need
[10:53:42] [Server thread/INFO]: [ChatControlRed]  to contact the placeholder expansion's author instead.
[10:53:42] [Server thread/INFO]: [ChatControlRed]  
[10:53:42] [Server thread/INFO]: [ChatControlRed]  Variable: eternaltags_tag
[10:53:42] [Server thread/INFO]: [ChatControlRed]  Text: checkTag();
[10:53:42] [Server thread/INFO]: [ChatControlRed] 
[10:53:42] [Server thread/INFO]: [ChatControlRed] function checkTag() {
[10:53:42] [Server thread/INFO]: [ChatControlRed]     var tag = "%eternaltags_tag%"
[10:53:42] [Server thread/INFO]: [ChatControlRed]     if (tag == '') {
[10:53:42] [Server thread/INFO]: [ChatControlRed]         return " ";
[10:53:42] [Server thread/INFO]: [ChatControlRed]     }
[10:53:42] [Server thread/INFO]: [ChatControlRed]     return " %eternaltags_tag% ";
[10:53:42] [Server thread/INFO]: [ChatControlRed] }
[10:53:42] [Server thread/INFO]: [ChatControlRed]  Player: mahe
[10:53:42] [Server thread/INFO]: [ChatControlRed] !-----------------------------------------------------!
[10:53:42] [Server thread/WARN]: [ChatControlRed] Task #20246801 for ChatControlRed v10.27.8 generated an exception
java.lang.UnsupportedOperationException: null
    at java.base/java.lang.Thread.stop(Thread.java:1667) ~[?:?]
    at ChatControl-Red-10.27.8.jar/org.mineacademy.chatcontrol.lib.model.PlaceholderAPIHook.lambda$setPlaceholders$0(HookManager.java:2599) ~[ChatControl-Red-10.27.8.jar:?]
    at org.bukkit.craftbukkit.scheduler.CraftTask.run(CraftTask.java:86) ~[purpur-1.21.jar:1.21-2284-4e55e26]
    at org.bukkit.craftbukkit.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:475) ~[purpur-1.21.jar:1.21-2284-4e55e26]
    at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1762) ~[purpur-1.21.jar:1.21-2284-4e55e26]
    at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:509) ~[purpur-1.21.jar:1.21-2284-4e55e26]
    at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1634) ~[purpur-1.21.jar:1.21-2284-4e55e26]
    at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1334) ~[purpur-1.21.jar:1.21-2284-4e55e26]
    at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:333) ~[purpur-1.21.jar:1.21-2284-4e55e26]
    at java.base/java.lang.Thread.run(Thread.java:1583) ~[?:?]

cause the player disconnected so fast, but how can I prevent it? What should I do, how to change my configuration, please?

kangarko commented 1 month ago

The author of eternal tags need to fix this on his end:

10:53:41] [Server thread/INFO]: java.lang.NullPointerException: Cannot invoke "org.bukkit.entity.Player.getUniqueId()" because "player" is null [10:53:41] [Server thread/INFO]: at EternalTags-1.3.2.jar//xyz.oribuin.eternaltags.manager.TagsManager.getUserTag(TagsManager.java:296) [10:53:41] [Server thread/INFO]: at EternalTags-1.3.2.jar//xyz.oribuin.eternaltags.hook.Expansion.onPlaceholderRequest(Expansion.java:40)