TabAPI not working?

Discussion in 'Plugin Development' started by Assist, Nov 4, 2013.

Thread Status:
Not open for further replies.
  1. Is TabAPI working? Mine isn't. I don't have any code to provide at the moment, but only 3 lines I used was the setPriority method, update method and setTabString method. I followed the tutorial by the author, but it's not working. No errors in console either, everything else is working.

    Does anyone know if it's outdated or something?
     
  2. Offline

    StevenMG

    I dunno if you already added this or not, just an idea.
     
  3. StevenMG
    Yes, I did. The plugin would alert me if I didn't.
     
  4. Offline

    Goblom

    Assist Post the error you are getting if there is one. Post the code you have.

    Edit: If you are testing your plugin behind a BungeeCord server it might not work... (Forgot the settings to make it work)
     
  5. Goblom
    No errors as I said, also the code I'm using is the example code provided by the author, nothing else.
     
  6. Offline

    Goblom

    Assist Do you have something like this in your code ?
    Code:java
    1. TabAPI TabAPI = Bukkit.getServer().getPluginManager().getPlugin("TabAPI")


    If you don't that is probably why it is not working
     
  7. Goblom
    No, I added the jar in the project library (properties -> build path -> referenced libraries).
     
  8. Offline

    Goblom

    Assist Just doing that wont work. The server needs TabAPIs instance just adding the jar and importing the code does nothing without the instance.

    Currently without that all your TabAPI Stuff is being thrown out for the garbage collector to get.
     
  9. Offline

    ZachBora

    You need to put TabAPI in your plugins folder.
     
  10. Offline

    Janmm14

    Goblom
    But you don't have to get the plugin instance like this.
    Make sure ProtocolLib and TabAPI are in your plugins folder. then add tabapi as a dependecy in your plugin.yml.
     
  11. Goblom
    As this guy above me said,
    Also from the TabAPI developer page:

    Simply download TabAPI then add it to your class path. You are now ready to start coding with the TabAPI!

    ZachBora Janmm14
    I have TabAPI and ProtocolLib in my plugins folder already.

    Edit: I don't know what happened, but it's working now.
    Edit2: Well I just noticed that the tab list can't contain 2 same strings.. how unfortunate, this really ruins my plan. Does anyone know a workaround for that?
     
  12. Offline

    ZachBora

    Assist You can add spaces or colors at the end of the text. I believe however that TabAPI already has a function you can call for that.
     
  13. ZachBora
    I guess the nextNull() is what you're talking about, I'll look into it later.

    I'm also having a slight problem with string placement, I'll post a screenshot and code later.

    Edit: So I wrote a quick test code
    Code:java
    1. for (int i = 0; i < alphaSortedMap.size(); i++) {
    2. TabAPI.setTabString(this, player, i, 0, "Player" + i);
    3. TabAPI.setTabString(this, player, i, 1, "Kills - " + new Random().nextInt(99) + 1);
    4. TabAPI.setTabString(this, player, i, 2, "Deaths - " + new Random().nextInt(99) + 1);
    5. TabAPI.nextNull();
    6. TabAPI.updatePlayer(player);
    7. }
    Here is how I want it to look like
    Show Spoiler

    But the spacing seems to be random, sometimes it looks like this
    Show Spoiler

    Most of the time it seems to be correct, but sometimes not. Does anyone have any idea what might cause this?
     
  14. Offline

    ZachBora

    Assist I think you put the nextNull IN the setTabString
     
  15. ZachBora
    I tried that, but it doesn't work. It definitely has to do with trying to use a string in the tab list that already exists, it messes up rest of the text. nextNull should work, as stated in the change log of the project.

    Exposed TabAPI.nextnull(); which returns a unique string which can be used to ensure a string is unique. For example, str + TabAPI.nextNull() wil ensure that str is unique

    Code:java
    1. for (int i = 0; i < alphaSortedMap.size(); i++) {
    2. TabAPI.setTabString(this, player, i, 0, "Player" + i);
    3. TabAPI.setTabString(this, player, i, 1, "Kills - 1" + TabAPI.nextNull());
    4. TabAPI.setTabString(this, player, i, 2, "Deaths - 1" + TabAPI.nextNull());
    5. }

    I tried to display several same "Kills - 1" and "Deaths - 1", though it fails to do so after the first one has been displayed. Thanks for the suggestions, got any more? :p

    Edit: I tried adding TabAPI.nextNull() before the string, and it indeed uses colors to make them unique, but it still fails after the first one.

    Edit2: I figured I'd just add a number (representing player id) behind their kills and deaths. Solved.
     
Thread Status:
Not open for further replies.

Share This Page