Help Needed - Trying to get my custom TAB plugin to work

Discussion in 'Spigot Plugin Development' started by IJMX, May 16, 2016.

  1. Greetings! So I've recently worked on a TAB plugin for a server. The idea is to get a tab header and footer to work correctly. So the plugin is exported with no errors, no console errors, etc. Only issue, it does nothing on the server...

    Spigot: 1.8.8
    API: https://www.spigotmc.org/resources/tablist-and-actionbar-and-title-api-free.9659/

    Code:

    package ijmx;

    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerJoinEvent;
    import org.bukkit.plugin.java.JavaPlugin;

    import de.mrchunkys.api.TabPlayer;

    public class Main extends JavaPlugin implements Listener {

    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent e) {
    TabPlayer tab = new TabPlayer(e.getPlayer());
    tab.sendTabTitle("\n§cBizzareCraft\n", "\n§e§lbizzarecraft.us\n");
    }

    public void onEnable() {
    getLogger().info("BizzareTAB has loaded successfully!");
    }

    public void onDisable() {
    getLogger().info("BizzareTAB has unloaded successfully!");
    }
    }

    Hope you guys can help! Thank you in advance.
     
  2. plugin.yml?
     
  3. On your onEnable add:
    Code (Java):

    getServer().getPluginManager().registerEvents(this, this);
     
     
  4. he says nothing works including onEnable which is weird-

    to the OP does onEnable work or do you just mean the event?
     
  5. Yes, a plugin.yml was made.

    name: BizzareTAB
    version: 1.0
    main: ijmx.Main
     
  6. Okay, so I have added that line.
    On console, I receive this: http://imgur.com/WfsZzJo

    Code [updated]:

    package ijmx;

    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerJoinEvent;
    import org.bukkit.plugin.java.JavaPlugin;

    import de.mrchunkys.api.TabPlayer;

    public class Main extends JavaPlugin implements Listener {

    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent e) {
    TabPlayer tab = new TabPlayer(e.getPlayer());
    tab.sendTabTitle("\n§cBizzareCraft\n", "\n§e§lbizzarecraft.us\n");
    }

    public void onEnable() {
    getServer().getPluginManager().registerEvents(this, this);
    getLogger().info("BizzareTAB has loaded successfully!");
    }

    public void onDisable() {
    getLogger().info("BizzareTAB has unloaded successfully!");
    }
    }
     
  7. Make sure you've defined the API as a dependency in your plugin.yml and that the API is installed on the server.
     
  8. Unfortunately that did not solve the issue :/

    The error message remains. Is there something I'm doing wrong, or forgetting to add?
     
  9. Please post the error message, plugin.yml, and code to http://hastebin.com, and paste the links here.
     
    • Agree Agree x 1
  10. Two things:

    First here is an example of a tab list where you do not need to use an API as its quite simple:
    Code (Text):
    PacketPlayOutPlayerListHeaderFooter list = new PacketPlayOutPlayerListHeaderFooter(IChatBaseComponent.ChatSerializer.a("{\"text\":\"TEST\", \"color\":\"red\", \"bold\":\"true\"}"));
           
            try {
               
                Field fieldB = list.getClass().getDeclaredField("b");
                fieldB.setAccessible(true);
                fieldB.set(list, IChatBaseComponent.ChatSerializer.a("{\"text\":\"Test 1.0!\", \"color\":\"red\", \"bold\":\"true\"}"));
               
            } catch (NoSuchFieldException | IllegalAccessException x) {
                x.printStackTrace();
            }
           
            ep.playerConnection.sendPacket(list);
           
            ep.playerConnection.sendPacket(title);
    Secondly, the prefixes in tab are not handled by tab, but by the nametags above the users head.
     
  11. ep.playerConnection.sendPacket(list);

    ep.playerConnection.sendPacket(title);

    I get "ep cannot be resolved"
     
  12. If u use GroupManager(Bit better in my opinion) you can use vault and set them in the tab :).
     
  13. Event player. You set this on join. Player ep = (Player) e.getPlayer();