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

How to use Query?

Comments in 'Plugin Development' started by CraftYourBukkit, May 8, 2015.

  1. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    How do I use Query to get Information about a Server? I tried:
    PHP:
                        $Query = new MinecraftQuery();
                        try{
                            
    $Query->Connect'IP'19132 );

                            
    $player->sendMessage"Test:" $Query->GetInfo( ) );
                            
    $player->sendMessage"Test-2:" $Query->GetPlayers( ) );
                        }
                        catch( 
    MinecraftQueryException $e ){
                            
    $player->sendMessage($e->getMessage( ));
                        }
                        finally{
                            
    $Query->Close();
                        }
    But it doesn't work, error:
    Code:
    19:00:27 [CRITICAL] Unhandled exception executing command 'aa' in aa: Class xPaw\MinecraftQuery not found
    19:00:27 [CRITICAL] ClassNotFoundException: "Class xPaw\MinecraftQuery not found" (EXCEPTION) in "/src/spl/BaseClassLoader" at line 144
    
  2. Exxarion
    Offline

    Exxarion Active Member Plugin Developer

    Joined:
    Jan 5, 2014
    Posts:
    242
    Plugins:
    1
    Minecraft User:
    Notch
    You are using xPaw's mc query. You need to download all the files included in the github, or it will not work.
  3. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    I did import it in the Plugin as a source and used it in the code
  4. EvolSoft
    Offline

    EvolSoft Notable Member Plugin Developer

    Joined:
    Sep 10, 2014
    Posts:
    821
    Plugins:
    15
    Minecraft User:
    Flavius12
    You must rename also the namespace
  5. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    What do you mean with that?
  6. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,707
    Plugins:
    22
    Minecraft User:
    Falkirknh
    Not needed, the "src" folder in a PocketMine plugin represents the root namespace ("\\"). You can create whatever folders you want inside of it.
    PEMapModder likes this.
  7. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,707
    Plugins:
    22
    Minecraft User:
    Falkirknh
    Just a heads up, that blocks the main thread and won't be accepted into the PocketMine plugin repo.
    EvolSoft and PEMapModder like this.
  8. iJoshuaHD
    Offline

    iJoshuaHD Notable Member Plugin Developer

    Joined:
    Nov 7, 2013
    Posts:
    1,196
    Plugins:
    4
    Minecraft User:
    iJoshuaHD
    if it is done Async?
  9. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,707
    Plugins:
    22
    Minecraft User:
    Falkirknh
    The code shown above is not async.
    EvolSoft and PEMapModder like this.
  10. iJoshuaHD
    Offline

    iJoshuaHD Notable Member Plugin Developer

    Joined:
    Nov 7, 2013
    Posts:
    1,196
    Plugins:
    4
    Minecraft User:
    iJoshuaHD
    i mean about this:
    i dont care about his code or anything else.
    Samueljh1 likes this.
  11. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,707
    Plugins:
    22
    Minecraft User:
    Falkirknh
    idk what we are discussing, that refers to his code and code which block and thus won't be accepted.
    EvolSoft and PEMapModder like this.
  12. iJoshuaHD
    Offline

    iJoshuaHD Notable Member Plugin Developer

    Joined:
    Nov 7, 2013
    Posts:
    1,196
    Plugins:
    4
    Minecraft User:
    iJoshuaHD
    If you run his method asynchronously, would it be accepted? thats what i mean. :p
  13. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,707
    Plugins:
    22
    Minecraft User:
    Falkirknh
    It would need to be split up so that the query runs on a separate thread and the results are sent to the player on the main thread.
    PEMapModder likes this.
  14. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    His method contains both code that must be run synchronously to work and code that should be run asynchronously to be accepted.
  15. EvolSoft
    Offline

    EvolSoft Notable Member Plugin Developer

    Joined:
    Sep 10, 2014
    Posts:
    821
    Plugins:
    15
    Minecraft User:
    Flavius12
    I know. But look the error he gets. I think he's using his own directory names (eg. myplugin\myquery) instead of xPaw\MinecraftQuery. So if he wants to keep his own directory names he must change namespaces
  16. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,707
    Plugins:
    22
    Minecraft User:
    Falkirknh
    But thats more hassle than just moving it :)
    EvolSoft likes this.
  17. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    So, anyone got a code? I can't figure it out:/
    HotFireyDeath likes this.

Share This Page

Advertisement