Advertisement
volca780

volca780 minecraft server api

Dec 9th, 2015
12,191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.30 KB | None | 0 0
  1. <?php
  2. /*
  3. // vma_getStatus($vma_ip)
  4. //      get status server return: "true / error"
  5. //
  6. // vma_getVersion($vma_ip)
  7. //      get version server return: "ex: 1.8.6"
  8. //
  9. // vma_getMotd($vma_ip)
  10. //      get MOTD server return: "ex: FREE SERVER ONLY"
  11. //
  12. // vma_getPlayer($vma_ip, $arg1)
  13. //      get Player only and get Player max $arg1 = max / only
  14. //
  15. // vma_getList($vma_ip)
  16. //      get Player list of server
  17. //
  18. // vma_getIcon($vma_ip)
  19. //      get server icon
  20. //
  21. // vma_get2dAvatar($vma_name, $vma_size)
  22. //      get 2d avatar of player "vma_get2dAvatar('volca780', '200')" return: img link
  23. //
  24. // vma_get3dAvatar($vma_name, $vma_size)
  25. //      get 3d avatar of player "vma_get2dAvatar('volca780', '200')" return: img link
  26. //
  27. // vma_get3dSkin($vma_name, $vma_size)
  28. //      get 3d skin of player "vma_get3dAvatar('volca780', '200')" return: img link
  29. //
  30. // vma_getUuid($vma_name, $arg1)
  31. //      get UUID of player $arg1 = F for get UUID FORMATTED and use O for get UUID
  32. //
  33. // vma_getName($vma_uuid)
  34. //      get Name from UUID
  35. //
  36. // vma_getPremium($vma_name)
  37. //      get if the player as premium return: true / false
  38. */
  39. function vma_getStatus($vma_ip){
  40.     $vma_ip_test = file_get_contents("http://mcapi.ca/query/".$vma_ip."/status");
  41.     $vma_ip_test = json_decode($vma_ip_test);
  42.     if(!isset($vma_ip_test->error)){
  43.         return true;
  44.     }else{
  45.         echo "error: ".$vma_ip_test->error;
  46.     }
  47. }
  48. function vma_getVersion($vma_ip){
  49.     if(vma_getStatus($vma_ip) == true){
  50.         $vma_ip_version = file_get_contents("http://mcapi.ca/query/".$vma_ip."/info");
  51.         $vma_ip_version = json_decode($vma_ip_version);
  52.         if(!empty($vma_ip_version->version) AND isset($vma_ip_version->version)){
  53.             return $vma_ip_version->version;
  54.         }
  55.     }
  56. }
  57. function vma_getMotd($vma_ip){
  58.     if(vma_getStatus($vma_ip) == true){
  59.         $vma_ip_Motd = file_get_contents("http://mcapi.ca/query/".$vma_ip."/motd");
  60.         $vma_ip_Motd = json_decode($vma_ip_Motd);
  61.         if(!empty($vma_ip_Motd) AND isset($vma_ip_Motd)){
  62.             return nl2br($vma_ip_Motd->motd);
  63.         }
  64.     }
  65. }
  66. function vma_getPlayer($vma_ip, $arg1){
  67.     if(vma_getStatus($vma_ip) == true){
  68.         $vma_ip_player = file_get_contents("http://mcapi.ca/query/".$vma_ip."/players");
  69.         $vma_ip_player = json_decode($vma_ip_player);
  70.         if(isset($vma_ip_player->players)){
  71.             if($arg1 === "max"){
  72.                 return $vma_ip_player->players->max;
  73.             }else if($arg1 == "online"){
  74.                 return $vma_ip_player->players->online;
  75.             }
  76.         }
  77.     }
  78. }
  79. function vma_getList($vma_ip){
  80.     if(vma_getStatus($vma_ip) == true){
  81.         $vma_ip_list = file_get_contents("http://mcapi.ca/query/".$vma_ip."/list");
  82.         $vma_ip_list = json_decode($vma_ip_list);
  83.         if(isset($vma_ip_list->players)){
  84.             return $vma_ip_list->players->list;
  85.         }
  86.     }
  87. }
  88. function vma_getIcon($vma_ip){
  89.     if(vma_getStatus($vma_ip) == true){
  90.         $vma_ip_icon = "http://mcapi.ca/query/".$vma_ip."/icon";
  91.         return $vma_ip_icon;
  92.     }
  93. }
  94. function vma_get2dAvatar($vma_name, $vma_size){
  95.     if(!empty($vma_name) AND !empty($vma_size)){
  96.         $vma_avatar = "http://mcapi.ca/avatar/2d/".$vma_name."/".$vma_size;
  97.         return $vma_avatar;
  98.     }
  99. }
  100. function vma_get3dAvatar($vma_name, $vma_size){
  101.     if(!empty($vma_name) AND !empty($vma_size)){
  102.         $vma_avatar = "http://mcapi.ca/avatar/3d/".$vma_name."/".$vma_size;
  103.         return $vma_avatar;
  104.     }
  105. }
  106. function vma_get3dSkin($vma_name, $vma_size){
  107.     if(!empty($vma_name) AND !empty($vma_size)){
  108.         $vma_avatar = "http://mcapi.ca/skin/3d/".$vma_name."/".$vma_size;
  109.         return $vma_avatar;
  110.     }
  111. }
  112. function vma_getUuid($vma_name, $arg1){
  113.     if(isset($vma_name)){
  114.         $vma_ip_uuid = file_get_contents("http://mcapi.ca/uuid/player/".$vma_name);
  115.         $vma_ip_uuid = json_decode($vma_ip_uuid);
  116.         if($arg1 === "F"){
  117.             return $vma_ip_uuid->uuid_formatted;
  118.         }else if($arg1 === "O"){
  119.             return $vma_ip_uuid->uuid;
  120.         }
  121.     }
  122. }
  123. function vma_getName($vma_uuid){
  124.     if(isset($vma_uuid)){
  125.         $vma_ip_name = file_get_contents("http://mcapi.ca/name/uuid/".$vma_uuid);
  126.         $vma_ip_name = json_decode($vma_ip_name);
  127.         if(isset($vma_ip_name->name) AND !empty($vma_ip_name->name)){
  128.             return $vma_ip_name->name;
  129.         }
  130.     }
  131. }
  132. function vma_getPremium($vma_name){
  133.     if(isset($vma_name) AND isset($vma_name)){
  134.         $vma_ip_premium = file_get_contents("http://mcapi.ca/other/haspaid/".$vma_name);
  135.         $vma_ip_premium = json_decode($vma_ip_premium);
  136.         if(isset($vma_ip_premium->premium) AND !empty($vma_ip_premium->premium)){
  137.             return true;
  138.         }else{
  139.             return false;
  140.         }
  141.     }
  142. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement