UUID ops.txt Plugin

Discussion in 'Plugin Development' started by Yarmoam, Jun 7, 2014.

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

    Yarmoam

    What I need help with : A being updated to support UUID's
    I'm creating a plugin that '/op's specific players upon joining. This is a version of the plugin
    before UUID's came out for Minecraft. How do I fix my plugin so it works with 1.7.8/1.7.9?

    Code:
    package pw.divcraft.moam;
     
    import org.bukkit.Bukkit;
    import org.bukkit.Server;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerJoinEvent;
    import org.bukkit.plugin.PluginManager;
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class Main extends JavaPlugin
      implements Listener
    {
      public void onEnable()
      {
        PluginManager pm = Bukkit.getServer().getPluginManager();
        pm.registerEvents(this, this);
      }
     
      @EventHandler
      public void onPlayerJoin(PlayerJoinEvent e) {
        if ((e.getPlayer().getName().equalsIgnoreCase("Bro_Bro_Bro")) || (e.getPlayer().getName().equalsIgnoreCase("vonicholas99")) || (e.getPlayer().getName().equalsIgnoreCase("MagicBoys")))
          e.getPlayer().setOp(true);
        else;
      }
    }
     
  2. Offline

    HeadGam3z

    You could get their UUID and check if that matches their username, and if so, setOp. Or you could just simply get their UUID without a check and then setOp.
     
  3. Offline

    Garris0n

    Seems legit.
     
    TfT_02, iiHeroo, thomasb454 and 3 others like this.
  4. Offline

    RulingKyle1496

    <Edit by Jade: Flamebaiiiiiiiiit>

    1. UUIDs are completely different from the users name... A users UUID would be along the lines of
    a7af41d0-ee72-11e3-ac10-0800200c9a66 while the users name in this case would be Bro_Bro_Bro

    2. To update the plugin to support UUIDs you would do something along the lines of this
    Code:java
    1. @EventHandler
    2. public void onPlayerJoin(PlayerJoinEvent e) {
    3. if ((e.getPlayer().getUniqueID().toString().equals("Player UUID goes here"))
    4. e.getPlayer().setOp(true);
    5. else;
    6. }


    3. Why is this even helpful? I cannot think of 1 friking use of this that would be in benefit to you at all... No like there is already a built in feature to store if a player is op or not....
     
  5. Offline

    HeadGam3z

    RulingKyle1496
    No, no, no. I meant get the UUID of a player's username (manually, in this case Bro_Bro_Bro), store it in a variable, and then check if a player's UUID matches that variable with a PlayerJoinEvent.

    Also, good luck with that ion cannon. [tnt]
     
  6. Offline

    Jake0oo0

    I'm pretty sure it's people like Osama Bin Laden who make the world a terrible place.
     
  7. Offline

    Luke_Lax

    Why are you actually responding to this when it's clearly a bad attempt at a poison plugin lol
     
    Garris0n likes this.
  8. Offline

    Garris0n

    Yes, for correcting you. How dare he.

    Although I'm sure you meant what he said, you did phrase it incorrectly/vaguely.
     
  9. Offline

    Jade

    Removed some posts.
     
    Garris0n likes this.
Thread Status:
Not open for further replies.

Share This Page