My first Plugin. But need help.

Discussion in 'Plugin Development' started by cruz2000, Oct 29, 2013.

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

    cruz2000

    Alright so am starting to make my own plugin but i get this error Ive been using the Plugin tutorial on wiki and following the steps and reading and learning.And the plugin i want to make is [Killing the player]. I get this line in set health and i dont know why.

    Screen shot 2013-10-29 at 9.34.27 PM.png
     
  2. Offline

    MineDoubleSpace

    cruz2000 setHealth(0.0);
    setHealth(0); will give you a warning but it will still work.
     
  3. Offline

    remremrem

    the line usually means that the method "setHealth" is deprecated. Deprecated means that some time in the future, bukkit will probably remove the setHealth method, and at that time any plugin using the deprecated method will no longer function properly.

    Before they remove the deprecated method, bukkit will introduce an alternative method to accomplish the same task, and it will be the responsibility of plugin developers to update their plugins to use the new methods.

    In this case of setHealth(0), using an Integer as the argument is deprecated, the preferred method uses a double instead: setHealth(0.0)
     
  4. Offline

    sgavster

    cruz2000 Try to use target.setHealth(target.getHealth() - target.getHealth());?
     
  5. Offline

    Jake6177

    Why not just set it to 0 rather than making the server do a calculation (albeit simple)?
     
  6. Offline

    johnnywoof

    p.damage(p.getMaxHealth());

    Use that? It will also do animation :D
     
    TheCombatCA and Jake6177 like this.
  7. Offline

    Appljuze

    Not necessary, just use 0.0 or 0D with the setHealth() method :)
     
  8. Offline

    cruz2000

    Thank you all! helped :). Very pleased with the help here! Thank you . You are all helpful! But one problem :( .

    Code:java
    1. 23:05:44 [INFO] cruz2000 issued server command: /killplayer
    2. 23:05:44 [SEVERE] null
    3. org.bukkit.command.CommandException: Unhandled exception executing command 'killplayer' in plugin KillingPlayer v1.0
    4. at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46)
    5. at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:192)
    6. at org.bukkit.craftbukkit.v1_6_R3.CraftServer.dispatchCommand(CraftServer.java:528)
    7. at net.minecraft.server.v1_6_R3.PlayerConnection.handleCommand(PlayerConnection.java:968)
    8. at net.minecraft.server.v1_6_R3.PlayerConnection.chat(PlayerConnection.java:886)
    9. at net.minecraft.server.v1_6_R3.PlayerConnection.a(PlayerConnection.java:837)
    10. at net.minecraft.server.v1_6_R3.Packet3Chat.handle(SourceFile:49)
    11. at net.minecraft.server.v1_6_R3.NetworkManager.b(NetworkManager.java:296)
    12. at net.minecraft.server.v1_6_R3.PlayerConnection.e(PlayerConnection.java:116)
    13. at net.minecraft.server.v1_6_R3.ServerConnection.b(SourceFile:37)
    14. at net.minecraft.server.v1_6_R3.DedicatedServerConnection.b(SourceFile:30)
    15. at net.minecraft.server.v1_6_R3.MinecraftServer.t(MinecraftServer.java:592)
    16. at net.minecraft.server.v1_6_R3.DedicatedServer.t(DedicatedServer.java:227)
    17. at net.minecraft.server.v1_6_R3.MinecraftServer.s(MinecraftServer.java:488)
    18. at net.minecraft.server.v1_6_R3.MinecraftServer.run(MinecraftServer.java:421)
    19. at net.minecraft.server.v1_6_R3.ThreadServerApplication.run(SourceFile:583)
    20. Caused by: java.lang.Error: Unresolved compilation problem:
    21. o cannot be resolved
    22.  
    23. at me.cruz2000.KillingPlayer.onCommand(KillingPlayer.java:27)
    24. at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44)
    25. ... 15 more
    26. >
    27.  


    I get this error.
     
Thread Status:
Not open for further replies.

Share This Page