Space

Discussion in 'Plugin Development' started by XgXXSnipz, Oct 30, 2014.

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

    fireblast709

    XgXXSnipz Build your plugins using Bukkit instead of CraftBukkit.
     
  2. Offline

    XgXXSnipz

    fireblast709 works, NOW how can I make it so it will stop choking the player if he puts a glass on his head?
    Code:java
    1. for(Player p : Bukkit.getServer().getOnlinePlayers()){
    2.  
    3.  
    4. if(p.getInventory().getHelmet() != null && p.getInventory().getHelmet().getType() == Material.GLASS){
    5.  
    6.  
    7. if(p.getInventory().getHelmet().getType() == Material.GLASS) {
    8.  
    9.  
    10.  
    11. }
    12.  
    13. }else
    14.  
    15.  
    16. p.playSound(p.getLocation(), Sound.BLAZE_HIT, 1, 3);
    17. p.setHealth(p.getHealth()-2);


    fireblast709 nvm fixed it

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 14, 2016
  3. Offline

    fireblast709

    XgXXSnipz wrap the playSound and setHealth in braces ( '{these things}' ). Right now, the else only affects the playSound.
     
  4. Offline

    XgXXSnipz

    fireblast709 ok all I need help on, IS... how can I make it so when they die they have 5 seconds to get their helmet on before it starts again
     
  5. Offline

    fireblast709

    XgXXSnipz when they respawn, add them to a Set and schedule a removal task. Then, in the loop, check if they are in the Set. If so, continue.

    Note: Since there is no benefit of using Player objects in the Set in this case, just use UUIDs.
     
  6. Offline

    XgXXSnipz

    fireblast709 example plz.. I hate the docs

    Gamecube762, any pointers/examples?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 14, 2016
  7. Offline

    mythbusterma

    XgXXSnipz

    They've basically written this code for you in way too many posts. You should go read the JavaDocs yourself, we are not here because you "hate the docs," we are here if something doesn't work AFTER attempting to do it yourself, or at least BOTHER to look at the documentation.
     
  8. Offline

    XgXXSnipz

    mythbusterma no, I dont need help in the way your probably thinking, I just need help with the respawn method, I know its PlayeRespawnEvent, but IDK where to put it
     
  9. Offline

    Gamecube762

    XgXXSnipz You don't know where to place the event or ... ?

    Code:
    @EventHandler
    public void onRespawn(PlayerRespawnEvent e)
    hashmap.put(e.player , 5)
    end
     
    public void loopingRunnable - every 1 second
    hashmap.put(e.player , x - 1 )
     
    if hashmap.get(e.player) >= 0 then hasmap.remove(e.player)
     
    if !hasmap.contains(e.player) then damage e.player
    end
     
Thread Status:
Not open for further replies.

Share This Page