Development Assistance Help with countdown using TitleAPI

Discussion in 'Plugin Help/Development/Requests' started by sistem21, May 21, 2015.

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

    sistem21

    Hy guys i'm looking for anyone that can help me!I'd like to know ho create a countdown that starts at command /countdown [int] ! For example if i do /countdown 10 ,will start a countdown that allerts you every second until it finish.. But when countdown starts,it will appear on your monitor a Title,as 10,9,8,7,6,5,4,3,2,1,Go!
    But i can also do /countdown 15/20/30/40 or any other number!
     
  2. 1) To countdown start a BukkitRunnable and int check if Time is higher that 0 else cancel
    2) Use a tittle api it will be easier.
     
  3. Offline

    sistem21

    @MaTaMoR_ i'm noob with this..can you code me this?
     
  4. No, you have to code it by yourself, but i will help you a little bit
    Code:
    //I will show how to create a BukkitRunnable
    //You will need a player and the time
    new BukkitRunnable() {
        int time = /time/
        public void run() {
             //Count down stuff
        }
    }.runTaskTimer(instance, 0, 20);
    
     
  5. Offline

    sistem21

    i can do as :
    for(i = 0, i = args[0], i--)
    {
    }
     
  6. Code:
    if(int > 0) {
       message;
    } else {
       end message;
       cancel;
    }
    
     
  7. Online

    timtower Administrator Administrator Moderator

    Moved to Bukkit alternatives.
     
  8. Offline

    sistem21

    @MaTaMoR_ i did it,i use a new TitleApi found on internet,this is the project,but can you say me why it give error in console?
    Project ----> https://www.dropbox.com/home/Countdown
    Error ---->
    Error (open)

    [17:07:39] [Server thread/ERROR]: null
    org.bukkit.command.CommandException: Unhandled exception executing command 'countdown' in plugin Countdown v1.0
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[spigot.jar:git-Spigot-1649]
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:181) ~[spigot.jar:git-Spigot-1649]
    at org.bukkit.craftbukkit.v1_7_R4.CraftServer.dispatchCommand(CraftServer.java:767) ~[spigot.jar:git-Spigot-1649]
    at net.minecraft.server.v1_7_R4.PlayerConnection.handleCommand(PlayerConnection.java:1043) [spigot.jar:git-Spigot-1649]
    at net.minecraft.server.v1_7_R4.PlayerConnection.a(PlayerConnection.java:880) [spigot.jar:git-Spigot-1649]
    at net.minecraft.server.v1_7_R4.PacketPlayInChat.a(PacketPlayInChat.java:28) [spigot.jar:git-Spigot-1649]
    at net.minecraft.server.v1_7_R4.PacketPlayInChat.handle(PacketPlayInChat.java:65) [spigot.jar:git-Spigot-1649]
    at net.minecraft.server.v1_7_R4.NetworkManager.a(NetworkManager.java:186) [spigot.jar:git-Spigot-1649]
    at net.minecraft.server.v1_7_R4.ServerConnection.c(ServerConnection.java:81) [spigot.jar:git-Spigot-1649]
    at net.minecraft.server.v1_7_R4.MinecraftServer.v(MinecraftServer.java:734) [spigot.jar:git-Spigot-1649]
    at net.minecraft.server.v1_7_R4.DedicatedServer.v(DedicatedServer.java:289) [spigot.jar:git-Spigot-1649]
    at net.minecraft.server.v1_7_R4.MinecraftServer.u(MinecraftServer.java:584) [spigot.jar:git-Spigot-1649]
    at net.minecraft.server.v1_7_R4.MinecraftServer.run(MinecraftServer.java:490) [spigot.jar:git-Spigot-1649]
    at net.minecraft.server.v1_7_R4.ThreadServerApplication.run(SourceFile:628) [spigot.jar:git-Spigot-1649]
    Caused by: java.lang.IllegalArgumentException: Plugin cannot be null
    at org.apache.commons.lang.Validate.notNull(Validate.java:192) ~[spigot.jar:git-Spigot-1649]
    at org.bukkit.craftbukkit.v1_7_R4.scheduler.CraftScheduler.validate(CraftScheduler.java:397) ~[spigot.jar:git-Spigot-1649]
    at org.bukkit.craftbukkit.v1_7_R4.scheduler.CraftScheduler.runTaskTimer(CraftScheduler.java:123) ~[spigot.jar:git-Spigot-1649]
    at org.bukkit.craftbukkit.v1_7_R4.scheduler.CraftScheduler.scheduleSyncRepeatingTask(CraftScheduler.java:119) ~[spigot.jar:git-Spigot-1649]
    at org.altervista.sistem21.CountCommand.startTask(CountCommand.java:46) ~[?:?]
    at org.altervista.sistem21.CountCommand.onCommand(CountCommand.java:29) ~[?:?]
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[spigot.jar:git-Spigot-1649]
    ... 13 more

     
  9. Your plugin is null
     
  10. Offline

    sistem21

    I'm very stupid,i forgot to initialize plugin instance :(
    Thank you,now it works,but can you tell me how i send a title when the countdown finishs?
    @MaTaMoR_
     
    Last edited: May 22, 2015
Thread Status:
Not open for further replies.

Share This Page