Error in a console

Discussion in 'Plugin Development' started by RikiMaus, Jun 27, 2024.

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

    RikiMaus

    Hello, I have problem with sorting players by placeholders.
    upload_2024-6-27_18-23-37.png upload_2024-6-27_18-24-6.png
     
  2. Offline

    timtower Administrator Administrator Moderator

    @RikiMaus Did you read the error? You are getting numbers with a comma in them, can't be parsed.
     
  3. Offline

    RikiMaus

    How can I parse them? Replace ',' to '.'?
     
  4. Offline

    timtower Administrator Administrator Moderator

    Probably, but would check where the numbers get from first
     
  5. Offline

    RikiMaus

    Now I have this -> upload_2024-6-27_21-7-43.png
     
  6. Offline

    timtower Administrator Administrator Moderator

    @RikiMaus Yeah, can't really do a lot without seeing any code.
    Probably also helps to print your values.
     
  7. Offline

    RikiMaus

    I checked output. Problem in comparator
     
  8. Offline

    KarimAKL

    @RikiMaus Your last stacktrace mentioned an empty string being parsed as a double in the comparator. Make sure your placeholder is getting a number.
     
  9. Offline

    RikiMaus

    I'm sure that it is getting a number. I tried another placeholders, but the same error
     
  10. Offline

    timtower Administrator Administrator Moderator

    Print the value to the console
     
  11. Offline

    RikiMaus

    upload_2024-6-29_21-35-50.png upload_2024-6-29_21-37-13.png upload_2024-6-29_21-36-57.png I redid it, but I have new errors
     
  12. Offline

    KarimAKL

    @RikiMaus At line 153, you're attempting to get the second element in an ArrayList that only has 1 element.
     
  13. Offline

    RikiMaus

    I fixed it, but I have a new one upload_2024-6-30_15-56-23.png upload_2024-6-30_15-56-48.png

    126 - offlinePlayers.sort(Comparator...
     
    Last edited by a moderator: Jun 30, 2024
  14. Offline

    KarimAKL

    @RikiMaus I assume this is caused by your use of an asynchronous thread to sort the collection. Try changing it from "runTaskAsynchronously" to "runTask".
     
  15. Offline

    RikiMaus

    Thank you, now it's working
     
  16. Offline

    RikiMaus

    But it's working only with offline placeholders. upload_2024-7-4_16-31-8.png How can I do check if placeholder is for online players or for offline player?
     
Thread Status:
Not open for further replies.

Share This Page