Can someone test my plugin?

Discussion in 'Plugin Development' started by Zankz, Nov 15, 2014.

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

    Zankz

    I am making a death stare plugin that when an OP types /stare <player> that player dies and a message is displayed in chat. Get it at <Edit by Moderator: Redacted mediafire url>

    Just place the jar in your plugins folder and test it out!

    To give feed back you can leave a reply on this thread!
    Enjoy! :)
    https://github.com/Zankz/DeathStare
     
    Last edited by a moderator: Oct 31, 2016
  2. Offline

    Cirno

    [quote uid=91002335 name="Zankz" post=2890515]I am making a death stare plugin that when an OP types /stare <player> that player dies and a message is displayed in chat. Get it at <Edit by Moderator: Redacted mediafire url>

    Just place the jar in your plugins folder and test it out!

    To give feed back you can leave a reply on this thread!
    Enjoy! :)
    [/quote]

    Several things:
    I didn't test it.
    You should test it yourself. It's easy to setup a basic test server.
    I don't know about other people, but I wouldn't just randomly run a program I just downloaded. It's easy to bind some malicious code to a Bukkit plugin.

    Anyways, I decompiled it and noticed the loop to get a player.
    Bukkit already has a method called Bukkit.getPlayer(String playerName) where it auto-completes if you give the method the start of a player's name.
    Other than that, it "should" work. Don't quote me on that.
     
    Last edited by a moderator: Oct 31, 2016
  3. Offline

    Zankz

    thanks for the feedback i did test it on a server and it worked i was just making sure that it would work on other peoples servers.
     
  4. Offline

    FerusGrim

    Zankz
    Code:java
    1. public void onEnable()
    2. {
    3. getLogger().info("Death Stare works!");
    4. }
    5.  
    6. public void onDisable()
    7. {
    8. getLogger().info("Death Stare broke!");
    9. }
    You don't need to write startup messages. Bukkit already does this. Good job on using the appropriate logger, though.


    Code:java
    1. if ((cmd.getName().equalsIgnoreCase("stare")) && ((sender instanceof Player)))
    This could be changed to:
    Code:java
    1. if (cmd.getName().equalsIgnoreCase("stare") && sender instanceof Player)
    No need for all those parenthesis.


    Code:java
    1. if (player.isOp())
    Nothing actually wrong with this line, but it negates permissions, which you may want to have. I'd do something like:
    Code:java
    1. if(player.isOP() || player.hasPermission("stare"))



    Code:java
    1. int length = args.length;
    2. if (length == 1) {
    Three things here. First, you probably don't need to create a length variable. You only need to have one check against it. Secondly, you should probably have a fail message if that length isn't long enough. Thirdly, your use of brackets becomes inconsistent here, as previously they're all on a newline.
    Code:java
    1. if (args.length > 0) {
    2. // do stuff
    3. } else {
    4. player.sendMessage("You need to specify someone to stare down!");
    5. }
    Note, that I say greater-than 0, because if we do (== 1), we run the risk of getting a fail message if someone inputs another name (which we would rather just ignore).


    Code:java
    1. for (Player playertoHeal : Bukkit.getServer().getOnlinePlayers()) {
    2. if (playertoHeal.getName().equalsIgnoreCase(args[0]))
    Rather than manually looping through the online characters, we can utilize a loop already within Bukkit.
    Code:java
    1. Player playerToKill = getServer().getPlayerExact(args[0])



    Code:java
    1. Bukkit.broadcastMessage(...);
    Why use a static reference to Bukkit (a proxy for Server)?
    Code:java
    1. getServer().broadcastMessage(...)


    Pretty good for a first plugin, though. How I would have written it would be a bit different. Remember, "A good programmer is someone who looks both ways before crossing a one-way street. (Doug Linder)".
     
    _Filip, Gamecube762 and mine-care like this.
  5. Offline

    Zankz

     
Thread Status:
Not open for further replies.

Share This Page