Please help.

Discussion in 'Plugin Development' started by Mr_Squidels, Feb 3, 2014.

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


    Hello, I am in need of help. So basically what's happening in my code is I've got some code running the throw tnt, etc. So I added a cooldown, tried it and what's happing is the first time when I use the throw tnt, it works, then when I click it again it says "please wait another 1 second" which is good but then it doesn't even work after the message is gone. My throw tnt isn't working anymore. Have I forgot to check if they are still in the cooldown or what? Please tell me what I've done wrong, thanks!

        ArrayList<String>cooldown = new ArrayList<String>();
        public void onShoot(PlayerInteractEvent e) {
            final Player player = e.getPlayer();
            if (e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
                        if (player.getItemInHand().getType() == Material.TNT) {
                            UtilPlayer u = Splode.getSplode().pm.getPlayer(player);
                            if (u.getGame() != null && u.isAlive()) {     
                                if (u.getGame().getStatus() == Status.INGAME) {
                                      Player player1 = e.getPlayer();
                                      if(!cooldown.contains(player.getName())) {
                                        if(player1.getInventory().getItemInHand().getType() == Material.TNT && e.getAction() == Action.RIGHT_CLICK_AIR);
                                        player1.playSound(player1.getLocation(), Sound.NOTE_BASS, 1F, 1F);
                                        TNTPrimed tnt = (TNTPrimed)player1.getWorld().spawnEntity(player1.getEyeLocation(), EntityType.PRIMED_TNT);
                                        Splode.getSplode().chat.sendMessage(player, "&9Please wait another 1 second to use this again!");
                                        Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
                                            public void run(){
                                            Splode.getSplode().chat.sendMessage(player, "&9You can use Throw TNT again!");
                                            }, 40L);
  2. Offline


    It's easier if you use a HashMap
  3. Offline


    sorry, for the late reply... bump.
Thread Status:
Not open for further replies.

Share This Page