Development Assistance Can not send title.

Discussion in 'Plugin Help/Development/Requests' started by Kargond, Jun 10, 2015.

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

    Kargond

    Hi! I can't send title(or subtitle) to player. Here is line, where I send title.
    Code:
    TitleLib(p, TITLE, "owh god this is awesome!", 10, 60, 10, ChatColor.GREEN);
    .
    And here is my TitleLib function:
    Code:
        public TitleLib(Player player, EnumTitleAction titleType, String text, int fadeInTime, int showTime, int fadeOutTime, ChatColor color)
        {
            IChatBaseComponent chatTitle = ChatSerializer.a("{\"text\": \"" + text + "\",color:" + color.name().toLowerCase() + "}");
       
            if(titleType != EnumTitleAction.TITLE && titleType != EnumTitleAction.SUBTITLE) return;
            PacketPlayOutTitle title = new PacketPlayOutTitle(titleType, chatTitle);
            PacketPlayOutTitle length = new PacketPlayOutTitle(fadeInTime, showTime ,fadeOutTime);
       
            ((CraftPlayer) player).getHandle().playerConnection.sendPacket(title);
            ((CraftPlayer) player).getHandle().playerConnection.sendPacket(length);
        }
    
    It underlines TITLE word from 1st section of code and says:
    TITLE cannot be resolved to a variable

    Well, when I changed it to EnumTitleAction.TITLE . It underlined TitleLib and said The method TitleLib(Player, EnumTitleAction, String, int, int, int, ChatColor) is undefined for the type InviteSystem.
    How can I fix it?
     
  2. Offline

    pie_flavor

    @Kargond It's telling you that's not what the method is asking for, it's asking for different things. Look up the documentation and give it what it's actually asking for.
     
Thread Status:
Not open for further replies.

Share This Page