Solved Checking for Scrubs and Tall Grass

Discussion in 'Plugin Development' started by malikdbuseck, Dec 27, 2014.

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

    malikdbuseck

    Hello Everyone,
    I have been posting a lot lately but I am really trying to learn this stuff and you all have been great help! So dont mind the bad coding but Im wondering if there is a way to detect if a player is inside a Shrub or tall grass(Double variant). Currently this is what I got. Going to use a runnable. My scheduler event is all setup on my main class so dont worry about that.

    So is there a way to see if a player is in tall grass and if so how would I add that to my if statement?

    Code:
    package me.malikdbuseck;
    
    import net.minecraft.server.v1_8_R1.Block;
    
    import org.bukkit.Material;
    import org.bukkit.block.BlockFace;
    import org.bukkit.entity.Player;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerMoveEvent;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class Main extends JavaPlugin implements Listener{
    
          public void onPlayerMove(PlayerMoveEvent event){
             
            Player player = event.getPlayer();
            Block block = (Block) player.getLocation().getBlock().getRelative(BlockFace.DOWN);
           
            if (block.getType() == Material.F{
               
              }
            }
          }
     
  2. Offline

    nitrousspark

    @malikdbuseck You're currently importing net.minecraft.server.v1_8_R1.Block; which you should not be importing. The correct import should be org.bukkit.Block;

    And it also doesn't look like you're registering the event at all, may want to check up on that. I'm not sure what the material for tall grass or scrubs are, they may be the same thing with different data values. Not sure though.
     
  3. Offline

    malikdbuseck

    Opps good catch but I dont know if the are a "block" even thought you place them as one
     
Thread Status:
Not open for further replies.

Share This Page