summaryrefslogtreecommitdiffstats
path: root/EssentialsGeoIP
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2011-07-16 01:33:22 +0200
committersnowleo <schneeleo@gmail.com>2011-07-16 01:33:22 +0200
commit616b880e13fd07d880e934f394427df6fa2be5df (patch)
tree0c8d89dd654c80bbe64d554bd1198032ca6aec28 /EssentialsGeoIP
parent372f88757b6f703885586895c98bfdeb74bbc7e7 (diff)
downloadEssentials-616b880e13fd07d880e934f394427df6fa2be5df.tar
Essentials-616b880e13fd07d880e934f394427df6fa2be5df.tar.gz
Essentials-616b880e13fd07d880e934f394427df6fa2be5df.tar.lz
Essentials-616b880e13fd07d880e934f394427df6fa2be5df.tar.xz
Essentials-616b880e13fd07d880e934f394427df6fa2be5df.zip
Heavy cleanup of all classes
ItemDb is not static anymore Essentials.getStatic() removed
Diffstat (limited to 'EssentialsGeoIP')
-rw-r--r--EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java10
-rw-r--r--EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java6
2 files changed, 9 insertions, 7 deletions
diff --git a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java b/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java
index ef9d9af27..aa919f44b 100644
--- a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java
+++ b/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java
@@ -1,6 +1,7 @@
package com.earth2me.essentials.geoip;
import com.earth2me.essentials.Essentials;
+import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.Util;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -26,14 +27,15 @@ public class EssentialsGeoIP extends JavaPlugin
@Override
public void onEnable()
{
- PluginManager pm = getServer().getPluginManager();
- EssentialsGeoIPPlayerListener playerListener = new EssentialsGeoIPPlayerListener(getDataFolder());
+ final PluginManager pm = getServer().getPluginManager();
+ final IEssentials ess = (IEssentials)pm.getPlugin("Essentials");
+ final EssentialsGeoIPPlayerListener playerListener = new EssentialsGeoIPPlayerListener(getDataFolder(), ess);
pm.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.Monitor, this);
- if (!this.getDescription().getVersion().equals(Essentials.getStatic().getDescription().getVersion())) {
+ if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion())) {
logger.log(Level.WARNING, Util.i18n("versionMismatchAll"));
}
- logger.info(Util.format("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), Essentials.AUTHORS));
+ logger.info(Util.format("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team"));
logger.log(Level.INFO, "This product includes GeoLite 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 a9dd9ad3d..5a6553f0e 100644
--- a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java
+++ b/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java
@@ -1,6 +1,5 @@
package com.earth2me.essentials.geoip;
-import com.earth2me.essentials.Essentials;
import com.earth2me.essentials.EssentialsConf;
import com.earth2me.essentials.IConf;
import com.earth2me.essentials.IEssentials;
@@ -33,9 +32,11 @@ public class EssentialsGeoIPPlayerListener extends PlayerListener implements ICo
File databaseFile;
File dataFolder;
EssentialsConf config;
+ private final transient IEssentials ess;
- public EssentialsGeoIPPlayerListener(File dataFolder)
+ public EssentialsGeoIPPlayerListener(File dataFolder, IEssentials ess)
{
+ this.ess = ess;
this.dataFolder = dataFolder;
this.config = new EssentialsConf(new File(dataFolder, "config.yml"));
config.setTemplateName("/config.yml", EssentialsGeoIP.class);
@@ -45,7 +46,6 @@ public class EssentialsGeoIPPlayerListener extends PlayerListener implements ICo
@Override
public void onPlayerJoin(PlayerJoinEvent event)
{
- IEssentials ess = Essentials.getStatic();
User u = ess.getUser(event.getPlayer());
if (u.isAuthorized("essentials.geoip.hide"))
{