1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Furnace : undefined constant ?

Discussion in 'Development' started by XdmingXD, Apr 28, 2019.

  1. XdmingXD

    XdmingXD Baby Zombie

    Messages:
    158
    GitHub:
    xdmingxd
    Code:
    [Server thread/CRITICAL]: ErrorException: "Use of undefined constant Furnace - assumed 'Furnace' (this will throw an Error in a future version of PHP)" (EXCEPTION)
    
    I wrote this line in the PlayerInteractEvent.
    When I tap on a chest(bc) or a trapped chest, it is working as normal.
    However, the error comes up when I tap on a furnace. What is the error in a future version of PHP?

    PHP:
    use pocketmine\block\Chest as bc;
    use 
    pocketmine\block\TrappedChest;
    use 
    pocketmine\block\Furnace;
    PHP:
    if($event->getBlock() instanceof bc or Furnace or TrappedChest)
     
  2. GamakCZ

    GamakCZ Zombie Pigman

    Messages:
    598
    GitHub:
    GamakCZ
    PHP:
    if($event->getBlock() instanceof bc or $event->getBlock() instanceof Furnace or $event->getBlock() instanceof TrappedChest)
     
  3. GamakCZ

    GamakCZ Zombie Pigman

    Messages:
    598
    GitHub:
    GamakCZ
    Or if you want make it if class exist use
    PHP:
    if($event->getBlock() instanceof bc or class_exists(Furnace::class) or class_exists(TrappedChest::class))
     
    XdmingXD likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.