Confused on how to do this

Discussion in 'Plugin Development' started by MrPotatoMuncher, Apr 25, 2014.

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

    MrPotatoMuncher

    Hey, how can I make it so that when a player right clicks a pig named "bob" it does a certain a action?
     
  2. Offline

    Gater12

  3. Offline

    Flybelette

    Code:java
    1. @EventHandler
    2. public void onPlayerInteractEntity(PlayerInteractEntityEvent e){
    3.  
    4. if(e.getRightClicked().getType().equals(EntityType.PIG)){
    5. Pig pig = (Pig)e.getRightClicked();
    6. if(pig.getCustomName().equalsIgnoreCase("Bob")){
    7. //Your code goes here
    8. }
    9. }
    10.  
    11. }
     
Thread Status:
Not open for further replies.

Share This Page