[Urgent] Sound on Player Death

Discussion in 'Plugin Development' started by XxZHALO13Xx, Jun 4, 2014.

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

    XxZHALO13Xx

    When A Player Dies.. How would i make a sound play and it say in chat.. "PLAYERNAME Has Been Eliminated! GG" Thanks for help
     
  2. Offline

    Konkz

    From this I can gather you did not bother looking for any tutorial or research neither did you bother to learn Bukkit API.

    I can assume you did not even learn Java in advance else you'd research but this can be wrong.

    Code:
    Listen to player death event
    broadcastMessage (getPlayersName + " has been eliminated")
    play sound to player (google and javadocs)
     
  3. Offline

    XxZHALO13Xx

    i know java.. i have looked it up.. i dont know bukkit very well but im trying to understand it...

    public class Core extends JavaPlugin implements Listener{

    public void onEnable() {


    public void onPlayerDeath (PlayerDeathEvent event)
    {

    Thats a little of my code... i have errors onPlayerDeath (PlayerDeathEvent event) "Cannot Resolve and ; expected"
     
  4. Offline

    Konkz

    You never added a brace to end onEnable's method.
    And here you go: http://jd.bukkit.org/rb/apidocs/

    EDIT: You sure you know Java? You tried to nest a method inside a method?
     
  5. Offline

    XxZHALO13Xx

    Yes... my mistake on that sorry.. but i did fix it but no sound plays... heres the file..

    Code:java
    1. public class Core extends JavaPlugin implements Listener{
    2.  
    3. public void onEnable() {
    4.  
    5.  
    6. }
    7. @EventHandler
    8. public void onPlayerDeath(PlayerDeathEvent e) {
    9. Bukkit.getServer().broadcastMessage(getName() + ChatColor.AQUA + " Has Been Eliminated! GG!");
    10. for (Player p : Bukkit.getOnlinePlayers()) {
    11. p.playSound(p.getLocation(), Sound.WITHER_DEATH, 10, 2);
    12.  
    13. {
    14.  
    15. }
    16. }
    17. }
    18.  
    19. }
     
Thread Status:
Not open for further replies.

Share This Page