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

Event for setbanned() but ip ban?

Comments in 'Plugin Development' started by dxm_hippie, May 22, 2015.

  1. CrazedMiner
    Offline

    CrazedMiner Notable Member Plugin Developer

    Joined:
    Jan 31, 2015
    Posts:
    348
    Plugins:
    2
    Minecraft User:
    CrazedMinerYT
    Make a <playername>.txt for every player when they join,
    in the <playername>.txt have their last IP and if they're banned if the player gets banned then change it to true, to save the IP, get the players IP when they leave the server.
    Then the next time they join ban them if <playername>.txt "banned" === true :p
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    What do you want to do when they have been IP banned? You can try handling PlayerKickEvent at the LOWEST priority checking the kick reason.
    [troll=" @shoghicp will love this"]
    Use this code:
    PHP:
    public function onKick(PlayerKickEvent $event){
      
    $trace = (new \Exception)->getTraceAsString();
      if(
    strpos($trace"pocketmine\\command\\defaults\\BanIpCommand->execute(Object(pocketmine\\command\\ConsoleCommandSender),") !== false){
        
    // player is IP banned
      
    }
    }
    [/
    troll]
    LDX likes this.
  3. dxm_hippie
    Offline

    dxm_hippie Active Member Plugin Developer

    Joined:
    Feb 1, 2015
    Posts:
    413
    Plugins:
    1
    Minecraft User:
    XxDXM_hippiexX
    I was simply trying to make a plugin that will ip ban a player while there offline..so me or staff could do /offline ban <name> and it will ip ban the player when they join. but it looks like i might be using the unid when the update comes out. this will be usefull for me so i can bring back hack report rewards
  4. dxm_hippie
    Offline

    dxm_hippie Active Member Plugin Developer

    Joined:
    Feb 1, 2015
    Posts:
    413
    Plugins:
    1
    Minecraft User:
    XxDXM_hippiexX
    the whole point was to make it automatically ban them on join after a command..maybe i could have the plugin add the ip to the bannedip file?
  5. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    They can simply change their client ID at <external storagey directory>/games/com.mojang/minecraftpe/clientId.txt to change their UUID.
    If you want to do ban IP, why would you want to know when someone ban IP?
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    PHP:
    // requried variables:
    /** @var \pocketmine\Server $server */
    /** @var string $ip */ // you need to save the IPs yourself because PocketMine doesn't save IPs in its core.
    /** @var string|null $reason */

    /** @var \pocketmine\permission\BanList $bans */
    $bans $server->getIPBans();
    $bans->addBan($ip$reason);
    CraftYourBukkit likes this.
  7. dxm_hippie
    Offline

    dxm_hippie Active Member Plugin Developer

    Joined:
    Feb 1, 2015
    Posts:
    413
    Plugins:
    1
    Minecraft User:
    XxDXM_hippiexX
    I didnt lol I was looking for something like setBanned() but IP ban, thank you for showing me btw!
  8. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    "Event for setbanned" means to know when someone IP bans.
    Other things are not events. Do you know what an event is?
  9. dxm_hippie
    Offline

    dxm_hippie Active Member Plugin Developer

    Joined:
    Feb 1, 2015
    Posts:
    413
    Plugins:
    1
    Minecraft User:
    XxDXM_hippiexX
    Maybe i was using the wrong term..lol but $player->setBanned(); will ban the name, i was looking for a..uhh..thing :p for ip ban, and im guessing a event is well a event. join, ban, kick, move, exc right? i didnt know what else to call it lol
  10. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Event is to know when something happened. What you are doing is to make something happen.
  11. dxm_hippie
    Offline

    dxm_hippie Active Member Plugin Developer

    Joined:
    Feb 1, 2015
    Posts:
    413
    Plugins:
    1
    Minecraft User:
    XxDXM_hippiexX
    Ohh, got ya

Share This Page

Advertisement