diff options
Diffstat (limited to 'EssentialsGeoIP/src')
3 files changed, 19 insertions, 11 deletions
diff --git a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java b/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java index e0ca6cd7c..f9436d7f0 100644 --- a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java +++ b/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java @@ -1,7 +1,7 @@ package com.earth2me.essentials.geoip; import static com.earth2me.essentials.I18n._; -import com.earth2me.essentials.IEssentials; +import com.earth2me.essentials.api.IEssentials; import java.util.logging.Level; import java.util.logging.Logger; import org.bukkit.event.Event.Priority; diff --git a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java b/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java index ee187c2aa..5a33fecc9 100644 --- a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java +++ b/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java @@ -2,9 +2,9 @@ package com.earth2me.essentials.geoip; import com.earth2me.essentials.EssentialsConf; import static com.earth2me.essentials.I18n._; -import com.earth2me.essentials.IConf; -import com.earth2me.essentials.IEssentials; -import com.earth2me.essentials.User; +import com.earth2me.essentials.api.IReload; +import com.earth2me.essentials.api.IEssentials; +import com.earth2me.essentials.api.IUser; import com.maxmind.geoip.Location; import com.maxmind.geoip.LookupService; import com.maxmind.geoip.regionName; @@ -21,7 +21,7 @@ import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerListener; -public class EssentialsGeoIPPlayerListener extends PlayerListener implements IConf +public class EssentialsGeoIPPlayerListener extends PlayerListener implements IReload { LookupService ls = null; private static final Logger logger = Logger.getLogger("Minecraft"); @@ -36,13 +36,13 @@ public class EssentialsGeoIPPlayerListener extends PlayerListener implements ICo this.dataFolder = dataFolder; this.config = new EssentialsConf(new File(dataFolder, "config.yml")); config.setTemplateName("/config.yml", EssentialsGeoIP.class); - reloadConfig(); + onReload(); } @Override public void onPlayerJoin(PlayerJoinEvent event) { - User u = ess.getUser(event.getPlayer()); + IUser u = ess.getUser(event.getPlayer()); if (u.isAuthorized("essentials.geoip.hide")) { return; @@ -73,13 +73,21 @@ public class EssentialsGeoIPPlayerListener extends PlayerListener implements ICo } if (config.getBoolean("show-on-whois", true)) { - u.setGeoLocation(sb.toString()); + u.acquireWriteLock(); + try + { + u.getData().setGeolocation(sb.toString()); + } + finally + { + u.unlock(); + } } if (config.getBoolean("show-on-login", true) && !u.isHidden()) { for (Player player : event.getPlayer().getServer().getOnlinePlayers()) { - User user = ess.getUser(player); + IUser user = ess.getUser(player); if (user.isAuthorized("essentials.geoip.show")) { user.sendMessage(_("geoipJoinFormat", u.getDisplayName(), sb.toString())); @@ -89,7 +97,7 @@ public class EssentialsGeoIPPlayerListener extends PlayerListener implements ICo } @Override - public final void reloadConfig() + public final void onReload() { config.load(); diff --git a/EssentialsGeoIP/src/plugin.yml b/EssentialsGeoIP/src/plugin.yml index 92fdc9963..ebdc3a97f 100644 --- a/EssentialsGeoIP/src/plugin.yml +++ b/EssentialsGeoIP/src/plugin.yml @@ -3,7 +3,7 @@ name: EssentialsGeoIP main: com.earth2me.essentials.geoip.EssentialsGeoIP # Note to developers: This next line cannot change, or the automatic versioning system will break. version: TeamCity -website: http://www.earth2me.net:8001/ +website: http://tiny.cc/EssentialsWiki description: Shows the country or city of a user on login and /whois. authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology] depend: [Essentials]
\ No newline at end of file |