summaryrefslogtreecommitdiffstats
path: root/EssentialsGeoIP/src
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2011-12-14 16:31:08 +0100
committersnowleo <schneeleo@gmail.com>2011-12-14 16:31:08 +0100
commit0155bcedb7f00726d0b2f14e612a5342322a8278 (patch)
treea490495781c26b553f719dda2b70ece6889a3605 /EssentialsGeoIP/src
parent9ab2fe54fcea6565bdfc29aa3e3c60cb07adf1b2 (diff)
downloadEssentials-0155bcedb7f00726d0b2f14e612a5342322a8278.tar
Essentials-0155bcedb7f00726d0b2f14e612a5342322a8278.tar.gz
Essentials-0155bcedb7f00726d0b2f14e612a5342322a8278.tar.lz
Essentials-0155bcedb7f00726d0b2f14e612a5342322a8278.tar.xz
Essentials-0155bcedb7f00726d0b2f14e612a5342322a8278.zip
Updated all modules to new api, some settings are still missing
Diffstat (limited to 'EssentialsGeoIP/src')
-rw-r--r--EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java2
-rw-r--r--EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java26
2 files changed, 18 insertions, 10 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();