On death Code dose not work

Discussion in 'Plugin Development' started by matanrak, Apr 21, 2014.

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

    matanrak

    I got a code a game i am working on and for a reason its anti working!
    can you please take a look?

    Code:java
    1.  
    2. @EventHandler
    3. public void Death(EntityDeathEvent event) {
    4. Player p = (Player) event.getEntity();
    5. Player k = p.getKiller();
    6.  
    7. p.teleport(this.loc);
    8.  
    9.  
    10. int games = (int) Bukkit.getPluginManager().getPlugin("Minataour").getConfig().get("games");
    11. Block block = yourLocation.getBlock();
    12.  
    13. Sign sign = (Sign)block.getState();
    14.  
    15. if((k.getInventory().contains(Material.IRON_AXE)) && maze.getPlayers().equals("1")){{
    16.  
    17. Bukkit.broadcastMessage(ChatColor.DARK_GRAY.toString() + "[" + ChatColor.GRAY.toString() + "The Minataur"+ ChatColor.DARK_GRAY.toString() + "] " + ChatColor.DARK_RED + "The Minataur Have Won The Game!");
    18. Bukkit.broadcastMessage(ChatColor.DARK_GRAY.toString() + "[" + ChatColor.GRAY.toString() + "The Minataur"+ ChatColor.DARK_GRAY.toString() + "] " + ChatColor.DARK_RED + "Arena restarting in 20 Sec!");
    19. Bukkit.getPluginManager().getPlugin("Minataour").getConfig().set("games", 1);
    20.  
    21.  
    22.  
    23.  
    24. new BukkitRunnable(){
    25.  
    26. private Location loc = new Location(cw, 2754.52424, 64, -1029.70000);
    27.  
    28. public void run(){
    29.  
    30. for(Player player : maze.getPlayers() ){
    31.  
    32.  
    33. player.setLevel(number2);
    34. }
    35. if(number2 != -1){
    36. if(number2 !=0){
    37. number2--;
    38.  
    39. }else
    40.  
    41. for(Player player : maze.getPlayers() ){
    42.  
    43. player.teleport(this.loc);
    44. }
    45.  
    46. Bukkit.broadcastMessage(ChatColor.DARK_GRAY.toString() + "[" + ChatColor.GRAY.toString() + "The Minataur"+ ChatColor.DARK_GRAY.toString() + "] " + ChatColor.GREEN + "Your now back the the Arcade!");
    47.  
    48. this.cancel();
    49.  
    50.  
    51. }
    52.  
    53.  
    54.  
    55. }
    56. }.runTaskTimer(this, 0L, 20L);
    57.  
    58.  
    59.  
    60.  
    61. new BukkitRunnable(){
    62. private Location loc = new Location(cw, 2754.52424, 64, -1029.70000);
    63.  
    64. public void run(){
    65.  
    66. for(Player player : maze.getPlayers() ){
    67. player.setLevel(number2);
    68. }
    69. if(number2 < 10) {
    70.  
    71. for(Player player : maze.getPlayers() ){
    72. player.getWorld().playSound(player.getLocation(), Sound.NOTE_BASS, 1.0F, 17.0F);
    73.  
    74.  
    75. }
    76.  
    77. }
    78.  
    79. if(number2 != -1){
    80.  
    81. if(number2 !=0){
    82. number2--;
    83.  
    84. }else {
    85.  
    86.  
    87. for(Player player : maze.getPlayers() ){
    88.  
    89. player.teleport(this.loc);
    90.  
    91. this.cancel();
    92.  
    93.  
    94. }
    95.  
    96. Bukkit.broadcastMessage(ChatColor.DARK_GRAY.toString() + "[" + ChatColor.GRAY.toString() + "The Minataur"+ ChatColor.DARK_GRAY.toString() + "] " + ChatColor.GREEN + "Your now back in the arcade!");
    97.  
    98.  
    99.  
    100.  
    101.  
    102. this.cancel();
    103.  
    104.  
    105. }
    106. }
    107. }
    108.  
    109. }.runTaskTimer(this, 0L, 20L);
    110. }
    111.  
    112. }
    113. }
    114.  
    115.  
    116.  
     
  2. Offline

    xAstraah

    Any stacktrace? That would be helpful. :)
     
  3. Offline

    Krotass

    Register the event?
     
  4. Offline

    Schaakmatth

    public void onPlayerDeath //your stuff
     
  5. Offline

    itzrobotix

    Fixed a few issues not sure what the problem is though.
     
  6. Offline

    matanrak

    still not working D:
    but thanks man
     
  7. Offline

    itzrobotix

    Ok post entire code and what are you trying to do and what is wrong?
     
  8. Offline

    matanrak

  9. Offline

    Garris0n

     
    itzrobotix likes this.
Thread Status:
Not open for further replies.

Share This Page