1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-12 09:35:26 +02:00

Heavy cleanup of all classes

ItemDb is not static anymore
Essentials.getStatic() removed
This commit is contained in:
snowleo
2011-07-16 01:33:22 +02:00
parent 25c9557c59
commit a38fe6acd4
48 changed files with 330 additions and 294 deletions

View File

@@ -1,6 +1,6 @@
package com.earth2me.essentials.chat;
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;
@@ -17,17 +17,17 @@ public class EssentialsChat extends JavaPlugin
public void onEnable()
{
final PluginManager pluginManager = getServer().getPluginManager();
final IEssentials ess = (IEssentials)pluginManager.getPlugin("Essentials");
EssentialsChatPlayerListener.checkFactions(pluginManager);
final EssentialsChatPlayerListener playerListener = new EssentialsChatPlayerListener(getServer());
pluginManager.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.Lowest, this);
final EssentialsChatPlayerListener playerListener = new EssentialsChatPlayerListener(getServer(), ess);
pluginManager.registerEvent(Type.PLAYER_CHAT, playerListener, Priority.Highest, 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"));
}
public void onDisable()

View File

@@ -1,6 +1,5 @@
package com.earth2me.essentials.chat;
import com.earth2me.essentials.Essentials;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
@@ -12,7 +11,6 @@ import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerListener;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
@@ -22,19 +20,14 @@ import org.mcteam.factions.Factions;
public class EssentialsChatPlayerListener extends PlayerListener
{
private static final Logger LOGGER = Logger.getLogger("Minecraft");
private final transient IEssentials ess = Essentials.getStatic();
private final transient IEssentials ess;
private final transient Server server;
private static Factions factions = null;
public EssentialsChatPlayerListener(final Server server)
public EssentialsChatPlayerListener(final Server server, final IEssentials ess)
{
this.server = server;
}
@Override
public void onPlayerJoin(final PlayerJoinEvent event)
{
final User user = ess.getUser(event.getPlayer());
this.ess = ess;
}
@Override