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

Prevent peoples to join your account if they not on your ip

Comments in 'Plugin Development' started by AvivShopenCraft, Dec 8, 2015.

  1. AvivShopenCraft
    Offline

    AvivShopenCraft New Member

    Joined:
    Oct 14, 2015
    Posts:
    73
    Minecraft User:
    AvivShopen
    ok I need to get a shower, brb
  2. AvivShopenCraft
    Offline

    AvivShopenCraft New Member

    Joined:
    Oct 14, 2015
    Posts:
    73
    Minecraft User:
    AvivShopen
  3. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    so, it worked?
  4. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    How did you test it? another Wifi Network?
    also, try
    PHP:
    <?phpnamespace AvivShopen\BanProtect;

    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\event\player\PlayerPreLoginEvent;
    use 
    pocketmine\event\player\PlayerJoinEvent;
    use 
    pocketmine\Player;
    use 
    pocketmine\Server;
    use 
    pocketmine\event\Listener;

    use 
    pocketmine\utils\TextFormat;

    class 
    MainClass extends PluginBase implements Listener {



    public function 
    PreLogin(\pocketmine\event\player\PlayerPreLoginEvent $event){
    if(
    strtolower($event->getPlayer()->getName()) == "AvivShopen"){
    if(
    $event->getPlayer()->getAddress() !== "LAN IP" || $event->getPlayer()->getAddress() !== "PUBLIC IP"){
    $event->setKickMessage(TextFormat::RED TextFormat::BOLD "Don't try to get in with the Owner's account!");
    $event->setCancelled(true);
    $this->getServer()->broadcastMessage("SOMEONE TRIED TO GET IN WITH THE SERVER OWNER ACCOUNT WITH THE IP " $event->getPlayer()->getAddress() . " !!!");
    }
    }
    }
    }
    this time COPY IT RIGHT, because the last time you copied it you have extra {
    Last edited: Dec 9, 2015
  5. AvivShopenCraft
    Offline

    AvivShopenCraft New Member

    Joined:
    Oct 14, 2015
    Posts:
    73
    Minecraft User:
    AvivShopen
    I'm trying, and yes I'm using another wifi
  6. AvivShopenCraft
    Offline

    AvivShopenCraft New Member

    Joined:
    Oct 14, 2015
    Posts:
    73
    Minecraft User:
    AvivShopen
    still not working......... I just added } cuz its said "unexpected end of file" message:(
    I'm so sorry I'm asking too much
  7. AvivShopenCraft
    Offline

    AvivShopenCraft New Member

    Joined:
    Oct 14, 2015
    Posts:
    73
    Minecraft User:
    AvivShopen
    I will start remove parts of the codes to see which code is incorrect:/ maybe the code corret and I wrong... but maybe $event->setKickMessage()
    cant be applied without $player = $event->getPlayer()
    $player->kick() or $player->close() but I don't think it will work... cuz idk very much PHP:(
  8. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    Php.. setkickmessage() doesn't need $player..
    $player->kick will work but your server will crash if you're not using ImagicalMine
  9. AvivShopenCraft
    Offline

    AvivShopenCraft New Member

    Joined:
    Oct 14, 2015
    Posts:
    73
    Minecraft User:
    AvivShopen
    I'm using ImagicalMine
  10. AvivShopenCraft
    Offline

    AvivShopenCraft New Member

    Joined:
    Oct 14, 2015
    Posts:
    73
    Minecraft User:
    AvivShopen
  11. AvivShopenCraft
    Offline

    AvivShopenCraft New Member

    Joined:
    Oct 14, 2015
    Posts:
    73
    Minecraft User:
    AvivShopen
    if(strtolower($event->getPlayer()->getName())
    maybe
    if(strtolower($player()->getName())
    ?
  12. AvivShopenCraft
    Offline

    AvivShopenCraft New Member

    Joined:
    Oct 14, 2015
    Posts:
    73
    Minecraft User:
    AvivShopen
    and I will add this part before
    $player = $event->getPlayer();
  13. AvivShopenCraft
    Offline

    AvivShopenCraft New Member

    Joined:
    Oct 14, 2015
    Posts:
    73
    Minecraft User:
    AvivShopen
    oh lol that's just a easier way to write lol my bad
  14. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    Parse Error : Unexpected (
  15. AvivShopenCraft
    Offline

    AvivShopenCraft New Member

    Joined:
    Oct 14, 2015
    Posts:
    73
    Minecraft User:
    AvivShopen
    idk what to do, I will wait for other member to help me, THANK YOU ALOT FOR HELPING ME:)
    you saved the future of my server lol XD
  16. AvivShopenCraft
    Offline

    AvivShopenCraft New Member

    Joined:
    Oct 14, 2015
    Posts:
    73
    Minecraft User:
    AvivShopen
    btw I want to open a new theard about my new "ChatBlocker" plugin, which block messages with swears, but first let me take a sleep lol, Good night!
  17. xBeastMode
    Offline

    xBeastMode Active Member

    Joined:
    Nov 27, 2015
    Posts:
    292
    So much spam for a simple plugin. Why not just ask in plugin request?, it's very simple.

    NOTICE: You just gave your IP, now anyone can trace your ip and know your exact location. They can also take down your internet connection.
  18. AvivShopenCraft
    Offline

    AvivShopenCraft New Member

    Joined:
    Oct 14, 2015
    Posts:
    73
    Minecraft User:
    AvivShopen
    oh no
    please remove all your posts with my ip, I don't want hackers will shut down my internet
  19. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder

Share This Page

Advertisement