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

Close player sign edit window

Comments in 'Plugin Development' started by wolfdale, Mar 25, 2015.

  1. wolfdale
    Offline

    wolfdale Active Member Plugin Developer

    Joined:
    Dec 3, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    ace
    I would like to close the sign edit window before i cancel the blockplaceevent so that the player's client wont crash when they try to place signs in protected area, is that possible?
    FYI, this is the windows i want to close:
    [​IMG]
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Send a direct SetHealthPacket to the player with the exactly same health (or halfheart lower, then later higher, but risk showing the death screen for the player for that)
    wolfdale and iksaku like this.
  3. wolfdale
    Offline

    wolfdale Active Member Plugin Developer

    Joined:
    Dec 3, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    ace
    How to do it by code?
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    PHP:
    /** @var \pocketmine\Player $player */
    $pk = new SetHealthPacket;
    $pk->health $player->getHealth();
    $player->dataPacket($pk);
    wolfdale likes this.
  5. wolfdale
    Offline

    wolfdale Active Member Plugin Developer

    Joined:
    Dec 3, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    ace
    Thank you so much!
  6. aliuly
    Offline

    aliuly Notable Member Plugin Developer

    Joined:
    Feb 8, 2014
    Posts:
    1,086
    Plugins:
    17
    Did that work for you?

    I was trying to do that but in my case the Sign stays open. I am using MCPE v0.10.5 on Android.
  7. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Then $player->getHealth() - 1 instead
  8. aliuly
    Offline

    aliuly Notable Member Plugin Developer

    Joined:
    Feb 8, 2014
    Posts:
    1,086
    Plugins:
    17
    I see the sceen flash in the background the hearts go down but the screen stays open.

    On the other hand, if I catch the Block Place and cancel that, the client crashes.
  9. wolfdale
    Offline

    wolfdale Active Member Plugin Developer

    Joined:
    Dec 3, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    ace
    Me too, i just tried, it didnt work
  10. Angelo Vidrio
    Offline

    Angelo Vidrio Active Member Plugin Developer

    Joined:
    Jan 16, 2014
    Posts:
    123
    Plugins:
    5
    Minecraft User:
    LilCrispy45
    I think an health packet would only close the chat screen, I've never seen it close an sign window.

Share This Page

Advertisement