Jump to content

Check if the player is a operator


gamer1097

Recommended Posts

I want to find out if the players is op or not does anyone know how to do this?

 

These are some utility functions I wrote but have not tested in multiplayer (can't get Eclipse to launch the server). They do work for singleplayer however.

 

public boolean isOp (String playerName)
{
    // Check if multiplayer and OP or singleplayer and commands allowed (cheats)
    return MinecraftServer.getServer().getConfigurationManager().areCommandsAllowed(playerName);
}

public boolean isOp (EntityPlayer player)
{
    return isOp(player.getEntityName());
}

public boolean isOp (EntityLiving entity)
{
    if (entity instanceof EntityPlayer)
        return isOp(entity.getEntityName());
    else
        return false;
}

Link to comment
Share on other sites

  • 3 months later...

Just for the record, the method changed (as of version 9.11.1.953 for 1.6.4 from 11/21/2013 03:31:15 PM):

static public boolean isPlayerOp(String name)
{ return MinecraftServer.getServer().getConfigurationManager().isPlayerOpped(name); }

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.