Customize Tab?

Discussion in 'Plugin Help/Development/Requests' started by Vextricity, Apr 24, 2015.

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

    Vextricity

    I was just wondering if anybody knew a way to add text to the top and bottom of a tab list, for example how that tab list looks on Mineplex. I wouldn't really want to use an API.

    Example:
    [​IMG]
     
  2. @Vextricity You might need to use ProtocolLib because I believe this deals with packets (correct me if I'm wrong), and would be difficult without it.
     
  3. Invisible

    nverdier

    @Vextricity You can use the Titles class from EnviousAPI (link in signature), or just look at how it works and use the source.
     
  4. Offline

    Tamir

    I'm not sure if it will work... not tested... but:
    Code:
    @EventHandler
    public void playerTablist(PlayerJoinEvent e)
    {
        ArrayList<String> tablist = new ArrayList<>();
        tablist.add("Server");
        tablist.add("Server");
        e.setTablist(tablist);
    }
    You can mess around and add players to it and stuff.
    -Peace.
     
  5. Offline

    LetsTalkTnTHere

    There is a PacketPlayOutHeaderFooter using nms try it
     
  6. Offline

    RainoBoy97

    ...?
     
  7. Offline

    Tamir

    @RainoBoy97 I simply copied it from a plugin page.
    Code:
    Developers:
    
    You can use the "PlayerTablistRefreshEvent" to set a other tablist, or to cancel this event.
    
    Example:
    
    @EventHandler
    public void playerTablist(PlayerTablistRefreshEvent e)
    {
        ArrayList<String> tablist = new ArrayList<>();
        tablist.add("           §e>>>");
        tablist.add("    §cPvP Server");
        tablist.add("           §e<<<");
        tablist.add("§6§l<===========");
        tablist.add("§6§l============");
        tablist.add("§6§l===========>");
           
        e.setTablist(tablist);
    }
    This example will set the player a new custom tablist ;)
    
    http://dev.bukkit.org/bukkit-plugins/fancytab/
     
  8. Offline

    LetsTalkTnTHere

    @Tamir I think he meant the - I think - new feature in 1.8 that you can set a header and footer in the tablist, not editting the players.

    @Vextricity
    Allright I have found it back in my plugin. It is not all that hard, so... Here it goes:
    Code:
        public static void set(Player p,String abovelist, String underlist) {
            EntityPlayer pl = (((CraftPlayer)p).getHandle());
            PlayerConnection c = pl.playerConnection;
            IChatBaseComponent header = ChatSerializer.a("{'text': '" + abovelist+ "'}");
            IChatBaseComponent msg = ChatSerializer.a("{'text': '" + underlist + "'}");
            PacketPlayOutPlayerListHeaderFooter l = new PacketPlayOutPlayerListHeaderFooter(header);
           
            c.sendPacket(l);
           
            try {
                Field field = l.getClass().getDeclaredField("b");
                field.setAccessible(true);
                field.set(l, msg);
            } catch (Exception e) {
                e.printStackTrace();
            } finally {
                c.sendPacket(l);
            }
        }
     
  9. Offline

    RainoBoy97

    Alright, but you had changed the "PlayerTablistRefreshEvent", which by the way is a custom event, to "PlayerJoinEvent".
     
  10. Moved to Bukkit Alternates.
     
Thread Status:
Not open for further replies.

Share This Page