From 938f94e130ef2b924351bcb9ed2a0c5712aafaf8 Mon Sep 17 00:00:00 2001 From: k-jiang Date: Sat, 20 Jan 2018 14:29:48 -0500 Subject: [PATCH] Upgrade to GeoIP2, add db update. (#1748) --- Essentials/src/messages.properties | 2 +- Essentials/src/messages_cs.properties | 2 +- Essentials/src/messages_da.properties | 2 +- Essentials/src/messages_de.properties | 2 +- Essentials/src/messages_en.properties | 2 +- Essentials/src/messages_es.properties | 2 +- Essentials/src/messages_et.properties | 2 +- Essentials/src/messages_fi.properties | 2 +- Essentials/src/messages_fr.properties | 2 +- Essentials/src/messages_hu.properties | 2 +- Essentials/src/messages_it.properties | 2 +- Essentials/src/messages_ko.properties | 2 +- Essentials/src/messages_lt.properties | 2 +- Essentials/src/messages_nl.properties | 2 +- Essentials/src/messages_pl.properties | 2 +- Essentials/src/messages_pt.properties | 2 +- Essentials/src/messages_pt_BR.properties | 2 +- Essentials/src/messages_ru.properties | 2 +- Essentials/src/messages_sv.properties | 2 +- Essentials/src/messages_zh.properties | 2 +- EssentialsGeoIP/pom.xml | 25 +++-- .../essentials/geoip/EssentialsGeoIP.java | 2 +- .../geoip/EssentialsGeoIPPlayerListener.java | 101 +++++++++++++----- EssentialsGeoIP/src/config.yml | 13 ++- EssentialsGeoIP/src/plugin.yml | 2 +- 25 files changed, 124 insertions(+), 59 deletions(-) diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index a171a961a..a15441d69 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -103,7 +103,7 @@ disabledToSpawnMob=\u00a74Spawning this mob was disabled in the config file. disableUnlimited=\u00a76Disabled unlimited placing of\u00a7c {0} \u00a76for {1}. distance=\u00a76Distance\: {0} dontMoveMessage=\u00a76Teleportation will commence in\u00a7c {0}\u00a76. Don''t move. -downloadingGeoIp=Downloading GeoIP database... this might take a while (country\: 0.6 MB, city\: 20MB) +downloadingGeoIp=Downloading GeoIP database... this might take a while (country\: 1.7 MB, city\: 30MB) duplicatedUserdata=Duplicated userdata\: {0} and {1}. durability=\u00a76This tool has \u00a7c{0}\u00a76 uses left. editBookContents=\u00a7eYou may now edit the contents of this book. diff --git a/Essentials/src/messages_cs.properties b/Essentials/src/messages_cs.properties index 69dd7d225..d8c195dd5 100644 --- a/Essentials/src/messages_cs.properties +++ b/Essentials/src/messages_cs.properties @@ -103,7 +103,7 @@ disabledToSpawnMob=\u00a74Spawnuti tohoto moba je zakazno v configuracnim soubor disableUnlimited=\u00a76Zablokovano neomezene pokladani\u00a7c {0} \u00a76hracem {1}. distance=\u00a76Vzdalenost\: {0} dontMoveMessage=\u00a76Teleport bude zahajen za\u00a7c {0}\u00a76. Nehybej se. -downloadingGeoIp=Stahuji GeoIP databazi ... muze to chvilku trvat (staty\: 0.6 MB, mesta\: 20MB) +downloadingGeoIp=Stahuji GeoIP databazi ... muze to chvilku trvat (staty\: 1.7 MB, mesta\: 30MB) duplicatedUserdata=Duplicitni uzivatelska data\: {0} a {1}. durability=\u00a76Tomuto nastroji zbyva \u00a7c{0}\u00a76 pouziti. editBookContents=\u00a7eNyni muzes upravovat obsah teto knihy. diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties index d6a375e5c..dd4d1b289 100644 --- a/Essentials/src/messages_da.properties +++ b/Essentials/src/messages_da.properties @@ -103,7 +103,7 @@ disabledToSpawnMob=\u00a74Spawning af dette mob er deaktiveret i konfigurationsf disableUnlimited=\u00a76Deaktiverede ubegr\u00e6nset placering af\u00a7c {0} \u00a76i {1}. distance=\u00a76Afstand\: {0} dontMoveMessage=\u00a76Teleportering vil begynde om\u00a7c {0}\u00a76. Bliv st\u00e5ende. -downloadingGeoIp=Downloader GeoIP database... dette tager m\u00e5ske noget tid (land\: 0.6 MB, by\: 20MB) +downloadingGeoIp=Downloader GeoIP database... dette tager m\u00e5ske noget tid (land\: 1.7 MB, by\: 30MB) duplicatedUserdata=Duplikerede brugerdata\: {0} og {1}. durability=\u00a76Dette v\u00e6rkt\u00f8j har \u00a7c{0}\u00a76 anvendelser tilbage. editBookContents=\u00a7eDu kan nu \u00e6ndre denne bogs indhold. diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties index e90557330..3e291f8c6 100644 --- a/Essentials/src/messages_de.properties +++ b/Essentials/src/messages_de.properties @@ -103,7 +103,7 @@ disabledToSpawnMob=\u00a74Das Spawnen dieses Mobs wurde in der Konfigurationsdat disableUnlimited=\u00a76Deaktiviere unbegrenztes Platzieren von\u00a7c {0} \u00a76f\u00fcr {1}. distance=\u00a76Entfernung\: {0} dontMoveMessage=\u00a76Teleportvorgang startet in {0}. Bewege dich nicht. -downloadingGeoIp=Lade GeoIP-Datenbank ... dies kann etwas dauern (country\: 0.6 MB, city\: 20MB) +downloadingGeoIp=Lade GeoIP-Datenbank ... dies kann etwas dauern (country\: 1.7 MB, city\: 30MB) duplicatedUserdata=Doppelte Datei in userdata\: {0} und {1}. durability=\u00a76Dieses Werkzeug kann noch \u00a7c{0}\u00a76 mal benutzt werden. editBookContents=\u00a7eDu darfst jetzt den Inhalt dieses Buches bearbeiten. diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties index c83bcb499..8db35bd7a 100644 --- a/Essentials/src/messages_en.properties +++ b/Essentials/src/messages_en.properties @@ -103,7 +103,7 @@ disabledToSpawnMob=\u00a74Spawning this mob was disabled in the config file. disableUnlimited=\u00a76Disabled unlimited placing of\u00a7c {0} \u00a76for {1}. distance=\u00a76Distance\: {0} dontMoveMessage=\u00a76Teleportation will commence in\u00a7c {0}\u00a76. Don''t move. -downloadingGeoIp=Downloading GeoIP database... this might take a while (country\: 0.6 MB, city\: 20MB) +downloadingGeoIp=Downloading GeoIP database... this might take a while (country\: 1.7 MB, city\: 30MB) duplicatedUserdata=Duplicated userdata\: {0} and {1}. durability=\u00a76This tool has \u00a7c{0}\u00a76 uses left. editBookContents=\u00a7eYou may now edit the contents of this book. diff --git a/Essentials/src/messages_es.properties b/Essentials/src/messages_es.properties index 7c1b39623..6a1e50c5f 100644 --- a/Essentials/src/messages_es.properties +++ b/Essentials/src/messages_es.properties @@ -103,7 +103,7 @@ disabledToSpawnMob=\u00a74El spawn de este mob est\u00e1 deshabilitado en la con disableUnlimited=\u00a76La colocaci\u00f3n ilimitada de \u00a7c{0} \u00a76ha sido desactivada para {1}\u00a76. distance=\u00a76Distancia\: {0} dontMoveMessage=\u00a76El teletransporte comenzar\u00e1 en\u00a7c {0}\u00a76. Por favor, no te muevas. -downloadingGeoIp=Descargando base de datos de GeoIP... Puede tardar unos minutos (pa\u00edses\: 0.6 MB, ciudades\: 20 MB) +downloadingGeoIp=Descargando base de datos de GeoIP... Puede tardar unos minutos (pa\u00edses\: 1.7 MB, ciudades\: 30 MB) duplicatedUserdata=Datos de usuario duplicados\: {0} y {1} durability=\u00a77Esta herramienta tiene \u00a7c{0}\u00a77 usos restantes. editBookContents=\u00a7eAhora puedes editar los contenidos de este libro. diff --git a/Essentials/src/messages_et.properties b/Essentials/src/messages_et.properties index a26fe15e6..e47e41d38 100644 --- a/Essentials/src/messages_et.properties +++ b/Essentials/src/messages_et.properties @@ -103,7 +103,7 @@ disabledToSpawnMob=\u00a74Selle eluka tekitamine on konfiguratsioonis keelatud. disableUnlimited=\u00a76Peatatud l\u00f5pmatu plokki asetamine \u00a7c {0} \u00a76m\u00e4ngijale {1}. distance=\u00a76Kaugus\: {0} dontMoveMessage=\u00a76Teleportatsioon algab\u00a7c {0}\u00a76 p\u00e4rast. \u00c4ra liigu. -downloadingGeoIp=GeoIP andmebaasi allalaadimine... see v\u00f5ib v\u00f5tta aega (riik\: 0.6 MB, linn\: 20MB) +downloadingGeoIp=GeoIP andmebaasi allalaadimine... see v\u00f5ib v\u00f5tta aega (riik\: 1.7 MB, linn\: 30MB) duplicatedUserdata=Topelt kasutaja andmed\: {0} ja {1}. durability=\u00a76Sellel esemel on \u00a7c{0}\u00a76 kasutust j\u00e4rel editBookContents=\u00a7eSa v\u00f5id n\u00fc\u00fcd muuta selle raamatu sisu. diff --git a/Essentials/src/messages_fi.properties b/Essentials/src/messages_fi.properties index bcded0d1b..d55f908e4 100644 --- a/Essentials/src/messages_fi.properties +++ b/Essentials/src/messages_fi.properties @@ -103,7 +103,7 @@ disabledToSpawnMob=T\u00e4m\u00e4n mobin luominen on poistettu k\u00e4yt\u00f6st disableUnlimited=\u00a77Poistettu k\u00e4yt\u00f6st\u00e4 loputon laittaminen tavaralta "{0}", pelaajalta {1}. distance=\u00a76Et\u00e4isyys\: {0} dontMoveMessage=\u00a77Teleportataan {0} kuluttua. \u00c4l\u00e4 liiku. -downloadingGeoIp=Ladataan GeoIP tietokantaa ... t\u00e4m\u00e4 voi vied\u00e4 hetken (maa\: 0.6 MB, kaupunki\: 20MB) +downloadingGeoIp=Ladataan GeoIP tietokantaa ... t\u00e4m\u00e4 voi vied\u00e4 hetken (maa\: 1.7 MB, kaupunki\: 30MB) duplicatedUserdata=Kopioitu k\u00e4ytt\u00e4j\u00e4n tiedot\: {0} ja {1} durability=\u00a77T\u00e4ll\u00e4 ty\u00f6kalulla on \u00a7c{0}\u00a77 k\u00e4ytt\u00f6kertaa j\u00e4ljell\u00e4 editBookContents=\u00a7eVoit nyt muokata t\u00e4m\u00e4n kirjan sis\u00e4lt\u00f6\u00e4. diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties index 5fa44822f..a9b5ef3df 100644 --- a/Essentials/src/messages_fr.properties +++ b/Essentials/src/messages_fr.properties @@ -103,7 +103,7 @@ disabledToSpawnMob=L''invocation de ce monstre a \u00e9t\u00e9 d\u00e9sactiv\u00 disableUnlimited=\u00a77D\u00e9sactivation du placement illimit\u00e9 de {0} pour {1}. distance=\u00a76Distance \: {0} dontMoveMessage=\u00a77La t\u00e9l\u00e9portation commence dans {0}. Ne bougez pas. -downloadingGeoIp=T\u00e9l\u00e9chargement de la base de donn\u00e9es GeoIP... Cela peut prendre un moment (pays \: 0.6 Mo, villes \: 20 Mo) +downloadingGeoIp=T\u00e9l\u00e9chargement de la base de donn\u00e9es GeoIP... Cela peut prendre un moment (pays \: 1.7 Mo, villes \: 30 MB) duplicatedUserdata=Donn\u00e9es utilisateurs dupliqu\u00e9es \: {0} et {1} durability=\u00a77Cet outil a \u00a7c{0}\u00a77 usage(s) restant(s). editBookContents=\u00a7eVous pouvez maintenant \u00e9diter le contenu de ce livre. diff --git a/Essentials/src/messages_hu.properties b/Essentials/src/messages_hu.properties index 8c6b497f8..9bd476376 100644 --- a/Essentials/src/messages_hu.properties +++ b/Essentials/src/messages_hu.properties @@ -103,7 +103,7 @@ disabledToSpawnMob=\u00a74Ennek a l\u00e9nynek a leh\u00edv\u00e1sa jelenleg le disableUnlimited=\u00a76Disabled unlimited placing of\u00a7c {0} \u00a76for {1}. distance=\u00a76T\u00e1vols\u00e1g\: {0} dontMoveMessage=\u00a76A teleport\u00e1l\u00e1s elkezd\u00f5dik\u00a7c {0}\u00a76 bel\u00fcl. Ne mozogj\! -downloadingGeoIp=GeoIP adatb\u00e1zis let\u00f6lt\u00e9se folyamatban... eltarthat egy kis ideig (country\: 0.6 MB, city\: 20MB) +downloadingGeoIp=GeoIP adatb\u00e1zis let\u00f6lt\u00e9se folyamatban... eltarthat egy kis ideig (country\: 1.7 MB, city\: 30MB) duplicatedUserdata=Duplik\u00e1lt felhaszn\u00e1l\u00f3i adatok\: {0} \u00e9s {1}. durability=\u00a76This tool has \u00a7c{0}\u00a76 uses left editBookContents=\u00a76Mostant\u00f3l tudod szerkeszteni ezt a k\u00f6nyvet. diff --git a/Essentials/src/messages_it.properties b/Essentials/src/messages_it.properties index b5d823fc9..3df07a4fa 100644 --- a/Essentials/src/messages_it.properties +++ b/Essentials/src/messages_it.properties @@ -103,7 +103,7 @@ disabledToSpawnMob=\u00a74La creazione di questo mob \u00E8 stata disabilitata n disableUnlimited=\u00a76Piazzamento illimitato di\u00a7c {0} \u00a76disabilitato per {1}. distance=\u00a76Distanza\: {0} dontMoveMessage=\u00a77Il teletrasporto inizier\u00E0 tra {0}. Non muoverti. -downloadingGeoIp=Download del database GeoIP... potrebbe richiedere del tempo (nazione\: 0.6 MB, citt\u00E0\: 20MB) +downloadingGeoIp=Download del database GeoIP... potrebbe richiedere del tempo (nazione\: 1.7 MB, citt\u00E0\: 30MB) duplicatedUserdata=Dati dell''utente duplicati\: {0} e {1} durability=\u00a76Questo attrezzo ha \u00a7c{0}\u00a76 utilizzi rimasti editBookContents=\u00a7eOra puoi modificare i contenuti di questo libro. diff --git a/Essentials/src/messages_ko.properties b/Essentials/src/messages_ko.properties index a98afc1d7..4374548b2 100644 --- a/Essentials/src/messages_ko.properties +++ b/Essentials/src/messages_ko.properties @@ -103,7 +103,7 @@ disabledToSpawnMob=\u00a74\uc774 \ubaac\uc2a4\ud130\uc758 \uc2a4\ud3f0\uc740 \uc disableUnlimited=\u00a77{1}\ub85c {0}\uc758 \ubb34\ud55c\ubc30\uce58 \ube44\ud65c\uc131\ud654 distance=\u00a76\uac70\ub9ac\: {0} dontMoveMessage=\u00a76{0}\ucd08 \ub4a4\uc5d0 \uc774\ub3d9\ub429\ub2c8\ub2e4. \uc6c0\uc9c1\uc774\uba74 \uc774\ub3d9\uc774 \ucde8\uc18c\ub429\ub2c8\ub2e4. -downloadingGeoIp=GeoIP \ub370\uc774\ud130\ubca0\uc774\uc2a4\ub97c \ub2e4\uc6b4\ubc1b\ub294 \uc911\uc785\ub2c8\ub2e4.... \uc57d\uac04\uc758 \uc2dc\uac04\uc774 \uac78\ub9b4 \uc218 \uc788\uc2b5\ub2c8\ub2e4. (\uad6d\uac00\: 0.6 MB, \ub3c4\uc2dc\: 20MB) +downloadingGeoIp=GeoIP \ub370\uc774\ud130\ubca0\uc774\uc2a4\ub97c \ub2e4\uc6b4\ubc1b\ub294 \uc911\uc785\ub2c8\ub2e4.... \uc57d\uac04\uc758 \uc2dc\uac04\uc774 \uac78\ub9b4 \uc218 \uc788\uc2b5\ub2c8\ub2e4. (\uad6d\uac00\: 1.7 MB, \ub3c4\uc2dc\: 30MB) duplicatedUserdata=\uc911\ubcf5\ub41c \uc720\uc800\ub370\uc774\ud130 \: {0} \uc640/\uacfc {1} durability=\u00a76\uc774 \ub3c4\uad6c\ub294 \uc0ac\uc6a9 \uac00\ub2a5 \ud69f\uc218\uac00 s \u00a7c{0}\u00a76\ubc88 \ub0a8\uc558\uc2b5\ub2c8\ub2e4 editBookContents=\u00a7e\uc774\uc81c \uc774 \ucc45\uc758 \ub0b4\uc6a9\uc744 \uc218\uc815\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. diff --git a/Essentials/src/messages_lt.properties b/Essentials/src/messages_lt.properties index 60e03aeea..7c8bcd3d8 100644 --- a/Essentials/src/messages_lt.properties +++ b/Essentials/src/messages_lt.properties @@ -103,7 +103,7 @@ disabledToSpawnMob=\u00a74Spawning this mob was disabled in the config file. disableUnlimited=\u00a76Disabled unlimited placing of\u00a7c {0} \u00a76for {1}. distance=\u00a76Distance\: {0} dontMoveMessage=\u00a76Teleportacija prasid\u0117s po\u00a7c {0}\u00a76. Nejud\u0117kite. -downloadingGeoIp=Siun\u010diama GeoIP databaze... tai gali \u0161iek tiek u\u017etrukti (Kaime\: 0.6 MB, Mieste\: 20MB) +downloadingGeoIp=Siun\u010diama GeoIP databaze... tai gali \u0161iek tiek u\u017etrukti (Kaime\: 1.7 MB, Mieste\: 30MB) duplicatedUserdata=Duplicated userdata\: {0} and {1}. durability=\u00a76This tool has \u00a7c{0}\u00a76 uses left editBookContents=\u00a7eTu dabar gali redaguoti \u0161ios knygos turin\u012f. diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties index 141398274..638b9c18c 100644 --- a/Essentials/src/messages_nl.properties +++ b/Essentials/src/messages_nl.properties @@ -103,7 +103,7 @@ disabledToSpawnMob=Het spawnen van mobs is uitgeschakeld in het configuratie bes disableUnlimited=\u00a77Oneindig plaatsen van {0} uitgeschakeld voor {1}. distance=\u00a76Afstand\: {0} dontMoveMessage=\u00a77Beginnen met teleporteren over {0}. Niet bewegen. -downloadingGeoIp=Bezig met downloaden van GeoIP database ... Dit kan een tijdje duren (country\: 0.6 MB, city\: 20MB) +downloadingGeoIp=Bezig met downloaden van GeoIP database ... Dit kan een tijdje duren (country\: 1.7 MB, city\: 30MB) duplicatedUserdata=Dubbele gebruikersdata\: {0} en {1}. durability=\u00a77Dit gereedschap kan nog \u00a7c{0}\u00a77 gebruikt worden. editBookContents=\u00a7eU kunt nu de inhoud van dit boek aanpassen. diff --git a/Essentials/src/messages_pl.properties b/Essentials/src/messages_pl.properties index 1c0ea41ef..279095b06 100644 --- a/Essentials/src/messages_pl.properties +++ b/Essentials/src/messages_pl.properties @@ -103,7 +103,7 @@ disabledToSpawnMob=\u00a74Tworzenie tego moba zosta\u0142o wy\u0142\u0105czone w disableUnlimited=\u00a77Wy\u0142\u0105czone nieograniczone tworzenia\u00a7c {0} \u00a77dla {1}. distance=\u00a77Odleg\u0142o\u015B\u0107\: {0} dontMoveMessage=\u00a77Teleportacja nast\u0105pi za\u00a7a {0}\u00a77. Prosz\u0119 si\u0119 nie rusza\u0107. -downloadingGeoIp=Pobieranie bazy danych GeoIP... To mo\u017Ce zaj\u0105\u0107 chwile (kraj\: 0.6 MB, miasto\: 20MB) +downloadingGeoIp=Pobieranie bazy danych GeoIP... To mo\u017Ce zaj\u0105\u0107 chwile (kraj\: 1.7 MB, miasto\: 30MB) duplicatedUserdata=Kopiowanie danych uzytkownika\: {0} i {1} durability=\u00a76Temu narz\u0119dziu pozosta\u0142o \u00a7c{0}\u00a76 u\u017cy\u0107 editBookContents=\u00a7eNie mo\u017Cesz teraz edytowac tej ksi\u0105\u017Cki. diff --git a/Essentials/src/messages_pt.properties b/Essentials/src/messages_pt.properties index 8f28df2fe..fada04973 100644 --- a/Essentials/src/messages_pt.properties +++ b/Essentials/src/messages_pt.properties @@ -103,7 +103,7 @@ disabledToSpawnMob=\u00A74Spawnar este mob foi desativado na configura\u00E7\u00 disableUnlimited=\u00A76Permiss\u00E3o para construir ilimitadamente {0} desativada por\u00A7c {1}. distance=\u00A76Dist\u00E2ncia: {0} dontMoveMessage=\u00A76Teletransporte vai come\u00E7ar em\u00A7c {0}\u00A76. n\u00E3o te mexas. -downloadingGeoIp=A baixar banco de dados GeoIP... pode demorar algum tempo (pa\u00EDs: 0.6 MB, cidade: 20MB) +downloadingGeoIp=A baixar banco de dados GeoIP... pode demorar algum tempo (pa\u00EDs: 1.7 MB, cidade: 30MB) duplicatedUserdata=Dados do usu\u00E1rio em duplicado: {0} e {1}. durability=\u00A76Esta ferramenta ainda pode ser usada mais \u00A7c{0}\u00A76 vezes editBookContents=\u00A7ePodes agora alterar o conte\u00FAdo deste livro. diff --git a/Essentials/src/messages_pt_BR.properties b/Essentials/src/messages_pt_BR.properties index 63bab3b7c..f314bf4a2 100644 --- a/Essentials/src/messages_pt_BR.properties +++ b/Essentials/src/messages_pt_BR.properties @@ -103,7 +103,7 @@ disabledToSpawnMob=\u00A74Spawnar este mob foi desativado na configura\u00E7\u00 disableUnlimited=\u00A76Permiss\u00E3o de colocar coisas ilimitadas desativada para\u00A7c {0} \u00A76por {1}. distance=\u00A76Dist\u00E2ncia\: {0} dontMoveMessage=\u00A76Teleporte vai come\u00E7ar em\u00A7c {0}\u00A76. n\u00E3o se mova. -downloadingGeoIp=Baixando o banco de dados GeoIP... isso pode levar um tempo (pa\u00EDs\: 0.6 MB, cidade\: 20MB) +downloadingGeoIp=Baixando o banco de dados GeoIP... isso pode levar um tempo (pa\u00EDs\: 1.7 MB, cidade\: 30MB) duplicatedUserdata=Dados do usu\u00E1rio duplicado\: {0} e {1}. durability=\u00A76Essa ferramenta ainda pode ser usada mais \u00A7c{0}\u00A76 vezes editBookContents=\u00A7eVoc\u00EA pode agora editar o conte\u00FAdo deste livro. diff --git a/Essentials/src/messages_ru.properties b/Essentials/src/messages_ru.properties index 69adb2cc1..776ce25dd 100644 --- a/Essentials/src/messages_ru.properties +++ b/Essentials/src/messages_ru.properties @@ -103,7 +103,7 @@ disabledToSpawnMob=\u00a74\u0421\u043f\u0430\u0443\u043d \u0434\u0430\u043d\u043 disableUnlimited=\u00a76\u041e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u043e \u043d\u0435\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0435 \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u00a7c {0} \u00a76\u0434\u043b\u044f {1}. distance=\u00a76\u0414\u0438\u0441\u0442\u0430\u043d\u0446\u0438\u044f\: {0} dontMoveMessage=\u00a76\u0422\u0435\u043b\u0435\u043f\u043e\u0440\u0442\u0430\u0446\u0438\u044f \u043d\u0430\u0447\u043d\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437\u00a7c {0}\u00a76. \u041d\u0435 \u0434\u0432\u0438\u0433\u0430\u0439\u0442\u0435\u0441\u044c. -downloadingGeoIp=\u0418\u0434\u0451\u0442 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 GeoIP... \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043d\u044f\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f (\u0441\u0442\u0440\u0430\u043d\u0430\: 0,6 MB \u0433\u043e\u0440\u043e\u0434\: 20MB) +downloadingGeoIp=\u0418\u0434\u0451\u0442 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 GeoIP... \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043d\u044f\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f (\u0441\u0442\u0440\u0430\u043d\u0430\: 1,7 MB \u0433\u043e\u0440\u043e\u0434\: 30MB) duplicatedUserdata=\u0414\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439\: {0} and {1}. durability=\u00a76\u042d\u0442\u043e\u0442 \u043f\u0440\u0435\u0434\u043c\u0435\u0442 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0449\u0451 \u00a7c{0}\u00a76 \u0440\u0430\u0437 editBookContents=\u00a7e\u0422\u0435\u043f\u0435\u0440\u044c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 \u044d\u0442\u043e\u0439 \u043a\u043d\u0438\u0433\u0438. diff --git a/Essentials/src/messages_sv.properties b/Essentials/src/messages_sv.properties index d9fe382cd..ca30dca19 100644 --- a/Essentials/src/messages_sv.properties +++ b/Essentials/src/messages_sv.properties @@ -103,7 +103,7 @@ disabledToSpawnMob=Att spawna fram den h\u00e4r moben \u00e4r inaktiverat i conf disableUnlimited=\u00a77Inaktiverade o\u00e4ndligt placerande av {0} f\u00f6r {1}. distance=\u00a76Avst\u00e5nd\: {0} dontMoveMessage=\u00a77Teleporteringen p\u00e5b\u00f6rjas om {0}. R\u00f6r dig inte. -downloadingGeoIp=Laddar ner GeoIP-databasen... det h\u00e4r kan ta en stund (land\: 0.6 MB, stad\: 20MB) +downloadingGeoIp=Laddar ner GeoIP-databasen... det h\u00e4r kan ta en stund (land\: 1.7 MB, stad\: 30MB) duplicatedUserdata=Dublicerad anv\u00e4ndardata\: {0} och {1} durability=\u00a77Det h\u00e4r verktyget har \u00a7c{0}\u00a77 anv\u00e4ndningar kvar editBookContents=\u00a7eDu kan nu \u00e4ndra inneh\u00e5llet i denna bok. diff --git a/Essentials/src/messages_zh.properties b/Essentials/src/messages_zh.properties index 8bf9cc77f..ae01b244e 100644 --- a/Essentials/src/messages_zh.properties +++ b/Essentials/src/messages_zh.properties @@ -103,7 +103,7 @@ disabledToSpawnMob=\u00a74\u914d\u7f6e\u6587\u4ef6\u4e2d\u5df2\u7981\u6b62\u6b64 disableUnlimited=\u00a76\u53d6\u6d88\u4e86 {1} \u7684\u65e0\u9650\u653e\u7f6e \u00a7c{0} \u00a76\u7684\u80fd\u529b distance=\u00a76\u8ddd\u79bb\: {0} dontMoveMessage=\u00a76\u4f20\u9001\u5c06\u5728\u00a7c{0}\u00a76\u5185\u5f00\u59cb.\u8bf7\u4e0d\u8981\u79fb\u52a8 -downloadingGeoIp=\u4e0b\u8f7d GeoIP \u6570\u636e\u5e93\u4e2d...\u8fd9\u53ef\u80fd\u9700\u8981\u82b1\u8d39\u4e00\u6bb5\u65f6\u95f4 (\u56fd\u5bb6\:0.6 MB, \u57ce\u5e02\: 20 MB) +downloadingGeoIp=\u4e0b\u8f7d GeoIP \u6570\u636e\u5e93\u4e2d...\u8fd9\u53ef\u80fd\u9700\u8981\u82b1\u8d39\u4e00\u6bb5\u65f6\u95f4 (\u56fd\u5bb6\:1.7 MB, \u57ce\u5e02\: 30 MB) duplicatedUserdata=\u590d\u5236\u4e86\u73a9\u5bb6\u5b58\u6863\:{0} \u548c {1} durability=\u00a76\u8fd9\u4e2a\u5de5\u5177\u8fd8\u6709 \u00a74{0}\u00a76 \u6301\u4e45 editBookContents=\u00a7e\u4f60\u73b0\u5728\u53ef\u4ee5\u7f16\u8f91\u8fd9\u672c\u4e66\u7684\u5185\u5bb9. diff --git a/EssentialsGeoIP/pom.xml b/EssentialsGeoIP/pom.xml index 1f69e5578..b73254602 100644 --- a/EssentialsGeoIP/pom.xml +++ b/EssentialsGeoIP/pom.xml @@ -25,15 +25,20 @@ - + net.ess3 - EssentialsX - ${project.version} + EssentialsX + ${project.version} - com.maxmind.geoip - geoip-api - 1.2.11 + com.maxmind.geoip2 + geoip2 + 0.7.2 + + + javatar + javatar + 2.5 @@ -42,7 +47,7 @@ org.apache.maven.plugins maven-shade-plugin - 2.1 + 3.1.0 package @@ -52,9 +57,13 @@ + true - com.maxmind.geoip:geoip-api + javatar:javatar + com.maxmind.geoip2:geoip2 + com.maxmind.db:maxmind-db + com.fasterxml.jackson.core:* diff --git a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java b/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java index 8b3bdfb29..cfd0ff9c0 100644 --- a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java +++ b/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java @@ -32,6 +32,6 @@ public class EssentialsGeoIP extends JavaPlugin { pm.registerEvents(playerListener, this); - getLogger().log(Level.INFO, "This product includes GeoLite data created by MaxMind, available from http://www.maxmind.com/."); + getLogger().log(Level.INFO, "This product includes GeoLite2 data created by MaxMind, available from http://www.maxmind.com/."); } } diff --git a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java b/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java index f38ff8c55..e905bd90b 100644 --- a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java +++ b/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java @@ -3,9 +3,10 @@ package com.earth2me.essentials.geoip; import com.earth2me.essentials.EssentialsConf; import com.earth2me.essentials.IConf; import com.earth2me.essentials.User; -import com.maxmind.geoip.Location; -import com.maxmind.geoip.LookupService; -import com.maxmind.geoip.regionName; +import com.maxmind.geoip2.DatabaseReader; +import com.maxmind.geoip2.model.CityResponse; +import com.maxmind.geoip2.model.CountryResponse; +import com.maxmind.geoip2.exception.*; import net.ess3.api.IEssentials; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -20,13 +21,16 @@ import java.net.URL; import java.net.URLConnection; import java.util.logging.Level; import java.util.logging.Logger; +import java.util.Date; import java.util.zip.GZIPInputStream; +import com.ice.tar.TarInputStream; +import com.ice.tar.TarEntry; import static com.earth2me.essentials.I18n.tl; public class EssentialsGeoIPPlayerListener implements Listener, IConf { - LookupService ls = null; + DatabaseReader mmreader = null; // initialize maxmind geoip2 reader private static final Logger logger = Logger.getLogger("Minecraft"); File databaseFile; File dataFolder; @@ -58,22 +62,48 @@ public class EssentialsGeoIPPlayerListener implements Listener, IConf { } InetAddress address = player.getAddress().getAddress(); StringBuilder sb = new StringBuilder(); - if (config.getBoolean("database.show-cities", false)) { - Location loc = ls.getLocation(address); - if (loc == null) { - return; + String locale = ess.getI18n().getCurrentLocale().toString().replace('_', '-'); // get locale setting from Essentials + try { + if (config.getBoolean("database.show-cities", false)) { + CityResponse response = mmreader.city(address); + if (response == null) { + return; + } + String city; + String region; + String country; + if (config.getBoolean("enable-locale", true)) { + // Get geolocation based on locale. If not avaliable in specific language, get the default one. + city = ((city=response.getCity().getNames().get(locale))!=null) ? city : response.getCity().getName(); + region = ((region=response.getMostSpecificSubdivision().getNames().get(locale))!=null) ? region : response.getMostSpecificSubdivision().getName(); + country = ((country=response.getCountry().getNames().get(locale))!=null) ? country : response.getCountry().getName(); + } else { + // Get geolocation regarding locale setting. + city = response.getCity().getName(); + region = response.getMostSpecificSubdivision().getName(); + country = response.getCountry().getName(); + } + if (city != null) { + sb.append(city).append(", "); + } + if (region != null) { + sb.append(region).append(", "); + } + sb.append(country); + } else { + CountryResponse response = mmreader.country(address); + sb.append(response.getCountry().getNames().get(locale)); + } + } catch (AddressNotFoundException ex) { + // GeoIP2 API forced this when address not found in their DB. jar will not complied without this. + // TODO: Maybe, we can set a new custom msg about addr-not-found in messages.properties. + logger.log(Level.INFO, tl("cantReadGeoIpDB") + " " + ex.getLocalizedMessage()); + //logger.log(Level.INFO, tl("cantReadGeoIpDB") + " " + ex.getMessage()); + } catch (IOException | GeoIp2Exception ex) { + // GeoIP2 API forced this when address not found in their DB. jar will not complied without this. + logger.log(Level.SEVERE, tl("cantReadGeoIpDB") + " " + ex.getLocalizedMessage()); + //logger.log(Level.SEVERE, tl("cantReadGeoIpDB") + " " + ex.getMessage()); } - if (loc.city != null) { - sb.append(loc.city).append(", "); - } - String region = regionName.regionNameByCode(loc.countryCode, loc.region); - if (region != null) { - sb.append(region).append(", "); - } - sb.append(loc.countryName); - } else { - sb.append(ls.getCountry(address).getName()); - } if (config.getBoolean("show-on-whois", true)) { u.setGeoLocation(sb.toString()); } @@ -92,9 +122,9 @@ public class EssentialsGeoIPPlayerListener implements Listener, IConf { config.load(); if (config.getBoolean("database.show-cities", false)) { - databaseFile = new File(dataFolder, "GeoIPCity.dat"); + databaseFile = new File(dataFolder, "Geo2-City.mmdb"); } else { - databaseFile = new File(dataFolder, "GeoIP.dat"); + databaseFile = new File(dataFolder, "Geo2-Country.mmdb"); } if (!databaseFile.exists()) { if (config.getBoolean("database.download-if-missing", true)) { @@ -103,9 +133,15 @@ public class EssentialsGeoIPPlayerListener implements Listener, IConf { logger.log(Level.SEVERE, tl("cantFindGeoIpDB")); return; } + } else if (config.getBoolean("database.update.enable", true)) { + // try to update expired mmdb files + long diff = new Date().getTime() - databaseFile.lastModified(); + if (diff/24/3600/1000>config.getLong("database.update.by-every-x-days")) { + downloadDatabase(); + } } try { - ls = new LookupService(databaseFile); + mmreader = new DatabaseReader.Builder(databaseFile).build(); } catch (IOException ex) { logger.log(Level.SEVERE, tl("cantReadGeoIpDB"), ex); } @@ -129,11 +165,26 @@ public class EssentialsGeoIPPlayerListener implements Listener, IConf { conn.setConnectTimeout(10000); conn.connect(); InputStream input = conn.getInputStream(); - if (url.endsWith(".gz")) { - input = new GZIPInputStream(input); - } OutputStream output = new FileOutputStream(databaseFile); byte[] buffer = new byte[2048]; + if (url.endsWith(".gz")) { + input = new GZIPInputStream(input); + if (url.endsWith(".tar.gz")) { + // The new GeoIP2 uses tar.gz to pack the db file along with some other txt. So it makes things a bit complicated here. + String filename; + TarInputStream tarInputStream = new TarInputStream(input); + TarEntry entry; + while ((entry = (TarEntry) tarInputStream.getNextEntry()) != null) { + if (!entry.isDirectory()) { + filename = entry.getName(); + if (filename.substring(filename.length() - 5).equalsIgnoreCase(".mmdb")) { + input = tarInputStream; + break; + } + } + } + } + } int length = input.read(buffer); while (length >= 0) { output.write(buffer, 0, length); diff --git a/EssentialsGeoIP/src/config.yml b/EssentialsGeoIP/src/config.yml index 70d7a51ba..b52629a28 100644 --- a/EssentialsGeoIP/src/config.yml +++ b/EssentialsGeoIP/src/config.yml @@ -2,9 +2,14 @@ database: show-cities: false download-if-missing: true # Url for country - download-url: "http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz" + download-url: "http://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.tar.gz" # Url for cities - download-url-city: "http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz" - + download-url-city: "http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz" + update: + enable: true + by-every-x-days: 30 show-on-login: true -show-on-whois: true \ No newline at end of file +show-on-whois: true +# Enable locale on geolocation display. Not all languages are supported. +# Check your Essentials/config.yml "locale" section for details. +enable-locale: true \ No newline at end of file diff --git a/EssentialsGeoIP/src/plugin.yml b/EssentialsGeoIP/src/plugin.yml index 5fc8d7987..e8cb6bf6d 100644 --- a/EssentialsGeoIP/src/plugin.yml +++ b/EssentialsGeoIP/src/plugin.yml @@ -5,5 +5,5 @@ main: com.earth2me.essentials.geoip.EssentialsGeoIP version: ${project.version}-b${build.number} website: http://tiny.cc/EssentialsCommands description: Shows the country or city of a user on login and /whois. -authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology] +authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, kjiang] depend: [Essentials]