Solved Death system like overcast network?

Discussion in 'Plugin Development' started by Eliaseeg, Oct 6, 2015.

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

    Eliaseeg

    Hey!

    I'm trying to do somethings with the bukkit API then I tried to do a death system like overcast network, if you don't know, is this:

    [​IMG]

    So, I'm thinking that they cancel the death event and store a countdown in a hashamp. but I have some troubles with the countdown, can you give me some help please? Here's what I have right now.

    Code:
    @EventHandler
        public void onDeath(final EntityDamageEvent event) {
            Entity player = event.getEntity();
            if (player instanceof Player) {
                Player p = (Player) player;
                double damage = event.getDamage();
                double pHealth = p.getHealth();
                if (pHealth - damage <= 0) {
                    taskID4 = scheduler.scheduleSyncRepeatingTask(Main.getPlugin(), new Runnable() {
                        @Override
                        public void run() {
                            for (Player p : Bukkit.getOnlinePlayers()){
                                event.setCancelled(true);
                                p.addPotionEffect(blindness);
                                p.addPotionEffect(nausea);
                                p.addPotionEffect(jump);
                                p.setWalkSpeed(0F);
                            }
                        }
                    }, 0L, 20L);
                }
            }
        }
    e// What I want is a countdown system with decimals, i'm explaining? and a way to store the countdown for every player

    Any help is really appreciated! :)
     
    Last edited: Oct 6, 2015
  2. Offline

    Zombie_Striker

    I don't think you can cancel an event this way (inside the runnable).

    As far as your problem, you never specified what the problem is. You are saying you want to do something, but I do not see why you're not doing it?
     
  3. Offline

    Eliaseeg

    Oh, just forgot to explain.

    I'm trying to get decimals in the runnable, but I don't know how to.
     
  4. Offline

    Zombie_Striker

    @Eliaseeg
    Try Using Doubles(double) instead of Integers(int)
     
  5. Offline

    Eliaseeg

    oh, yeah

    yep, it works, thank you for solve this little issue xD
     
Thread Status:
Not open for further replies.

Share This Page