Giter VIP home page Giter VIP logo

geoblock-pmmp's Introduction

GeoBlock-PMMP

GeoBlock is a very simple Geo Blocking plugin for PocketMine-MP

How does it work?

Everytime a player join your server his IP will be checked against external APIs so we can get his country of origin and block or allow his login

APIs used and limits

This plugin uses two APIs. One main API (ip-api.com) and another for failover (extreme-ip-lookup.com). ip-api.com has a hard limit of 150 requests per minute and extreme-ip-lookup.com has a limit of 50 request per limit. This means that you have 200 requests per minute avaliable for you.

Note: ip-api.com WILL block your IP if you send more than 150 requests per minute and you will need to unban your IP here or that will leave you with only 50 requests per minute from extreme-ip-lookup.com.

One request = one player logging in on the server. If have a big server (more than 150 players logging in per minute) please consider actually paying for some GeoIP API and edit the code to suit your new paid API

Permissions

Permission Description
geoblock.bypass Players with this permission will bypass Geo Block

config.yml

Configuration is pretty straightforward.

Setting Description
kickMsg Message for kicked player
action deny or allow
allow = only players from “countries” will be able to join
deny = every player will join except players from “countries”
countries Countries to allow/deny on the server. Uppsercase comma separated
Example: [BR, NZ, CN, RU, US]
fail deny or allow. What to do if all APIs fail to return a country?
allow = players with invalid country code will be able to join the server
deny = players with invalid country code WILL NOT be able to join the server
failMsg Message to show players kicked due to API fail

IMPORTANT

Again, I'd like to remind that if you get many (over 150) players logging in per minute it's VERY recommended that you pay for a good unlimited GeoIP API, there are many on Google, search for one that best suit your needs and budget. You will also have to edit the code to suit your new API.

What happens if all APIs go offline or my IP gets blacklisted?

Good question. I don't know. I guess players will be stuck in the logging in screen for a while...

Does this detect VPNs?

No. Players with a proxy or VPN can easily bypass this plugin

geoblock-pmmp's People

Contributors

ianszot avatar poggit-bot avatar

Stargazers

 avatar

Watchers

 avatar

geoblock-pmmp's Issues

Bug Internal

[15:08:47] [Server thread/CRITICAL]: ErrorException: "file_get_contents(http://ip-a pi.com/json/171.6.247.143): failed to open stream: HTTP request failed!" (EXCEPTION ) in "plugins/GeoBlock-PMMP (1).phar/src/IanSzot/GeoBlock/GeoBlock" at line 33
[15:08:47] [Server thread/DEBUG]: #0 (): pocketmine\utils\Utils::errorExceptionHand ler(integer 2, string file_get_contents(http://ip-api.com/json/171.6.247.143): fail ed to open stream: HTTP request failed! , string phar://C:/Users/Administrator/Desk top/Server/Lobby/plugins/GeoBlock-PMMP (1).phar/src/IanSzot/GeoBlock/GeoBlock.php, integer 33, array Array())
[15:08:47] [Server thread/DEBUG]: #1 plugins/GeoBlock-PMMP (1).phar/src/IanSzot/Geo Block/GeoBlock(33): file_get_contents(string http://ip-api.com/json/171.6.247.143)
[15:08:47] [Server thread/DEBUG]: #2 plugins/GeoBlock-PMMP (1).phar/src/IanSzot/Geo Block/GeoBlock(56): IanSzot\GeoBlock\GeoBlock->checkCountry(string 171.6.247.143)
[15:08:47] [Server thread/DEBUG]: #3 src/pocketmine/plugin/MethodEventExecutor(38): IanSzot\GeoBlock\GeoBlock->playerLogin(pocketmine\event\player\PlayerPreLoginEvent object)
[15:08:47] [Server thread/DEBUG]: #4 src/pocketmine/plugin/RegisteredListener(98): pocketmine\plugin\MethodEventExecutor->execute(IanSzot\GeoBlock\GeoBlock object, po cketmine\event\player\PlayerPreLoginEvent object)
[15:08:47] [Server thread/DEBUG]: #5 src/pocketmine/event/Event(99): pocketmine\plu gin\RegisteredListener->callEvent(pocketmine\event\player\PlayerPreLoginEvent objec t)
[15:08:47] [Server thread/DEBUG]: #6 src/pocketmine/Player(1926): pocketmine\event\ Event->call()
[15:08:47] [Server thread/DEBUG]: #7 src/pocketmine/network/mcpe/PlayerNetworkSessi onAdapter(116): pocketmine\Player->handleLogin(pocketmine\network\mcpe\protocol\Log inPacket object)
[15:08:47] [Server thread/DEBUG]: #8 src/pocketmine/network/mcpe/protocol/LoginPack et(142): pocketmine\network\mcpe\PlayerNetworkSessionAdapter->handleLogin(pocketmin e\network\mcpe\protocol\LoginPacket object)
[15:08:47] [Server thread/DEBUG]: #9 src/pocketmine/network/mcpe/PlayerNetworkSessi onAdapter(108): pocketmine\network\mcpe\protocol\LoginPacket->handle(pocketmine\net work\mcpe\PlayerNetworkSessionAdapter object)
[15:08:47] [Server thread/DEBUG]: #10 src/pocketmine/network/mcpe/protocol/BatchPac ket(119): pocketmine\network\mcpe\PlayerNetworkSessionAdapter->handleDataPacket(poc ketmine\network\mcpe\protocol\LoginPacket object)
[15:08:47] [Server thread/DEBUG]: #11 src/pocketmine/network/mcpe/PlayerNetworkSess ionAdapter(108): pocketmine\network\mcpe\protocol\BatchPacket->handle(pocketmine\ne twork\mcpe\PlayerNetworkSessionAdapter object)
[15:08:47] [Server thread/DEBUG]: #12 src/pocketmine/Player(3111): pocketmine\netwo rk\mcpe\PlayerNetworkSessionAdapter->handleDataPacket(pocketmine\network\mcpe\proto col\BatchPacket object)
[15:08:47] [Server thread/DEBUG]: #13 src/pocketmine/network/mcpe/RakLibInterface(1 70): pocketmine\Player->handleDataPacket(pocketmine\network\mcpe\protocol\BatchPack et object)
[15:08:47] [Server thread/DEBUG]: #14 vendor/pocketmine/raklib/src/server/ServerHan dler(99): pocketmine\network\mcpe\RakLibInterface->handleEncapsulated(string 171.6. 247.143 43181, raklib\protocol\EncapsulatedPacket object, integer 0)
[15:08:47] [Server thread/DEBUG]: #15 src/pocketmine/network/mcpe/RakLibInterface(1 10): raklib\server\ServerHandler->handlePacket()
[15:08:47] [Server thread/DEBUG]: #16 src/pocketmine/network/mcpe/RakLibInterface(1 00): pocketmine\network\mcpe\RakLibInterface->process()
[15:08:47] [Server thread/DEBUG]: #17 vendor/pocketmine/snooze/src/SleeperHandler(1 23): pocketmine\network\mcpe\RakLibInterface->pocketmine\network\mcpe{closure}()
[15:08:47] [Server thread/DEBUG]: #18 vendor/pocketmine/snooze/src/SleeperHandler(8 5): pocketmine\snooze\SleeperHandler->processNotifications()
[15:08:47] [Server thread/DEBUG]: #19 src/pocketmine/Server(2345): pocketmine\snooz e\SleeperHandler->sleepUntil(double 1551600527.3069)
[15:08:47] [Server thread/DEBUG]: #20 src/pocketmine/Server(2205): pocketmine\Serve r->tickProcessor()
[15:08:47] [Server thread/DEBUG]: #21 src/pocketmine/Server(1784): pocketmine\Serve r->start()
[15:08:47] [Server thread/DEBUG]: #22 src/pocketmine/PocketMine(250): pocketmine\Se rver->__construct(BaseClassLoader object, pocketmine\utils\MainLogger object, strin g C:\Users\Administrator\Desktop\Server\Lobby, string C:\Users\Administrator\Deskt op\Server\Lobby\plugins)
[15:08:47] [Server thread/DEBUG]: #23 (1): require(string phar://C:/Users/Administr ator/Desktop/Server/Lobby/PocketMine-MP.phar/src/pocketmine/PocketMine.php)php

差別

これは利用者によっては使い方は異なりますが、差別化問題に繋がるかと

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.