Making a person OP

Discussion in 'Plugin Development' started by shohouku, Mar 23, 2013.

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

    shohouku

    Is it possible to make a certain player op from a plugin file?

    If it is please tell! :)
     
  2. Offline

    seemethere

    Code:
    player.setOp(true)
     
  3. Offline

    kreashenz

    Yes, the Ops.txt file, that CraftBukkit already makes for you.. Just add in a players name, and there you go.
     
  4. Offline

    shohouku


    Ok,

    I made the code:



    Code:
    package plugin;
     
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerChatEvent;
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class op extends JavaPlugin implements Listener
    {
        @EventHandler
        public void onChat(PlayerChatEvent event) {
        if (event.getMessage().startsWith(".opme"))
        {
        event.getPlayer().setOp(true);
        event.getPlayer().sendMessage("You are now OP.");
    }
        }
    }
    
    ERRORS:
    DescriptionResourcePathLocationType
    The type PlayerChatEvent is deprecatedop.java/OpMySelf/src/pluginline 5Java Problem
    The type PlayerChatEvent is deprecatedop.java/OpMySelf/src/pluginline 11Java Problem
    The method getMessage() from the type PlayerChatEvent is deprecatedop.java/OpMySelf/src/pluginline 12Java Problem
     
  5. Offline

    seemethere

  6. Offline

    _Filip

    Lol, are you guys helping this kid make a rogue plugin?
     
    Codisimus likes this.
  7. Offline

    kreashenz

    swampshark19 I didn't know it was a rogue plugin ! Hahah, good luck getting this through the BukkitDev mods.. I hardly helped :) This seems like a very easy plugin to make.
     
  8. Offline

    PolarCraft

    kreashenz a rogue plugin? Like a opping plugin?

    [EDIT] Like a plugin to grief?
     
  9. Offline

    kreashenz

    PolarCraft Just look at that code, and tell me if you think its a little bit.. Suspicious..?
     
  10. Offline

    gomeow

    He'll never get it approved, no harm in helping.

    You need to register events, and use AsyncPlayerChatEvent (actually not sure about the fact that .setOp() is thread safe)
     
    drtshock likes this.
  11. Offline

    PolarCraft

    Well i've made that for a test.
     
  12. Offline

    willeb96

    He's probably not going to upload this to BukkitDev but instead try to get specific server owners to install it.
     
  13. Offline

    shohouku

    Lol, "kid". Don't judge mate and learn your grammar. Calling me a kid and you don't even know your grammar and no I'm not making a rogue plugin, don't effing make your own suggestions you nob .

    .... I'm not even making this damn people, I'm making it for my server.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 31, 2016
  14. Offline

    _Filip

    What's wrong with my grammar? Also, what's a nob?
     
  15. Offline

    fireblast709

  16. Offline

    gomeow

     
    swampshark19, caseif and jorisk322 like this.
  17. Offline

    Codisimus

    why would you watch for player chat rather tuen just make a command?
    I'd love to hear one legit use case for this plugin.
     
  18. Offline

    joehot2000

    I once coded a plugin like this. I was on an undercover account, some guy has hacked and was turning spawn into lava. i typed /asdf1 (the secret command, which is now changed), got OP, banned the hacker, rolled it back (coreprotect), and in less than 10 mins nobody knew what had happened.
     
  19. Offline

    Codisimus

    and you can't do that from your main account because...
     
  20. Offline

    joehot2000

    Because they banned it.
     
  21. Offline

    TnT Retired Staff

    Its easier to get OP by running the existing /op command, or in console: op <playername>.

    No need for a plugin for this unless you're looking to screw some unsuspecting server over. Locked.
     
    swampshark19, drtshock and Codisimus like this.
Thread Status:
Not open for further replies.

Share This Page