Solved OP Owner (Security) on PlayerJoinEvent

Discussion in 'Plugin Development' started by ItsJorden, Jun 15, 2015.

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

    ItsJorden

    Hey! I am currently try to implement an OnPlayerJoinEvent to allow me to become OP on my own server by getting my UUID and IP to authenticate whether I am truly the owner.

    Go's as follows:
    Code:
        public void onPlayerJoin(PlayerJoinEvent event) {
            Player p = event.getPlayer();
                if p.getUniqueId().equals("3491fc09-13ba-4624-b3cc-da8e87f0230f");
                    Bukkit.getPlayer(null)
        }
    This is only what I've been able to get over a short period of time (10 minutes)
    The UUID of that should equal the username of RikaAoki (alt).

    Is there anyway to do this that I haven't been able to find. (I know its possible to get the UUID and IP. Just checking them is my issue. Thanks, let me know if you have any issues.
     
  2. Offline

    timtower Administrator Administrator Moderator

    @ItsJorden The p.getUniqueId().toString().equals instead.
     
    CoolGamerXD likes this.
  3. Offline

    87pen

    Would doing this make it more secure? If you check for your IP every time your account joins, what happens if your IP changes or if you are not at your house. Correct me if I am wrong but wouldn't someone who knows your user and password still have your UUID, so if someone joined on your account checking for your accounts UUID would return your ID whether if it was you or not. The only way I see of making it more secure is like the old offline server plugins that would require you to also log in, in the server with a separate login.
     
  4. @ItsJorden I suggest learning Java before trying to anything with the Bukkit API. It's a bit ovbious you know nothing about Java seeing that you're ending your if statement with a semicolon ( ; ). You can find tutorials everywhere. Including here. If you continue trying to experiment with the Bukkit API without the knowledge of Java, you will be very confused, and will probably give up on some of the simplest things. For your problem however, like @timtower said, I recommend comparing the UUID with the UUID of the player that is joining.
     
  5. Offline

    Reynergodoy

    why not doing instead:
    if (!(p.getName() == yourname))
    return;
    |run command to op|
     
  6. Offline

    justin_393

    Because you can change names...
     
  7. Offline

    567legodude

    Since you don't want to restrict it to only UUID. You may have to make a system so that when they log in they are stuck in a room, and the only way to get out is to type the correct password through a command. I've seen servers do that before.

    If you want to get really advanced you could make a plugin that communicates with a website, and use that to manage player accounts.
     
  8. Offline

    caseif

    This really shouldn't be necessary if the server is authenticating with Mojang. Entries in the oplist are stored as UUIDs, so further validation isn't needed.
     
  9. Offline

    ItsJorden

    Thanks guys! I decided to go another route. Upon joining if that uuid matches an admin, it checks the ip list for that user.
     
  10. Offline

    Reynergodoy

    oh....... changing names... im sure that i read something about this....
     
Thread Status:
Not open for further replies.

Share This Page