Vanish No Packet

Vanish No Packet

855k Downloads

Method for Jsonapi

palindrome29 opened this issue · 5 comments

commented

Hello,
What should we add in methods, that does not appear jsonapi players vanish?
Thanks you,

commented
{
    "name": "isVanished",
    "desc": "Checks if named player is vanished",
    "call": "Plugins.VanishNoPacket.getManager().isVanished(0)",
    "returns": [
        "boolean",
        "True if player is invisible. False if offline or visible."
    ],
    "args": [
        [
            "String",
            "Player's name"
        ]
    ]
}
{
    "name": "getOnlineStatus",
    "desc": "Check if player is considered online",
    "call": "Plugins.VanishNoPacket.getManager().getAnnounceManipulator().getFakeOnlineStatus(0)",
    "returns": [
        "boolean",
        "True if player is considered online. False if not or player offline."
    ],
    "args": [
        [
            "String",
            "Player's name"
        ]
    ]
}

Source

commented

Hello and thank you.

The op players vanish and are still visible on the site, I do not understand.

commented

Can you provide example output from jsonapi demonstrating they're coming back as not vanished?

commented

Here's a piece of my php code to display online players on the site:

    //Joueurs en ligne
        $onlinePlayers = $api->call('getPlayerNames');
        $onlinePlayers = $onlinePlayers['success'];

        //Joueurs hors-ligne
        $offlinePlayers = $api->call('getOfflinePlayerNames');
        $offlinePlayers = $offlinePlayers['success'];

        //Tous les jours
        $allPlayers = array_merge($onlinePlayers, $offlinePlayers);

        if(in_array($getPseudo, $onlinePlayers)) {
            $getPseudoInfoServeur = $api->call('getPlayer', array($getPseudo));

            if($getPseudoInfoServeur['result'] != 'error' && !empty($getPseudoInfoServeur['success'])) {

                $getPseudoInfoServeur = $getPseudoInfoServeur['success'];

                $groupePseudo = $api->call('permissions.getGroups', array($getPseudo));
                $groupePseudo = @$groupePseudo['success']['0'];
                if(empty($groupePseudo)) {
                    $groupePseudo = "Indéfini";
                }

                //Récupère le solde du joueur
                $moneyPseudo = $api->call('econ.getBalance', array($getPseudo));
                if(!empty($moneyPseudo['success'])) {
                    $moneyPseudo = $moneyPseudo['success'];
                    if(strstr($moneyPseudo, '.')) {
                        $moneyPseudo = str_replace(strstr($moneyPseudo, '.'), null, $moneyPseudo);
                    }
                } else {
                    $moneyPseudo = 'Indéfini';
                }

                $levelPseudo = $getPseudoInfoServeur['level'];
                $experiencePseudo = $getPseudoInfoServeur['experience'];
                $healthPseudo = $getPseudoInfoServeur['health'].'/20';
                $foodPseudo = $getPseudoInfoServeur['foodLevel'].'/20';
                $isOnline = $getPseudoInfoServeur['ip'];
                $isOperateur = $getPseudoInfoServeur['op'];

                $isBanned = $getPseudoInfoServeur['banned'];
                if($isBanned == false) {
                    $isBanned = "Non";
                } else {
                    $isBanned = "Oui";
                }

                $armor = 0;
                if(!empty($getPseudoInfoServeur['inventory']['armor']['helmet'])) { $armor = $armor + 1.5; }
                if(!empty($getPseudoInfoServeur['inventory']['armor']['boots'])) { $armor = $armor + 1.5; }
                if(!empty($getPseudoInfoServeur['inventory']['armor']['leggings'])) { $armor = $armor + 6; }
                if(!empty($getPseudoInfoServeur['inventory']['armor']['chestplate'])) { $armor = $armor + 8; }
                $armor = $armor."/20";

                if(is_null($getPseudoInfoServeur['gameMode'])) {
                    $firstPlayed=$lastPlayed=false;
                } else {
                    $firstPlayed = date("d/m/Y à H:i:s", $getPseudoInfoServeur['firstPlayed']);
                    $lastPlayed = $getPseudoInfoServeur['lastPlayed'];
                    if($lastPlayed == "0") {
                        $lastPlayed = $firstPlayed;
                    } else {
                        $lastPlayed = date("d/m/Y à H:i:s", $lastPlayed);
                    }
                }
                if($isOnline != "offline" && $isOnline != "") {
                    $isOnline = true;
                } else {
                    $isOnline = false;
                }

                $world = $getPseudoInfoServeur['worldInfo']['name'];
                $errorJSONAPI = null;

            } elseif($getPseudoInfoServeur['result'] == 'success' && empty($getPseudoInfoServeur['success'])) {
                $errorJSONAPI = 'emptyInfos';
            } else {
                $errorJSONAPI = $getPseudoInfoServeur['error'];
            }
        } else {
            $errorJSONAPI = 'emptyInfos';
        }
commented

Sure, that's some lovely code, but I'm just looking to see the actual raw output of that call.