Solved Player click to bed not work

Discussion in 'Plugin Development' started by Xogos1997, Dec 16, 2015.

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

    Xogos1997

    please.. dont write here: "Learn java basic problem" thx.

    i checking if player click to bed. but this is not work..

    Code:
            if(event.getClickedBlock().getType() == Material.BED)
            {
                if(Main.Unava[ID] < 90)
                {
                    Funkce.FreezePlayerTime(player, 10);
                    Main.Unava[ID] = 100f;
                    player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS,20*10,20*10));  
                    Funkce.CreateScoreEx(player);
                    }else{
                    player.sendMessage(ChatColor.GOLD + "[Ja] "+ ChatColor.GREEN + "zas tak nejsem unaveny.");
                }
                event.setCancelled(true);
            }
    
     
    Last edited: Dec 16, 2015
  2. Offline

    Declan5486

    Code:
        @EventHandler
        public void bedRightClickEvent(PlayerInteractEvent e) {
            Player p = e.getPlayer();
            if(e.getAction() == Action.RIGHT_CLICK_BLOCK) {
            if(e.getClickedBlock().getType() == Material.BED_BLOCK) {
            // CODE HERE
           }
          }
         }
     
  3. Offline

    Xogos1997

    Okey i solved my problem.. BED is item and i need BED_BLOCK :D sorry for this topic
     
  4. Offline

    Declan5486

    Set its tag to solved
     
  5. Offline

    Xogos1997

    nice edit... :D

    [​IMG]

    rekt :D
     
  6. Offline

    Declan5486

    xD i forgot the _BLOCK at the end
     
    Xogos1997 likes this.
Thread Status:
Not open for further replies.

Share This Page