Solved Planting seeds event

Discussion in 'Plugin Development' started by lewysryan, Apr 2, 2015.

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

    lewysryan

    What is the event for when players plant seeds. Block Place Event isn't working.

    Code:
    @EventHandler
        public void onBlockPlace(BlockPlaceEvent e){
    
            if(! e.getBlock().getWorld().getName().equalsIgnoreCase("NCPMC"))
                return;
    
            if(e.isCancelled())
                return;
    
            if(e.getBlock().getType() == Material.SEEDS){
     
  2. Offline

    justin_393

    What's not working about it? Is there an error?
     
  3. Offline

    pie_flavor

    @lewysryan The block type is not Material.SEEDS. The block type is Material.CROPS. Many blocks are placed by items that use different materials, such as beds. Most of them have _ITEM to distinguish the item, but some are harder to understand.
     
    lewysryan and Konato_K like this.
  4. Offline

    lewysryan

    @pie_flavor Should I try Material.fromId(295) ? Thats wheat_seeds. Would that work?
     
  5. Offline

    Konato_K

    @lewysryan Use the actual Material enum object.
     
  6. Offline

    lewysryan

    What one.... I know using IDs isn't good however I can't use crops because it would also include potato, carrot ect...
     
  7. Offline

    Konato_K

    @lewysryan You need to read what people put in here.

     
  8. Offline

    pie_flavor

    @lewysryan One material is one id. What you want to use doesn't come into it. Material.CARROT is carrot crop, Material.CARROT_ITEM is carrot. Same for potatoes.
     
    lewysryan likes this.
  9. Offline

    lewysryan

    Alright got it working. Thanks guys :)
     
Thread Status:
Not open for further replies.

Share This Page