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

Solved Is it even possible?

Comments in 'Plugin Development' started by Kvetinac97, Sep 14, 2015.

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

    Kvetinac97 Active Member Plugin Developer

    Joined:
    Nov 17, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    Kvetinac97
    Hi.

    1) I want to make a plugin simulating player. Is it even possible to "simulate" new player?

    2) Can I call any event like here:
    PHP:
    $this->getServer()->getPluginManager()->callEvent(new BlockBreakEvent($player,$block,$item,false));
    or I can call only some events or I can't call events?...
  2. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    It is possible. It has to do something with packets
  3. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Specter is a plugin that simulates a player.
    For events, yes, you can call any events, even your own ones.
    Kvetinac97 likes this.
  4. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    Yes, it is possible. I learned that this was possible(awhile back) from this plugin: https://github.com/EvolSoft/MassiveEconomy
  5. Kvetinac97
    Offline

    Kvetinac97 Active Member Plugin Developer

    Joined:
    Nov 17, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    Kvetinac97
    It's cool. I was exhausted when I was testing plugins; I had to connect to server, find out the bugs, fix them, restart... now I can make fake player and call functions...
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Same, that's why I requested the Specter plugin ;)
    jojoe77777 likes this.
  7. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    I still do that...
    Sometimes I use Spector, but for Interacting etc. you need a real player (Which is me).
  8. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    I'll add it soon.
    Falk likes this.
  9. Kvetinac97
    Offline

    Kvetinac97 Active Member Plugin Developer

    Joined:
    Nov 17, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    Kvetinac97
    I'm making plugin for calling events, but:

    I want call BlockBreakEvent:
    PHP:
    $this->getServer()->getPluginManager()->callEvent(new BlockBreakEvent($player,Block::STONE,Item::EMERALD,false));
    $player = new Player (//and here is the problem.
    For creating new player I need some data packets sent from MCPE itself. However, I'm not playing MCPE (#don'twanttobewarez) so I need simulate it. Specter plugin by @Falk isn't working for PM 1.6 :/[/PHP]
  10. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Read the source code of Specter and see how it works.
  11. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    he want to test his plugins using a fake player :D a think it is not good way
  12. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    That's how I debugged most of the LegionPE commands. Without needing to connect with a real device, it is much faster - you get the player spawned without having to wait chunks loading.
    And it is even more convenient with multiplayer - you don't need to ask people to help you test. Everything is under your control.
    CrazedMiner and Creeperface like this.
  13. Kvetinac97
    Offline

    Kvetinac97 Active Member Plugin Developer

    Joined:
    Nov 17, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    Kvetinac97
    It's a bad practice to test plugins like SurvivalGames, BedWars... but for small plugins where I need only to call BlockBreakEvent it doesn't matter...
  14. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    What do you mean by it's a bad practice? You don't want to test your plugins before you submit them? o_O
Thread Status:
Not open for further replies.

Share This Page

Advertisement