1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-13 18:14:38 +02:00

Updated all modules to new api, some settings are still missing

This commit is contained in:
snowleo
2011-12-14 16:31:08 +01:00
parent 9ab2fe54fc
commit 0155bcedb7
23 changed files with 106 additions and 88 deletions

View File

@@ -1,7 +1,7 @@
package com.earth2me.essentials.chat;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.api.IEssentials;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentSkipListMap;

View File

@@ -2,9 +2,9 @@ package com.earth2me.essentials.chat;
import com.earth2me.essentials.ChargeException;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.api.IEssentials;
import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User;
import com.earth2me.essentials.api.IUser;
import java.util.Map;
import java.util.logging.Logger;
import org.bukkit.Location;
@@ -53,7 +53,7 @@ public abstract class EssentialsChatPlayer extends PlayerListener
}
}
final User user = ess.getUser(event.getPlayer());
final IUser user = ess.getUser(event.getPlayer());
if (!isAffordableFor(user, command))
{
event.setCancelled(true);
@@ -106,7 +106,7 @@ public abstract class EssentialsChatPlayer extends PlayerListener
return true;
}
protected void sendLocalChat(final User sender, final long radius, final PlayerChatEvent event)
protected void sendLocalChat(final IUser sender, final long radius, final PlayerChatEvent event)
{
event.setCancelled(true);
logger.info(_("localFormat", sender.getName(), event.getMessage()));
@@ -116,9 +116,9 @@ public abstract class EssentialsChatPlayer extends PlayerListener
for (Player onlinePlayer : server.getOnlinePlayers())
{
String type = "[L]";
final User user = ess.getUser(onlinePlayer);
final IUser user = ess.getUser(onlinePlayer);
//TODO: remove reference to op
if (user.isIgnoredPlayer(sender.getName()) && !sender.isOp())
if (user.isIgnoringPlayer(sender.getName()) && !sender.isOp())
{
continue;
}

View File

@@ -1,8 +1,8 @@
package com.earth2me.essentials.chat;
import com.earth2me.essentials.ChargeException;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
import com.earth2me.essentials.api.IEssentials;
import com.earth2me.essentials.api.IUser;
import java.util.Map;
import org.bukkit.Server;
import org.bukkit.event.player.PlayerChatEvent;
@@ -37,7 +37,7 @@ public class EssentialsChatPlayerListenerHighest extends EssentialsChatPlayer
/**
* This file should handle charging the user for the action before returning control back
*/
final User user = ess.getUser(event.getPlayer());
final IUser user = ess.getUser(event.getPlayer());
try
{
@@ -45,7 +45,7 @@ public class EssentialsChatPlayerListenerHighest extends EssentialsChatPlayer
}
catch (ChargeException e)
{
ess.showError(user, e, charge);
ess.getCommandHandler().showCommandError(user, charge, e);
event.setCancelled(true);
return;
}

View File

@@ -1,7 +1,7 @@
package com.earth2me.essentials.chat;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
import com.earth2me.essentials.api.IEssentials;
import com.earth2me.essentials.api.IUser;
import java.util.Locale;
import java.util.Map;
import org.bukkit.Server;
@@ -28,7 +28,7 @@ public class EssentialsChatPlayerListenerLowest extends EssentialsChatPlayer
/**
* This listener should apply the general chat formatting only...then return control back the event handler
*/
final User user = ess.getUser(event.getPlayer());
final IUser user = ess.getUser(event.getPlayer());
if (user.isAuthorized("essentials.chat.color"))
{
event.setMessage(event.getMessage().replaceAll("&([0-9a-f])", "\u00a7$1"));

View File

@@ -1,8 +1,8 @@
package com.earth2me.essentials.chat;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
import com.earth2me.essentials.api.IEssentials;
import com.earth2me.essentials.api.IUser;
import java.util.Locale;
import java.util.Map;
import org.bukkit.Server;
@@ -48,7 +48,7 @@ public class EssentialsChatPlayerListenerNormal extends EssentialsChatPlayer
return;
}
radius *= radius;
final User user = ess.getUser(event.getPlayer());
final IUser user = ess.getUser(event.getPlayer());
if (event.getMessage().length() > 0 && chatType.length() > 0)
{

View File

@@ -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;

View File

@@ -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();

View File

@@ -1,8 +1,8 @@
package com.earth2me.essentials.protect;
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.earth2me.essentials.protect.data.ProtectedBlockMemory;
import com.earth2me.essentials.protect.data.ProtectedBlockMySQL;
import com.earth2me.essentials.protect.data.ProtectedBlockSQLite;
@@ -45,7 +45,7 @@ public class EssentialsConnect
return ess;
}
public void alert(final User user, final String item, final String type)
public void alert(final IUser user, final String item, final String type)
{
final Location loc = user.getLocation();
final String warnMessage = _("alertFormat", user.getName(), type, item,
@@ -54,7 +54,7 @@ public class EssentialsConnect
LOGGER.log(Level.WARNING, warnMessage);
for (Player p : ess.getServer().getOnlinePlayers())
{
final User alertUser = ess.getUser(p);
final IUser alertUser = ess.getUser(p);
if (alertUser.isAuthorized("essentials.protect.alerts"))
{
alertUser.sendMessage(warnMessage);
@@ -63,10 +63,10 @@ public class EssentialsConnect
}
private class ProtectReloader implements IConf
private class ProtectReloader implements IReload
{
@Override
public void reloadConfig()
public void onReload()
{
if (protect.getStorage() != null)
{

View File

@@ -1,8 +1,8 @@
package com.earth2me.essentials.protect;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
import com.earth2me.essentials.api.IEssentials;
import com.earth2me.essentials.api.IUser;
import com.earth2me.essentials.protect.data.IProtectedBlock;
import java.util.ArrayList;
import java.util.List;
@@ -31,7 +31,7 @@ public class EssentialsProtectBlockListener extends BlockListener
return;
}
final User user = ess.getUser(event.getPlayer());
final IUser user = ess.getUser(event.getPlayer());
if (prot.getSettingBool(ProtectConfig.disable_build) && !user.canBuild())
{
@@ -228,7 +228,7 @@ public class EssentialsProtectBlockListener extends BlockListener
{
return;
}
final User user = ess.getUser(event.getPlayer());
final IUser user = ess.getUser(event.getPlayer());
if (prot.getSettingBool(ProtectConfig.disable_build) && !user.canBuild())
{

View File

@@ -1,7 +1,7 @@
package com.earth2me.essentials.protect;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
import com.earth2me.essentials.api.IEssentials;
import com.earth2me.essentials.api.IUser;
import com.earth2me.essentials.craftbukkit.FakeExplosion;
import java.util.Locale;
import org.bukkit.Material;
@@ -39,7 +39,7 @@ public class EssentialsProtectEntityListener extends EntityListener
return;
}
final User user = ess.getUser(target);
final IUser user = target instanceof Player ? ess.getUser((Player)target) : null;
if (event instanceof EntityDamageByBlockEvent)
{
final DamageCause cause = event.getCause();
@@ -77,7 +77,7 @@ public class EssentialsProtectEntityListener extends EntityListener
{
final EntityDamageByEntityEvent edEvent = (EntityDamageByEntityEvent)event;
final Entity eAttack = edEvent.getDamager();
final User attacker = ess.getUser(eAttack);
final IUser attacker = eAttack instanceof Player ? ess.getUser((Player)eAttack) : null;
// PVP Settings
if (target instanceof Player && eAttack instanceof Player
@@ -134,7 +134,7 @@ public class EssentialsProtectEntityListener extends EntityListener
|| (((Projectile)edEvent.getDamager()).getShooter() instanceof Player
&& prot.getSettingBool(ProtectConfig.disable_pvp)
&& (!user.isAuthorized("essentials.protect.pvp")
|| !ess.getUser(((Projectile)edEvent.getDamager()).getShooter()).isAuthorized("essentials.protect.pvp")))))
|| !ess.getUser((Player)((Projectile)edEvent.getDamager()).getShooter()).isAuthorized("essentials.protect.pvp")))))
{
event.setCancelled(true);
return;
@@ -299,7 +299,7 @@ public class EssentialsProtectEntityListener extends EntityListener
{
return;
}
final User user = ess.getUser(event.getTarget());
final IUser user = ess.getUser((Player)event.getTarget());
if ((event.getReason() == TargetReason.CLOSEST_PLAYER
|| event.getReason() == TargetReason.TARGET_ATTACKED_ENTITY
|| event.getReason() == TargetReason.PIG_ZOMBIE_TARGET

View File

@@ -1,8 +1,8 @@
package com.earth2me.essentials.protect;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
import com.earth2me.essentials.api.IEssentials;
import com.earth2me.essentials.api.IUser;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.event.block.Action;
@@ -26,7 +26,7 @@ public class EssentialsProtectPlayerListener extends PlayerListener
public void onPlayerInteract(final PlayerInteractEvent event)
{
// Do not return if cancelled, because the interact event has 2 cancelled states.
final User user = ess.getUser(event.getPlayer());
final IUser user = ess.getUser(event.getPlayer());
if (event.hasItem()
&& (event.getItem().getType() == Material.WATER_BUCKET

View File

@@ -1,7 +1,7 @@
package com.earth2me.essentials.spawn;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import com.earth2me.essentials.api.IUser;
import com.earth2me.essentials.commands.EssentialsCommand;
import org.bukkit.Server;
@@ -14,7 +14,7 @@ public class Commandsetspawn extends EssentialsCommand
}
@Override
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
{
final String group = args.length > 0 ? getFinalArg(args, 0) : "default";
((SpawnStorage)module).setSpawn(user.getLocation(), group);

View File

@@ -2,7 +2,7 @@ package com.earth2me.essentials.spawn;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User;
import com.earth2me.essentials.api.IUser;
import com.earth2me.essentials.commands.EssentialsCommand;
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
import org.bukkit.Location;
@@ -19,13 +19,13 @@ public class Commandspawn extends EssentialsCommand
}
@Override
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
{
final Trade charge = new Trade(this.getName(), ess);
charge.isAffordableFor(user);
if (args.length > 0 && user.isAuthorized("essentials.spawn.others"))
{
final User otherUser = getPlayer(server, args, 0);
final IUser otherUser = getPlayer(server, args, 0);
respawn(otherUser, null);
if (!otherUser.equals(user))
{
@@ -46,13 +46,13 @@ public class Commandspawn extends EssentialsCommand
{
throw new NotEnoughArgumentsException();
}
final User user = getPlayer(server, args, 0);
final IUser user = getPlayer(server, args, 0);
respawn(user, null);
user.sendMessage(_("teleportAtoB", user.getDisplayName(), "spawn"));
sender.sendMessage(_("teleporting"));
}
private void respawn (final User user, final Trade charge) throws Exception {
private void respawn (final IUser user, final Trade charge) throws Exception {
final SpawnStorage spawns = (SpawnStorage)this.module;
final Location spawn = spawns.getSpawn(user.getGroup());
user.getTeleport().teleport(spawn, charge, TeleportCause.COMMAND);

View File

@@ -1,8 +1,10 @@
package com.earth2me.essentials.spawn;
import com.earth2me.essentials.EssentialsCommandHandler;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.IEssentialsModule;
import com.earth2me.essentials.api.ICommandHandler;
import com.earth2me.essentials.api.IEssentials;
import com.earth2me.essentials.api.IEssentialsModule;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Bukkit;
@@ -19,6 +21,7 @@ public class EssentialsSpawn extends JavaPlugin
private static final Logger LOGGER = Bukkit.getLogger();
private transient IEssentials ess;
private transient SpawnStorage spawns;
private transient ICommandHandler commandHandler;
public void onEnable()
{
@@ -37,6 +40,8 @@ public class EssentialsSpawn extends JavaPlugin
spawns = new SpawnStorage(ess);
ess.addReloadListener(spawns);
commandHandler = new EssentialsCommandHandler(EssentialsSpawn.class.getClassLoader(), "com.earth2me.essentials.spawn.Command", "essentials.", spawns, ess);
final EssentialsSpawnPlayerListener playerListener = new EssentialsSpawnPlayerListener(ess, spawns);
pluginManager.registerEvent(Type.PLAYER_RESPAWN, playerListener, ess.getSettings().getRespawnPriority(), this);
pluginManager.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.Low, this);
@@ -52,6 +57,6 @@ public class EssentialsSpawn extends JavaPlugin
public boolean onCommand(final CommandSender sender, final Command command,
final String commandLabel, final String[] args)
{
return ess.onCommandEssentials(sender, command, commandLabel, args, EssentialsSpawn.class.getClassLoader(), "com.earth2me.essentials.spawn.Command", "essentials.", spawns);
return commandHandler.handleCommand(sender, command, commandLabel, args);
}
}

View File

@@ -1,8 +1,8 @@
package com.earth2me.essentials.spawn;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
import com.earth2me.essentials.api.IEssentials;
import com.earth2me.essentials.api.IUser;
import java.util.logging.Level;
import org.bukkit.Bukkit;
import org.bukkit.Location;
@@ -27,7 +27,7 @@ public class EssentialsSpawnPlayerListener extends PlayerListener
@Override
public void onPlayerRespawn(final PlayerRespawnEvent event)
{
final User user = ess.getUser(event.getPlayer());
final IUser user = ess.getUser(event.getPlayer());
if (ess.getSettings().getRespawnAtHome())
{
@@ -52,7 +52,7 @@ public class EssentialsSpawnPlayerListener extends PlayerListener
@Override
public void onPlayerJoin(final PlayerJoinEvent event)
{
final User user = ess.getUser(event.getPlayer());
final IUser user = ess.getUser(event.getPlayer());
if (!user.isNew() || user.getBedSpawnLocation() != null)
{
@@ -73,9 +73,9 @@ public class EssentialsSpawnPlayerListener extends PlayerListener
private class NewPlayerTeleport implements Runnable
{
private final transient User user;
private final transient IUser user;
public NewPlayerTeleport(final User user)
public NewPlayerTeleport(final IUser user)
{
this.user = user;
}

View File

@@ -1,7 +1,7 @@
package com.earth2me.essentials.spawn;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.IEssentialsModule;
import com.earth2me.essentials.api.IEssentials;
import com.earth2me.essentials.api.IEssentialsModule;
import com.earth2me.essentials.settings.Spawns;
import com.earth2me.essentials.storage.AsyncStorageObjectHolder;
import java.io.File;
@@ -17,7 +17,7 @@ public class SpawnStorage extends AsyncStorageObjectHolder<Spawns> implements IE
public SpawnStorage(final IEssentials ess)
{
super(ess, Spawns.class);
reloadConfig();
onReload();
}
@Override

View File

@@ -1,6 +1,6 @@
package com.earth2me.essentials.xmpp;
import com.earth2me.essentials.User;
import com.earth2me.essentials.api.IUser;
import com.earth2me.essentials.commands.EssentialsCommand;
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
import org.bukkit.Server;
@@ -14,7 +14,7 @@ public class Commandsetxmpp extends EssentialsCommand
}
@Override
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws NotEnoughArgumentsException
protected void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws NotEnoughArgumentsException
{
if (args.length < 1)
{

View File

@@ -31,7 +31,7 @@ public class Commandxmpp extends EssentialsCommand
else
{
final String message = getFinalArg(args, 1);
final String senderName = sender instanceof Player ? ess.getUser(sender).getDisplayName() : Console.NAME;
final String senderName = sender instanceof Player ? ess.getUser((Player)sender).getDisplayName() : Console.NAME;
sender.sendMessage("[" + senderName + ">" + address + "] " + message);
if (!EssentialsXMPP.getInstance().sendMessage(address, "[" + senderName + "] " + message))
{

View File

@@ -1,8 +1,10 @@
package com.earth2me.essentials.xmpp;
import com.earth2me.essentials.EssentialsCommandHandler;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.IUser;
import com.earth2me.essentials.api.ICommandHandler;
import com.earth2me.essentials.api.IEssentials;
import com.earth2me.essentials.api.IUser;
import java.util.List;
import java.util.Locale;
import java.util.logging.Level;
@@ -23,6 +25,7 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP
private transient UserManager users;
private transient XMPPManager xmpp;
private transient IEssentials ess;
private transient ICommandHandler commandHandler;
public static IEssentialsXMPP getInstance()
{
@@ -57,6 +60,8 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP
ess.addReloadListener(users);
ess.addReloadListener(xmpp);
commandHandler = new EssentialsCommandHandler(EssentialsXMPP.class.getClassLoader(), "com.earth2me.essentials.xmpp.Command", "essentials.", ess);
LOGGER.info(_("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team"));
}
@@ -73,7 +78,7 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP
@Override
public boolean onCommand(final CommandSender sender, final Command command, final String commandLabel, final String[] args)
{
return ess.onCommandEssentials(sender, command, commandLabel, args, EssentialsXMPP.class.getClassLoader(), "com.earth2me.essentials.xmpp.Command", "essentials.", null);
return commandHandler.handleCommand(sender, command, commandLabel, args);
}
@Override

View File

@@ -1,7 +1,7 @@
package com.earth2me.essentials.xmpp;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
import com.earth2me.essentials.api.IEssentials;
import com.earth2me.essentials.api.IUser;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerListener;
@@ -21,21 +21,21 @@ class EssentialsXMPPPlayerListener extends PlayerListener
@Override
public void onPlayerJoin(final PlayerJoinEvent event)
{
final User user = ess.getUser(event.getPlayer());
final IUser user = ess.getUser(event.getPlayer());
sendMessageToSpyUsers("Player " + user.getDisplayName() + " joined the game");
}
@Override
public void onPlayerChat(final PlayerChatEvent event)
{
final User user = ess.getUser(event.getPlayer());
final IUser user = ess.getUser(event.getPlayer());
sendMessageToSpyUsers(String.format(event.getFormat(), user.getDisplayName(), event.getMessage()));
}
@Override
public void onPlayerQuit(final PlayerQuitEvent event)
{
final User user = ess.getUser(event.getPlayer());
final IUser user = ess.getUser(event.getPlayer());
sendMessageToSpyUsers("Player " + user.getDisplayName() + " left the game");
}

View File

@@ -1,6 +1,6 @@
package com.earth2me.essentials.xmpp;
import com.earth2me.essentials.IUser;
import com.earth2me.essentials.api.IUser;
import java.util.List;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;

View File

@@ -1,12 +1,12 @@
package com.earth2me.essentials.xmpp;
import com.earth2me.essentials.EssentialsConf;
import com.earth2me.essentials.IConf;
import com.earth2me.essentials.api.IReload;
import java.io.File;
import java.util.*;
public class UserManager implements IConf
public class UserManager implements IReload
{
private final transient EssentialsConf users;
private final transient List<String> spyusers = new ArrayList<String>();
@@ -16,7 +16,7 @@ public class UserManager implements IConf
public UserManager(final File folder)
{
users = new EssentialsConf(new File(folder, "users.yml"));
reloadConfig();
onReload();
}
public final boolean isSpy(final String username)
@@ -65,11 +65,11 @@ public class UserManager implements IConf
userdata.put(SPY, spy);
users.setProperty(username, userdata);
users.save();
reloadConfig();
onReload();
}
@Override
public final void reloadConfig()
public final void onReload()
{
users.load();
spyusers.clear();

View File

@@ -2,8 +2,8 @@ package com.earth2me.essentials.xmpp;
import com.earth2me.essentials.Console;
import com.earth2me.essentials.EssentialsConf;
import com.earth2me.essentials.IConf;
import com.earth2me.essentials.IUser;
import com.earth2me.essentials.api.IReload;
import com.earth2me.essentials.api.IUser;
import java.io.File;
import java.util.*;
import java.util.logging.Handler;
@@ -18,7 +18,7 @@ import org.jivesoftware.smack.packet.Presence;
import org.jivesoftware.smack.util.StringUtils;
public class XMPPManager extends Handler implements MessageListener, ChatManagerListener, IConf
public class XMPPManager extends Handler implements MessageListener, ChatManagerListener, IReload
{
private static final Logger LOGGER = Logger.getLogger("Minecraft");
private final transient EssentialsConf config;
@@ -39,7 +39,7 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager
this.parent = parent;
config = new EssentialsConf(new File(parent.getDataFolder(), "config.yml"));
config.setTemplateName("/config.yml", EssentialsXMPP.class);
reloadConfig();
onReload();
}
public boolean sendMessage(final String address, final String message)
@@ -166,7 +166,7 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager
}
@Override
public final void reloadConfig()
public final void onReload()
{
LOGGER.removeHandler(this);
config.load();