Remove the Cooldown and the use (Kit PvP)

Discussion in 'Plugin Development' started by MaxNatural, Aug 8, 2014.

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

    MaxNatural

    So what I am trying to do is on the player death it remove the cooldown of the kit and the used kit that they choose so that they have a different kit after they die. This is the main core but its not working for me.
    Code:java
    1. @EventHandler
    2. public void playerDeath(PlayerDeathEvent e) {
    3. Player p = e.getEntity().getPlayer();
    4. usedkit.remove(p.getName());
    5. cooldown.remove(p.getName());
    6. magician.remove(p.getName());
    7. }
     
  2. Offline

    JustinsCool15

    MaxNatural
    What's not working?
    Are you getting any errors?
    Can you clarify what you're trying to do because I don't really understand?
     
  3. Offline

    QuipCream

    MaxNatural Do you mind posting your full code?
     
  4. Offline

    MaxNatural

    JustinsCool15 When the player dies I want it so that the player can choose another kit after it. So if they do /suicide or die by another guy. it says You can not choose another kit. But I want them to be able to choose another kit after they die. As well if they still have the special item cooldown I want to remove that as well but that does work just not removing the used kit.

    QuipCream


    Code:java
    1. package me.max;
    2.  
    3. import java.util.ArrayList;
    4. import java.util.List;
    5.  
    6. import me.max.cmds.Beast;
    7. import me.max.cmds.Knight;
    8. import me.max.cmds.Magician;
    9. import me.max.cmds.PvP;
    10. import me.max.events.Magician2;
    11.  
    12. import org.bukkit.entity.Player;
    13. import org.bukkit.event.EventHandler;
    14. import org.bukkit.event.Listener;
    15. import org.bukkit.event.entity.PlayerDeathEvent;
    16. import org.bukkit.plugin.PluginManager;
    17. import org.bukkit.plugin.java.JavaPlugin;
    18. import org.bukkit.potion.PotionEffect;
    19.  
    20.  
    21. public class KitMain extends JavaPlugin
    22. implements Listener
    23. {
    24. public static String KIT = "§9KitPvP> §7";
    25. public static List<String> usedkit = new ArrayList<String>();
    26. public static List<String> magician = new ArrayList<String>();
    27. public static List<String> cooldown = new ArrayList<String>();
    28. @Override
    29. public void onEnable() {
    30. commands();
    31. listeners();
    32.  
    33.  
    34. System.out.println("MSKits has been enabled!");
    35. }
    36.  
    37.  
    38.  
    39. public void onDisable() {
    40. System.out.println("MSKits has been disabled!");
    41. }
    42.  
    43. public void commands() {
    44. getCommand("pvp").setExecutor(new PvP(this));
    45. getCommand("beast").setExecutor(new Beast(this));
    46. getCommand("magician").setExecutor(new Magician(this));
    47. getCommand("knight").setExecutor(new Knight(this));
    48. }
    49.  
    50. public void listeners() {
    51. PluginManager pm = getServer().getPluginManager();
    52. pm.registerEvents(new Magician2(this), this);
    53.  
    54.  
    55. }
    56. @EventHandler
    57. public void playerDeath(PlayerDeathEvent e) {
    58. Player p = e.getEntity().getPlayer();
    59. usedkit.remove(p.getName());
    60. cooldown.remove(p.getName());
    61. magician.remove(p.getName());
    62. }
    63. @EventHandler
    64. public void playerDeath1(PlayerDeathEvent e) {
    65. Player p = e.getEntity().getPlayer();
    66. for (PotionEffect effect : p.getActivePotionEffects())
    67. p.removePotionEffect(effect.getType());
    68. }
    69. }


    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  5. Offline

    QuipCream

    MaxNatural Have you added the cooldowns the the commands?
     
  6. Offline

    MaxNatural

    QuipCream No its for the special items in each kit like magician would have a invisibility stick that has a cooldown.
     
  7. Offline

    QuipCream

    MaxNatural Have you even tested to see that it works?
     
  8. Offline

    MaxNatural

    QuipCream It does not work. Neither does the cool down now. It always says its on cool down.
     
Thread Status:
Not open for further replies.

Share This Page