Windows10 whitelist

Discussion in 'Plugin Help' started by sdsd16, Aug 9, 2019.

  1. sdsd16

    sdsd16 Spider Jockey

    Messages:
    38
    GitHub:
    Danding1314
    i made a windows10 whitelist plugin
    but it's work

    the code

    public function onEnable() : void{
    $this->getServer()->getPluginManager()->registerEvents($this, $this);
    $this->allow = new Config($this->getDataFolder() . "win10.yml", Config::YAML,array());
    $this->allow->set("sdsd15",true);
    $this->allow->save();
    }

    public function DataPacketReceive(DataPacketReceiveEvent $event){
    $player = $event->getPlayer();
    $pn = $player->getName();
    $packet = $event->getPacket();
    if ($packet instanceof LoginPacket){
    if($packet->clientData["DeviceOS"] == 7){
    if(!$this->allow->get($pn, true) ){
    $player->kick("!!! You don't have Win10 Whitelist !!!");
    }
    }
    }
    }

    But why it's work QWQ
     
  2. jasonwynn10

    jasonwynn10 Wither Skeleton Poggit Reviewer

    Messages:
    1,388
    GitHub:
    jasonwynn10
    You are checking if the name is in the list then kicking them but you are also defaulting to true if the name doesn't exist in the list. This operates more of like a blacklist plugin.
     
  3. sdsd16

    sdsd16 Spider Jockey

    Messages:
    38
    GitHub:
    Danding1314
    ---
    sdsd15: true
    ...

    the win10.yml
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.