Database data and player data are the same but comparison fails?

Discussion in 'Plugin Development' started by xxturnerbg, Aug 14, 2019.

Thread Status:
Not open for further replies.
  1. Hi, im trying to make a plugin like AuthMe for 1.14.4 and im really confused. I have MySQL database and im sending query to get the uuid of a player recorded in the database but when it compares it to the one that player.getUniqueId() gives you for some reason the if statement fails even tho they are the same ?

    Sorry if i confused you, this is actually my first time working with databases. And sorry if the formatting or the thread is wrong, im also new to bukkit, and bukkit forum :D

    Code:

    https://pastebin.com/7KLyZyVF





    The code is messy because i was testing and getting frustrated and i was trying things.

    For now i only want to get the database and server data to compare like it should. I know there needs to be more things.


    EDIT:

    I solved it by changing if (rs.getString("user_name") == event.getPlayer().getName()) to
    if (rs.getString("user_name").contentEquals(event.getPlayer().getName()))
    I thing the old one was not working because the String structure was different in the slightest bit.
     
    Last edited: Aug 14, 2019
Thread Status:
Not open for further replies.

Share This Page