Welcome! This is the Bukkit version of my Country On Join for Bungee.
What it do?
It broadcasts join messages mentioning the country from which the players connects. Like this:
And provides a command and placeholders to get the country information about a player.
Multi-language & customizable messages
The default available languages are:
English Español (Spanish) Русский (Russian) 汉语 (Simplified Chinese) Thank you @R_Josef and Redstone-ray
And you can create your own translation just creating a new file in the folder of "messages" and/or in the folder "countrynames".
Configuration
This is the configuration file:
Code (Text):
# Do you like to replace the original MC join message or broadcast an aditional one?
# Set to true to replace the original MC message.
# Set to false for just broadcast a new message. (also you can use this to workaround another plugin that is cancelling/modifying the join messages)
replaceDefaultJoinMessage: true
# If could not get the country for the player (e.g. internal network) and replaceDefaultJoinMessage is set to false.
# Set to true to broadcast the join message anyway.
# Set to false for no join message.
broadcastOnUnknownCountry: true
# If could not get the country for the player and the broadcastOnUnknownCountry is set to true.
# Set to true to broadcast the join message without the country version.
# Set to false to broadcast the normal join message using the 'unknown' country name.
broadcastAltJoinMsgOnUnknownCountry: true
# The messages file to use.
# See in the 'messages' folder for available cultures in the filenames: messages/messages.<culture>.yml
messages-culture: "en-US"
# The country names file to use.
# See in the 'countrynames' folder for available cultures in the filenames: countrynames/countrynames.<culture>.yml
countrynames-culture: "en-US"
# Allow this plugin to use the PlaceholdersAPI for provide some placeholders for use in other plugins.
# If there is no PlaceholderAPI plugin installed on the server then this setting is ignored.
enablePlaceholderAPIHook: true
# The GeoIP database file name to load.
# Use this to load a different database than the provided by the plugin. For example, if you update the database manually.
geoIPDB: "GeoLite2-Country.mmdb"
# Spam the console with useful information for error reporting. Should be disabled on production environment.
debug: false
Commands
Code (Text):
/countryonjoin reload
You can reload the changes in the configuration without restarting the server.
Code (Text):
/country <player>
You can get country information about an online player.
Permissions
Code (Text):
countryonjoin.hide
You can hide the country for the player. It affects the placeholders also. (default: false)
Code (Text):
countryonjoin.command.reload
Access to the command "/countryonjoin reload". (default: false)
Code (Text):
countryonjoin.command.country
Access to the command "/country". (default: false)
Placeholders
This plugin supports placeholders (
PlaceholderAPI).
Its optional and works only if PlaceholderAPI is present on the sever (and can be disabled via config).
Code (Text):
%countryonjoin_player_country_code%
You can get the country ISO code of a player.
Code (Text):
%countryonjoin_player_country_name%
You can get the country name of a player.
No auto-update No statistics send No special requirements
Installation
Drop the downloaded JAR file in your Bukkit/Spigot plugins folder and restart the server. If you are going to use placeholders then install the PlaceholderAPI also.
Open the config.yml file and change it as needed and save the changes.
Type countryonjoin reload in the console. Or give the countryonjoin.command.reload permission to a player and type the command /countryonjoin reload ingame as a player.
Done!
F.A.Q.
Why it not shows my country? Maybe you are connecting from the internal network... it will not work because the plugin needs your public (internet) IP. Or you need to review your network setup. Are the server getting the real player IP? If you are using BungeeCord proxy then you need to configure the IP forward or use the "Bungee Edition" of this plugin. Another cause is if you added the "*" permission to the player. If you do that you are including the permission "countryonjoin.hide" and it will hide the country.
How it works? This product includes GeoLite2 data created by MaxMind, available from http://www.maxmind.com
Do I need to update the database? In the maxmind site states "GeoLite2 databases are updated on the first Tuesday of each month." so you can download the new database from here (the "GeoLite2 Country" in the format "MaxMind DB binary, gzipped"), extract it, and rename if (for example: GeoLite2-Country_custom.mmdb) and place the file in the plugin folder. Edit the config.yml file to change geoIPDB setting to file name you used (for example: GeoLite2-Country_custom.mmdb). More info here.
How can I create a new translation? Create the new file in folder "messages" with the pattern "messages.<culture>_custom.yml" and a new file in the folder "countrynames" with the pattern "countrynames.<culture>_custom.yml" (where culture_customis the id you will set in the config.yml). Then copy the contents from an existing file for use it as a base for your translation. When done change the config.yml to the new culture id. And reload the configuration or restart the server. Do not modify the default files, you will lose the changes! More info here.
Why the join message is duplicated? Look at the "config.yml" file and configure it to replace the original MC message.
Its not working, no join message is shown Maybe you have another plugin that is blocking or modifying the join messages. In that case you can try to configure in the "config.yml" file to NOT replace the original MC join message.
Why the JAR file is big? Because it includes a large GeoIP database and all the needed libraries for querying it without external dependencies.
Can I use it with BungeeCord? Yes, if you have configured IP forwarding. But you will need this plugin in every server. Instead you can use the "Bungee Edition" of this plugin.
Server throws a warning "Unable to load JDK7 types (annotations, java.nio.file.Path): no Java7 support added". You can safely ignore that warning. It is coming from a third party dependency and I cannot suppress it at the moment.
Plans for future versions
This list is unordered. No priorities set at the moment. You can suggest new features or changes on the discussion section or in the github. And you are welcome to help with the development!
Make it smaller. I'm working on a tool to convert the GeoIP database to a custom scheme and remove the "unneeded" data from it. This should make the plugin a lot smaller, less ram consumption and may be faster lookups. The tool will be open source also and the plugin will still recognize the original MaxMinds db if present and newer.
Remove the "Unable to load JDK7 types (annotations, java.nio.file.Path): no Java7 support added" warning.
Add cache. As we now support placeholders and a command to get the country information, the lookups may be invoked multiple times, but the player address will not be changed while he is online. So we can cache the country information and associate it to the player.
Show the nickname (provided by other plugins) instead of the username on the join messages.
Optimization. Make the lookups on a separate thread and may be add a timeout.
Translations. Let to translate other plugin messages, like the ones used in the "/country" command.
Statistics? Let the server owner know which countries play more.
Make a better update system, detect if db file is newer and let use the original file name. Update the config.yml with new entries.
And this is the list of what i'm
not considering to add to this plugin at the moment:
Country white/black listing. This feature is already available on other plugins and I personally think that this should be done at router level.
I tested it only on the mentioned game versions. Please share your results on other versions.