I'm missing a method D:

Discussion in 'Plugin Development' started by MrGermanrain, Jul 16, 2013.

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

    MrGermanrain

    I can't figure out how to take damage off the wither effect. I have no clue where to start because this is my first real project. I am new with Java and the Bukkit so please don't hate ;)

    Here is my code so far:
    Code:java
    1. package me.mrgermanrain.wither;
    2.  
    3. import java.util.logging.Logger;
    4. import org.bukkit.ChatColor;
    5. import org.bukkit.command.Command;
    6. import org.bukkit.command.CommandSender;
    7. import org.bukkit.entity.Player;
    8.  
    9. import org.bukkit.plugin.PluginDescriptionFile;
    10. import org.bukkit.plugin.java.JavaPlugin;
    11. import org.bukkit.potion.PotionEffect;
    12. import org.bukkit.potion.PotionEffectType;
    13.  
    14. public class wither extends JavaPlugin{
    15. public final Logger logger = Logger.getLogger("Minecraft");
    16. public static wither plugin;
    17.  
    18. @Override
    19. public void onDisable() {
    20. PluginDescriptionFile pdfFile = this.getDescription();
    21. this.logger.info(pdfFile.getName() + " has been Disabled!");
    22. }
    23.  
    24. @Override
    25. public void onEnable() {
    26. PluginDescriptionFile pdfFile = this.getDescription();
    27. this.logger.info(pdfFile.getName() + " Version " + pdfFile.getVersion() + " has been Enabled!");
    28. }
    29.  
    30. public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String args[]){
    31. if(commandLabel.equalsIgnoreCase("wh")){
    32. Player player = (Player) sender;
    33. if(sender.hasPermission("wither.change")){
    34. player.addPotionEffect(new PotionEffect(PotionEffectType.WITHER,18000, 0));
    35. player.sendMessage(ChatColor.DARK_RED + "You are withered!");
    36. return true;
    37. }
    38. }
    39. return false;
    40.  
    41. }
    42. }
    43.  


    This gives the wither effect (Has been tested) but the player still gets damaged from the wither effect :/
     
  2. Offline

    adam753

    You would start by listening to the onPlayerDamage event. If you don't know what that means, have a look at this tutorial.
     
  3. Offline

    MrGermanrain

    Thanks for the help, ill look to see if i can do it :)

    I can't figure it out. If someone could help me that would be nice :)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 3, 2016
Thread Status:
Not open for further replies.

Share This Page