TitleAPI

Discussion in 'Spigot Plugin Development' started by MrHardyCZ, May 13, 2016.

  1. Hi. I'm want to change normal chat countdown to Titles.

    public void onTick() {
    if (this.timer <= 0 || this.gameState == GameState.WAITING && !this.hasReachedMinimumPlayers()) {
    return;
    }
    --this.timer;
    switch (this.gameState) {
    case WAITING: {
    if (this.timer == 0) {
    this.onGameStart();
    break;
    }
    if (this.timer % 10 != 0 && this.timer > 5) break;
    this.sendMessage("§a§l" + this.timer + "§r§f second to start fight!");
    break;
    }
    }
    }

    But if i change to TitleAPI it doesn't work.
    public void onTick() {
    if (this.timer <= 0 || this.gameState == GameState.WAITING && !this.hasReachedMinimumPlayers()) {
    return;
    }
    --this.timer;
    switch (this.gameState) {
    case WAITING: {
    if (this.timer == 0) {
    this.onGameStart();
    break;
    }
    if (this.timer % 10 != 0 && this.timer > 5) break;
    TitleAPI.sendTitle(p, Integer.valueOf(5), Integer.valueOf(20), Integer.valueOf(5), "§4§lNot permitted!", "You don't have permissions!");
    break;
    }
    }
    }

    Thanks for any help! :)
     
  2. What doesn't work?
     
    • Like Like x 1
  3. Titles. I have some errors in console.

    [20:07:51] [Server thread/WARN]: [SkyWars] Task #6 for SkyWars v1.1-m16 generated an exception
    java.lang.NoSuchMethodError: vc.pvp.skywars.game.Game.onTick()V
    at vc.pvp.skywars.tasks.SyncTask.run(SyncTask.java:13) ~[?:?]
    at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftTask.run(CraftTask.java:71) ~[minecraft_server.jar:git-Spigot-db6de12-18fbb24]
    at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:350) [minecraft_server.jar:git-Spigot-db6de12-18fbb24]
    at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:723) [minecraft_server.jar:git-Spigot-db6de12-18fbb24]
    at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:374) [minecraft_server.jar:git-Spigot-db6de12-18fbb24]
    at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:654) [minecraft_server.jar:git-Spigot-db6de12-18fbb24]
    at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:557) [minecraft_server.jar:git-Spigot-db6de12-18fbb24]
    at java.lang.Thread.run(Unknown Source) [?:1.8.0_77]
     
  4. What is on SyncTask.java:13 line 13\

    Edit: Did you added TitleApi to the server?
     
    • Like Like x 1
  5. MiniDigger

    Supporter

    again: what kind of title api are you using? does it support your (outdated) version?
     
  6. MiniDigger

    Supporter

    looks like your compiler fucked up. Try recompling your plugin and restarting the server
     
  7. yes
     
  8. I have TitleAPI.sendTitle(p, Integer.valueOf(5), Integer.valueOf(20), Integer.valueOf(5), "§a§l" + this.timer , "second to start fight");
    red lined in Eclipse.
     
  9. MiniDigger

    Supporter

    oh, nice that you mentioned that so soon. Thats essential to your problem :D
    You need to add the title api as a dependency to your project (if you use maven) or to your buildpath (if you don't)
     
  10. I have it..
     
  11. MiniDigger

    Supporter

    then show us what eclipse actualy says. Red line is not very informative...
    Hover over it and write the real error message down here
     
  12. Lol, if the plugin is in 1.7 titles won't work..
    Titles where added in 1.8 lol.
     
  13. MiniDigger

    Supporter

    wat
    where did you save that he is using 1.7?
    he is running a v1_8_R3 build
     
  14. 1.7.3 it's version of plugin.. i have v1_8_R3
     
  15. he's ask me to plugin and version od plugin.. -.-
     
  16. @MrHardyCZ
     
  17. Now i don't have it red lined, but i have same error in console
     
    #18 MrHardyCZ, May 13, 2016
    Last edited: May 13, 2016
  18. Please, can someone help me?
     
  19. @MrHardyCZ show error. If it's the exact same thing there's still an error somewhere