Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Disable Minecart breaking

Comments in 'Plugin Development' started by Skullex, Apr 7, 2016.

  1. Skullex
    Offline

    Skullex Active Member

    Joined:
    Nov 14, 2015
    Posts:
    212
    Minecraft User:
    Skullex
    How exactly could I disable the ability to break/and or damage the entity Minecart in PocketMine??
  2. dxm_hippie
    Offline

    dxm_hippie Active Member Plugin Developer

    Joined:
    Feb 1, 2015
    Posts:
    413
    Plugins:
    1
    Minecraft User:
    XxDXM_hippiexX
    you could cancel PlayerInteractEvent maybe?
  3. MCPEPIG
    Offline

    MCPEPIG Notable Member

    Joined:
    Jun 22, 2014
    Posts:
    349
    Minecraft User:
    MCPEPIG
    PlayerInteractEvent has nothing to do with breaking minecarts. PlayerInteractEvent is when a player left/right click blocks/air. You should cancel EntityDamageByEntityEvent instead.
    Code:
    PHP:
    public function onDamage(EntityDamageEvent $event){
      
    $entity $event->getEntity();
      if(
    $entity instanceof Minecart){ //Make sure its the entity not item
        
    if($event instanceof EntityDamageByEntityEvent){
          
    $event->setCancelled();
        }
      }
    }
    Skullex, AndrewBit, Primus and 2 others like this.
  4. dxm_hippie
    Offline

    dxm_hippie Active Member Plugin Developer

    Joined:
    Feb 1, 2015
    Posts:
    413
    Plugins:
    1
    Minecraft User:
    XxDXM_hippiexX
    I was just about to say nvm lol
  5. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    There is a button called delete.
    dxm_hippie, Legoboy0215 and Svile like this.
  6. dxm_hippie
    Offline

    dxm_hippie Active Member Plugin Developer

    Joined:
    Feb 1, 2015
    Posts:
    413
    Plugins:
    1
    Minecraft User:
    XxDXM_hippiexX
    Yeah i wasn't thinking :p
  7. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    And you're still not doing so ;)
    TxnneriOS likes this.

Share This Page

Advertisement