Solved %something% but only the %s is checked

Discussion in 'Plugin Development' started by cdnyassuo34, Aug 13, 2019.

Thread Status:
Not open for further replies.
  1. Offline

    cdnyassuo34

    so, I am making a plugin with placeholders and I finally fixed all error... but now that I fixed everything,
    only the %s is changed... (sorry for my english but I am french ^-^')
    here is the code:
    Code:
    @EventHandler (priority = EventPriority.HIGHEST)
        public void onChat(AsyncPlayerChatEvent e)
        {
            Player p = e.getPlayer();
            String currentc = e.getPlayer().getLocation().getChunk().getX() + "," + e.getPlayer().getLocation().getChunk().getZ();
            e.setFormat("%snowclaim_test%" + p.getName() + ": " + e.getMessage());
    
            e.setFormat(e.getFormat().replace("%snowclaim_curc%", currentc).replace("%snowclaim_cc%", cc.get(p.getName()) + "").replace("%snowclaim_test%", "1234").replace("%snowclaim_gco%", getChunkOwner(getPlayerChunkXZ(p))));
        }
    
    and aafter fixing all old error I have a new one:
    new error (open)

    org.bukkit.event.EventException: null
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:308) ~[craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:66) ~[craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:506) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:488) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at net.minecraft.server.v1_13_R2.PlayerConnection.chat(PlayerConnection.java:1495) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at net.minecraft.server.v1_13_R2.PlayerConnection.a(PlayerConnection.java:1444) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at net.minecraft.server.v1_13_R2.PacketPlayInChat.a(SourceFile:37) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at net.minecraft.server.v1_13_R2.PacketPlayInChat.a(SourceFile:9) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at net.minecraft.server.v1_13_R2.NetworkManager.a(NetworkManager.java:132) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at net.minecraft.server.v1_13_R2.NetworkManager.channelRead0(NetworkManager.java:121) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at net.minecraft.server.v1_13_R2.NetworkManager.channelRead0(NetworkManager.java:1) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:310) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:284) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:310) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:284) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:310) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:284) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1434) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:965) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:647) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:582) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:499) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:461) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at java.lang.Thread.run(Unknown Source) [?:1.8.0_211]
    Caused by: java.lang.NullPointerException


    I triyed many things to fix it but I just think it only care about the %s and not %snowclaim_test%
    .
    if anyone have a solution to make the plugin care about the entire charSequence and not the %s
    I would be happy to see it ^-^
     
  2. Offline

    yPedx

    I don't think that's the entire error, it ends with Caused by: java.lang.NullPointerException
    Check your logs and see if there's more?
     
  3. Offline

    KarimAKL

    @cdnyassuo34 There should be more of the error.
    EDIT: Nvm, @yPedx posted before me. :p
    Btw, can you let us know the line numbers? (so we won't have to ask later)
     
  4. Offline

    DerDonut

    setFormat() uses %s as a default placeholder and it gets replaced by the playername (first %s) and the message (second %s). Choose a different placeholder or replace % with %% (not quite sure about the last)
     
  5. Offline

    cdnyassuo34

    @KarimAKL if I understand your question about my plugin, It's a oneClass plugin that contains 805 lines
    and @DerDonut I am not really using %s but I am using %snowclaim_something%
    and the plugin only care about the 2 first char of the charSequence. so It only care abour %s instead of %snoclaim_something%
     
  6. Offline

    CraftCreeper6

    @cdnyassuo34
    Post the whole stacktrace.

    Either way, %s will be detected and replaced as that's what the replace function does.
     
  7. Offline

    cdnyassuo34

    by the whole stacktrace do you mean everything ? not only the error ?
     
  8. Offline

    CraftCreeper6

  9. Offline

    cdnyassuo34

    error (open)
    [16:21:52 ERROR]: Could not pass event AsyncPlayerChatEvent to SnowClaim v1.0
    org.bukkit.event.EventException: null
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:308) ~[craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:66) ~[craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:506) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:488) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at net.minecraft.server.v1_13_R2.PlayerConnection.chat(PlayerConnection.java:1495) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at net.minecraft.server.v1_13_R2.PlayerConnection.a(PlayerConnection.java:1444) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at net.minecraft.server.v1_13_R2.PacketPlayInChat.a(SourceFile:37) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at net.minecraft.server.v1_13_R2.PacketPlayInChat.a(SourceFile:9) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at net.minecraft.server.v1_13_R2.NetworkManager.a(NetworkManager.java:132) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at net.minecraft.server.v1_13_R2.NetworkManager.channelRead0(NetworkManager.java:121) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at net.minecraft.server.v1_13_R2.NetworkManager.channelRead0(NetworkManager.java:1) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:310) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:284) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:310) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:284) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:310) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:284) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1434) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:965) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:647) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:582) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:499) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:461) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884) [craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at java.lang.Thread.run(Unknown Source) [?:1.8.0_211]
    Caused by: java.lang.NullPointerException
    at java.lang.String.replace(Unknown Source) ~[?:1.8.0_211]
    at fr.snowdingerr.snowclaim.mainclass.onChat(mainclass.java:697) ~[?:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_211]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_211]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_211]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_211]
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    ... 48 more
    [16:21:52 INFO]: Snowdingerrnowclaim_testTESTnowdingerr: test


    here it is
     
  10. Offline

    DerDonut

    you are using it since %snowclaim_something% starts with %s

    so just follow my advise and your problem is solved
     
  11. Offline

    cdnyassuo34

    so I should use %%snowclaim_something% instead of %snowclaim_something% ?
     
  12. Offline

    DerDonut

    Almost, use double % anywhere in setFormat. (That means also when you replace it etc) otherwise it tries to append the following char to the single %
     
  13. Offline

    cdnyassuo34

    that's weird :/ I am still having error :I
    I am using this as you said:
    Code:
    @EventHandler (priority = EventPriority.HIGHEST)
        public void onChat(AsyncPlayerChatEvent e)
        {
            Player p = e.getPlayer();
            String ggn = getGroupName(p.getName());
            String currentc = e.getPlayer().getLocation().getChunk().getX() + "," + e.getPlayer().getLocation().getChunk().getZ();
            e.setFormat("%%snowclaim_test%%" + " "+ p.getName() + ": " + e.getMessage());
    
            e.setFormat(e.getFormat().replace("%%snowclaim_ggn%%", ggn).replace("%%snowclaim_curc%%", currentc).replace("%%snowclaim_cc%%", cc.get(p.getName()) + "").replace("%%snowclaim_test%%", "1234").replace("%%snowclaim_gco%%", getChunkOwner(getPlayerChunkXZ(p))));
        }
    and here is the error I have again :/
    Error (open)

    [17:45:04 ERROR]: Could not pass event AsyncPlayerChatEvent to SnowClaim v1.0
    org.bukkit.event.EventException: null
    ...
    Caused by: java.lang.NullPointerException
    at java.lang.String.replace(Unknown Source) ~[?:1.8.0_211]
    at fr.snowdingerr.snowclaim.mainclass.onChat(mainclass.java:697) ~[?:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_211]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_211]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_211]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_211]
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    ... 48 more
    [17:45:04 INFO]: %snowclaim_test% Snowdingerr: s
     
  14. Offline

    CraftCreeper6

    @cdnyassuo34
    Use a different letter.

    Use %xsnowclaim_gnn% or something like that.
     
  15. Offline

    cdnyassuo34

    it returns the same error as before
     
    Last edited: Aug 13, 2019
  16. Offline

    DerDonut

    @CraftCreeper6 he would still get problems with the % at the ending.
    And maybe also with the first one because it tries to generate another placeholder (%x) which would probably throw a now error

    I tested this and it worked for me. I guess 'cc' is null or does not contain the player or getChunkOwner returns null
     
    Last edited: Aug 13, 2019
  17. Offline

    cdnyassuo34

    just a question , did you tryied this in 1.13.2 or in a older/more recent version ?
    because I saw 1.8.0_211 in the stacktrace

    Error (open)

    Caused by: java.lang.NullPointerException
    at java.lang.String.replace(Unknown Source) ~[?:1.8.0_211]
    at fr.snowdingerr.snowclaim.mainclass.onChat(mainclass.java:696) ~[?:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_211]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_211]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_211]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_211]
     
  18. Offline

    DerDonut

    I did use 1.8 that is my code:
    Code:Java
    1. e.setFormat("%%snowclaim_test%% " + p.getName() + ": " + e.getMessage());
    2. e.setFormat(e.getFormat().replace("%%snowclaim_test%%", "1234"));


    You could write each .replace() on a seperate line and then take a look at the line number in the error (or send it to me if you can't read stacktraces)

    Just a question, why do you need the placeholders? I mean you replace the placeholder right after creating it.. why not adding the information you want to send in the first setFormat()?
     
    Last edited: Aug 13, 2019
  19. Offline

    cdnyassuo34

    yes my bad ^^ I just made one mistake to get this error :/
    everything is working thanks you so much all ! ^-^
     
  20. Offline

    DerDonut

    nice glad to hear that :D
     
Thread Status:
Not open for further replies.

Share This Page