Java 类net.minecraft.server.management.UserListOpsEntry 实例源码

项目:DecompiledMinecraft    文件:EntityPlayerMP.java   
/**
 * Returns {@code true} if the CommandSender is allowed to execute the command, {@code false} if not
 */
public boolean canCommandSenderUseCommand(int permLevel, String commandName)
{
    if ("seed".equals(commandName) && !this.mcServer.isDedicatedServer())
    {
        return true;
    }
    else if (!"tell".equals(commandName) && !"help".equals(commandName) && !"me".equals(commandName) && !"trigger".equals(commandName))
    {
        if (this.mcServer.getConfigurationManager().canSendCommands(this.getGameProfile()))
        {
            UserListOpsEntry userlistopsentry = (UserListOpsEntry)this.mcServer.getConfigurationManager().getOppedPlayers().getEntry(this.getGameProfile());
            return userlistopsentry != null ? userlistopsentry.getPermissionLevel() >= permLevel : this.mcServer.getOpPermissionLevel() >= permLevel;
        }
        else
        {
            return false;
        }
    }
    else
    {
        return true;
    }
}
项目:DecompiledMinecraft    文件:EntityPlayerMP.java   
/**
 * Returns {@code true} if the CommandSender is allowed to execute the command, {@code false} if not
 */
public boolean canCommandSenderUseCommand(int permLevel, String commandName)
{
    if ("seed".equals(commandName) && !this.mcServer.isDedicatedServer())
    {
        return true;
    }
    else if (!"tell".equals(commandName) && !"help".equals(commandName) && !"me".equals(commandName) && !"trigger".equals(commandName))
    {
        if (this.mcServer.getConfigurationManager().canSendCommands(this.getGameProfile()))
        {
            UserListOpsEntry userlistopsentry = (UserListOpsEntry)this.mcServer.getConfigurationManager().getOppedPlayers().getEntry(this.getGameProfile());
            return userlistopsentry != null ? userlistopsentry.getPermissionLevel() >= permLevel : this.mcServer.getOpPermissionLevel() >= permLevel;
        }
        else
        {
            return false;
        }
    }
    else
    {
        return true;
    }
}
项目:BaseClient    文件:EntityPlayerMP.java   
/**
 * Returns {@code true} if the CommandSender is allowed to execute the command, {@code false} if not
 */
public boolean canCommandSenderUseCommand(int permLevel, String commandName)
{
    if ("seed".equals(commandName) && !this.mcServer.isDedicatedServer())
    {
        return true;
    }
    else if (!"tell".equals(commandName) && !"help".equals(commandName) && !"me".equals(commandName) && !"trigger".equals(commandName))
    {
        if (this.mcServer.getConfigurationManager().canSendCommands(this.getGameProfile()))
        {
            UserListOpsEntry userlistopsentry = (UserListOpsEntry)this.mcServer.getConfigurationManager().getOppedPlayers().getEntry(this.getGameProfile());
            return userlistopsentry != null ? userlistopsentry.getPermissionLevel() >= permLevel : this.mcServer.getOpPermissionLevel() >= permLevel;
        }
        else
        {
            return false;
        }
    }
    else
    {
        return true;
    }
}
项目:BaseClient    文件:EntityPlayerMP.java   
/**
 * Returns {@code true} if the CommandSender is allowed to execute the command, {@code false} if not
 */
public boolean canCommandSenderUseCommand(int permLevel, String commandName)
{
    if ("seed".equals(commandName) && !this.mcServer.isDedicatedServer())
    {
        return true;
    }
    else if (!"tell".equals(commandName) && !"help".equals(commandName) && !"me".equals(commandName) && !"trigger".equals(commandName))
    {
        if (this.mcServer.getConfigurationManager().canSendCommands(this.getGameProfile()))
        {
            UserListOpsEntry userlistopsentry = (UserListOpsEntry)this.mcServer.getConfigurationManager().getOppedPlayers().getEntry(this.getGameProfile());
            return userlistopsentry != null ? userlistopsentry.getPermissionLevel() >= permLevel : this.mcServer.getOpPermissionLevel() >= permLevel;
        }
        else
        {
            return false;
        }
    }
    else
    {
        return true;
    }
}
项目:Zombe-Modpack    文件:EntityPlayerMP.java   
/**
 * Returns {@code true} if the CommandSender is allowed to execute the command, {@code false} if not
 */
public boolean canCommandSenderUseCommand(int permLevel, String commandName)
{
    if ("seed".equals(commandName) && !this.mcServer.isDedicatedServer())
    {
        return true;
    }
    else if (!"tell".equals(commandName) && !"help".equals(commandName) && !"me".equals(commandName) && !"trigger".equals(commandName))
    {
        if (this.mcServer.getPlayerList().canSendCommands(this.getGameProfile()))
        {
            UserListOpsEntry userlistopsentry = (UserListOpsEntry)this.mcServer.getPlayerList().getOppedPlayers().getEntry(this.getGameProfile());
            return userlistopsentry != null ? userlistopsentry.getPermissionLevel() >= permLevel : this.mcServer.getOpPermissionLevel() >= permLevel;
        }
        else
        {
            return false;
        }
    }
    else
    {
        return true;
    }
}
项目:Backmemed    文件:EntityPlayerMP.java   
/**
 * Returns {@code true} if the CommandSender is allowed to execute the command, {@code false} if not
 */
public boolean canCommandSenderUseCommand(int permLevel, String commandName)
{
    if ("seed".equals(commandName) && !this.mcServer.isDedicatedServer())
    {
        return true;
    }
    else if (!"tell".equals(commandName) && !"help".equals(commandName) && !"me".equals(commandName) && !"trigger".equals(commandName))
    {
        if (this.mcServer.getPlayerList().canSendCommands(this.getGameProfile()))
        {
            UserListOpsEntry userlistopsentry = (UserListOpsEntry)this.mcServer.getPlayerList().getOppedPlayers().getEntry(this.getGameProfile());
            return userlistopsentry != null ? userlistopsentry.getPermissionLevel() >= permLevel : this.mcServer.getOpPermissionLevel() >= permLevel;
        }
        else
        {
            return false;
        }
    }
    else
    {
        return true;
    }
}
项目:World-Border    文件:WBCommand.java   
@Override
public boolean checkPermission(MinecraftServer server, ICommandSender sender) {
    if (sender instanceof DedicatedServer)
        return true;

    EntityPlayerMP   player  = (EntityPlayerMP) sender;
    GameProfile      profile = player.getGameProfile();
    UserListOpsEntry opEntry = (UserListOpsEntry) WorldBorder.SERVER
        .getPlayerList()
        .getOppedPlayers()
        .getEntry(profile);

    // Level 2 (out of 4) have general access to game-changing commands
    // TODO: Make this a configuration option
    return opEntry != null && opEntry.getPermissionLevel() > 2;
}
项目:CustomWorldGen    文件:EntityPlayerMP.java   
/**
 * Returns {@code true} if the CommandSender is allowed to execute the command, {@code false} if not
 */
public boolean canCommandSenderUseCommand(int permLevel, String commandName)
{
    if ("seed".equals(commandName) && !this.mcServer.isDedicatedServer())
    {
        return true;
    }
    else if (!"tell".equals(commandName) && !"help".equals(commandName) && !"me".equals(commandName) && !"trigger".equals(commandName))
    {
        if (this.mcServer.getPlayerList().canSendCommands(this.getGameProfile()))
        {
            UserListOpsEntry userlistopsentry = (UserListOpsEntry)this.mcServer.getPlayerList().getOppedPlayers().getEntry(this.getGameProfile());
            return userlistopsentry != null ? userlistopsentry.getPermissionLevel() >= permLevel : this.mcServer.getOpPermissionLevel() >= permLevel;
        }
        else
        {
            return false;
        }
    }
    else
    {
        return true;
    }
}
项目:WorldBorder-Forge    文件:WBCommand.java   
@Override
public boolean canCommandSenderUseCommand(ICommandSender sender)
{
    if (sender instanceof DedicatedServer)
        return true;

    EntityPlayerMP   player  = (EntityPlayerMP) sender;
    GameProfile      profile = player.getGameProfile();
    UserListOpsEntry opEntry = (UserListOpsEntry) WorldBorder.SERVER
        .getConfigurationManager()
        .func_152603_m()
        .func_152683_b(profile);

    // Level 2 (out of 4) have general access to game-changing commands
    // TODO: Make this a configuration option
    return opEntry != null && opEntry.func_152644_a() > 2;
}
项目:morecommands    文件:CommandOp.java   
@Override
public String execute(CommandSender sender, String[] params) throws CommandException {
    if (params.length > 0) {
        MinecraftServer server = sender.getServer();
        GameProfile profile = server.getPlayerProfileCache().getGameProfileForUsername(params[0]);
        int permLevel = server.getOpPermissionLevel();

           if (profile == null)
               throw new CommandException("command.op.playerNotFound", sender, params[0]);

           if (params.length > 1) {
            try {permLevel = parseInt(params[1], 0, server.getOpPermissionLevel());}
            catch (NumberInvalidException nie) {throw new CommandException(nie);}
           }

           server.getPlayerList().getOppedPlayers().addEntry(new UserListOpsEntry(profile, permLevel, server.getPlayerList().bypassesPlayerLimit(profile)));
           sendPlayerPermissionLevel(server.getPlayerList().getPlayerByUUID(profile.getId()), permLevel);
           notifyCommandListener(sender.getMinecraftISender(), this, "commands.op.success", params[0]);
       }
    else throw new CommandException("command.generic.invalidUsage", sender, this.getCommandName());

    return null;
}
项目:ExpandedRailsMod    文件:EntityPlayerMP.java   
/**
 * Returns {@code true} if the CommandSender is allowed to execute the command, {@code false} if not
 */
public boolean canCommandSenderUseCommand(int permLevel, String commandName)
{
    if ("seed".equals(commandName) && !this.mcServer.isDedicatedServer())
    {
        return true;
    }
    else if (!"tell".equals(commandName) && !"help".equals(commandName) && !"me".equals(commandName) && !"trigger".equals(commandName))
    {
        if (this.mcServer.getPlayerList().canSendCommands(this.getGameProfile()))
        {
            UserListOpsEntry userlistopsentry = (UserListOpsEntry)this.mcServer.getPlayerList().getOppedPlayers().getEntry(this.getGameProfile());
            return userlistopsentry != null ? userlistopsentry.getPermissionLevel() >= permLevel : this.mcServer.getOpPermissionLevel() >= permLevel;
        }
        else
        {
            return false;
        }
    }
    else
    {
        return true;
    }
}
项目:Cauldron    文件:EntityPlayerMP.java   
public boolean canCommandSenderUseCommand(int p_70003_1_, String p_70003_2_)
{
    if ("seed".equals(p_70003_2_) && !this.mcServer.isDedicatedServer())
    {
        return true;
    }
    else if (!"tell".equals(p_70003_2_) && !"help".equals(p_70003_2_) && !"me".equals(p_70003_2_))
    {
        if (this.mcServer.getConfigurationManager().func_152596_g(this.getGameProfile()))
        {
            UserListOpsEntry userlistopsentry = (UserListOpsEntry)this.mcServer.getConfigurationManager().func_152603_m().func_152683_b(this.getGameProfile());
            return userlistopsentry != null ? userlistopsentry.func_152644_a() >= p_70003_1_ : this.mcServer.getOpPermissionLevel() >= p_70003_1_;
        }
        else
        {
            return false;
        }
    }
    else
    {
        return true;
    }
}
项目:Cauldron    文件:EntityPlayerMP.java   
public boolean canCommandSenderUseCommand(int p_70003_1_, String p_70003_2_)
{
    if ("seed".equals(p_70003_2_) && !this.mcServer.isDedicatedServer())
    {
        return true;
    }
    else if (!"tell".equals(p_70003_2_) && !"help".equals(p_70003_2_) && !"me".equals(p_70003_2_))
    {
        if (this.mcServer.getConfigurationManager().func_152596_g(this.getGameProfile()))
        {
            UserListOpsEntry userlistopsentry = (UserListOpsEntry)this.mcServer.getConfigurationManager().func_152603_m().func_152683_b(this.getGameProfile());
            return userlistopsentry != null ? userlistopsentry.func_152644_a() >= p_70003_1_ : this.mcServer.getOpPermissionLevel() >= p_70003_1_;
        }
        else
        {
            return false;
        }
    }
    else
    {
        return true;
    }
}
项目:DebugServerInfo    文件:ServerHelper.java   
private boolean hasPermission(EntityPlayer player)
{
    if (permissionLevelRequired == -1) return true;
    MinecraftServer s = FMLCommonHandler.instance().getMinecraftServerInstance();
    if (!s.isDedicatedServer() && s.getServerOwner().equals(player.getName())) return true;
    UserListOpsEntry entry = s.getPlayerList().getOppedPlayers().getEntry(player.getGameProfile());
    //noinspection ConstantConditions LIES! It can be null, when the player is not an OP
    return entry != null && entry.getPermissionLevel() >= permissionLevelRequired;
}
项目:morecommands    文件:CommandExecute.java   
private static boolean playerHasRequestLevel(EntityPlayerMP player) {
    if (MoreCommandsConfig.minExecRequestLevel == 0) return true;
    else {
        if (player.getServer().getPlayerList().canSendCommands(player.getGameProfile())) {
            UserListOpsEntry entry = (UserListOpsEntry) player.getServer().getPlayerList().getOppedPlayers().getEntry(player.getGameProfile());
            return entry != null ? entry.getPermissionLevel() >= MoreCommandsConfig.minExecRequestLevel : player.getServer().getOpPermissionLevel() >= MoreCommandsConfig.minExecRequestLevel;
        }
        else return false;
    }
}