[DEV] DeathNotes - Need developers to speed the process!

Discussion in 'WIP and Development Status' started by RossCoombs, Nov 29, 2013.

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

    RossCoombs

    Now on BukkitDev: http://dev.bukkit.org/bukkit-plugins/deathnotes/

    Hello! This is my first major plugin project, and I think it's going well.

    DeathNotes is something that began as just a simple PvP plugin that displayed a custom message on player death, then I exploded with ideas, and decided to have a customisable message for EVERY death event. I then realised this wouldn't be an easy feat, so the Bukkit forums was the best place to go.

    I am hoping to get as many events completed by myself as I can, but if you wish to contribute a section of code or another event that should be added then feel free, below I will include more details!

    From here onwards, it's just the stuff that the devs need to read, so if you're interested keep on reading, if not, you might just be wasting your time :)

    Death Events and who is doing them: (Check the replies too, someone might've claimed it already but I haven't updated list)

    Player kills player : Completed - RossCoombs
    Skeleton kills player: Claimed - RossCoombs
    Zombie kills player: Claimed - RossCoombs
    Player drowns: Unclaimed
    Player burns in lava: Unclaimed
    Player burns in fire: Unclaimed
    Player dies from fall damage: Unclaimed

    Please feel free to leave any death events you can think of below, I'll add them to the list. If you are thinking about claiming any of the events and writing the code for them, CHECK THE LIST AND THE REPLIES. Respect that other people may have already started coding parts, don't waste your own or other peoples time by double coding things! :) Also, if you could follow the 'format' I have been using to code it, then that would be very helpful. Thank you.

    Preferred formats:

    Main Class:
    Code:java
    1. public void DEATHEVENT(DEATHEVENT event){
    2.  
    3. if(event.getEntity().getKiller() != null && event.getEntity().getKiller() instanceof Player)
    4. {
    5. Player d = event.getEntity().getPlayer();
    6. Player k = event.getEntity().getKiller(); // Gonna be mobs for other things, but yeah.
    7. event.setDeathMessage(null);
    8. Bukkit.broadcastMessage(Some stuff goes here, mostly configurable)
    9.  
    10.  
    11. }


    Example: Player kills Player
    Get's tough on the broadcasting, but it works haha.
    Code:java
    1. if(event.getEntity().getKiller() != null && event.getEntity().getKiller() instanceof Player)
    2. {
    3. Player d = event.getEntity().getPlayer();
    4. Player k = event.getEntity().getKiller();
    5.  
    6. event.setDeathMessage(null);
    7. String prefix =getString("ServerBrackets") + "[" + getString("ServerColor") + getString("ServerName") + getString("ServerBrackets") + "]" + ChatColor.RESET;
    8. Bukkit.broadcastMessage(prefix + getConfig().getString("PVPMessage").replace("{PLAYER1}", d.getDisplayName()).replace("{PLAYER2}", k.getDisplayName()));
    9. }
    10.  
    11. }
    12. public String getString(String var){
    13. String res = getConfig().getString(var);
    14. return ChatColor.translateAlternateColorCodes('&', res);
    15. }
    16. }
    17.  
    18.  
    19. }
    20. }


    config.yml section for this(Colors and server names are already created in the config, don't need to be created again.
    Code:
     
    #The message displayed to the server when a player kills another player. use {PLAYER1} as killed player and
    #{PLAYER2} as killer.
    PVPMessage: "{PLAYER1} was brutally slaughtered by {PLAYER2}"
     
       
        

    Entire config.yml, if you want to see it:
    Code:
     
    ###################################################################################
    #                                                                                #
    #  DeathNotes Configuration - Set all the messages for different death events!  #
    #                                                                                #
    ###################################################################################
     
    #Contents:
    # 1. Global configuration - Server name and message colours etc.
    # 2. PVP DeathNotes configuration - Messages for PVP deaths.
    #
    #
    #
    #
     
    ############################
    # 1) Global Configuration. #
    ############################
     
    #Name of your server, will appear before death messages
    ServerName: "DeathNotes"
     
    #The colour of your servername. Use &[x] colorcodes Default: Dark Blue
    ServerColor: "&1"
       
    #The color of the brackets surrounding your servername. Use &[x] colorcodes Default: White
    ServerBrackets: "&f"
       
    #The color of the DeathNotes messages. Use &[x] colorcodes Default: Dark Red
    MessageColor: "&4"
       
       
    ####################################
    # 2) PvP DeathNotes Configuration. #
    ####################################
     
    #The message displayed to the server when a player kills another player. use {PLAYER1} as killed player and
    #{PLAYER2} as killer.
    PVPMessage: "{PLAYER1} was brutally slaughtered by {PLAYER2}"
     
       
    


    Thank you for reading, hopefully you can help me;)
     
  2. Offline

    Datdenkikniet

    RossCoombs I am not sure what you want to do, but it doesn't sound too hard, I would like to help! (I can do the fire, lava, and drowning)
     
  3. Offline

    RossCoombs

    Datdenkikniet
    Awesome! Okay, what I'm trying to do is create messages when someone dies. You'll want to create something that decides whether the user was killed in fire/lava/water and then display a message, if you leave the message blank I can sort it out after as I have the config and stoof:)
    Add me on skype if you want: coombs.ross
     
  4. Offline

    Datdenkikniet

    RossCoombs here you go:
    Code:java
    1. @EventHandler
    2. public void DrownEvent(PlayerDeathEvent e){
    3. if (e.getEntity() != null && e.getEntity() instanceof Player){
    4. if (e.getEntity().getLastDamageCause().getCause() == DamageCause.DROWNING){
    5. e.setDeathMessage(ChatColor.translateAlternateColorCodes('&' , getConfig().getString("drowning").replaceAll("{PLAYER}", ((Player) e).getPlayer().getName())));
    6. }
    7. else if (e.getEntity().getLastDamageCause().getCause() == DamageCause.FIRE){
    8. e.setDeathMessage(ChatColor.translateAlternateColorCodes('&', getConfig().getString("fire").replaceAll("{PLAYER}", ((Player) e).getPlayer().getName())));
    9. }
    10. else if (e.getEntity().getLastDamageCause().getCause() == DamageCause.LAVA){
    11. e.setDeathMessage(ChatColor.translateAlternateColorCodes('&', getConfig().getString("lava").replaceAll("{PLAYER}", ((Player)e).getPlayer().getName())));
    12. }
    13. }
    14. }
     
    RossCoombs likes this.
  5. Offline

    RossCoombs

    Datdenkikniet

    Wow, thank you! heh:) Exactly what I wanted, nice work.
     
  6. Offline

    Datdenkikniet

    RossCoombs oh, for the fall damage, check for DamageCause.FALL
     
Thread Status:
Not open for further replies.

Share This Page