Merge branch 'master' of github.com:essentials/Essentials

This commit is contained in:
KHobbits 2012-05-22 00:39:44 +01:00
commit 9fca3728c3
6 changed files with 30 additions and 2 deletions

View File

@ -85,6 +85,7 @@ public class Essentials extends JavaPlugin implements IEssentials
private transient I18n i18n;
private transient Metrics metrics;
private transient EssentialsTimer timer;
private transient List<String> vanishedPlayers = new ArrayList<String>();
@Override
public ISettings getSettings()
@ -240,7 +241,7 @@ public class Essentials extends JavaPlugin implements IEssentials
pm.registerEvents(tntListener, this);
timer = new EssentialsTimer(this);
getScheduler().scheduleSyncRepeatingTask(this, timer, 1, 100);
getScheduler().scheduleSyncRepeatingTask(this, timer, 100, 100);
Economy.setEss(this);
execTimer.mark("RegListeners");
@ -629,6 +630,12 @@ public class Essentials extends JavaPlugin implements IEssentials
return timer;
}
@Override
public List<String> getVanishedPlayers()
{
return vanishedPlayers;
}
private static class EssentialsWorldListener implements Listener, Runnable
{
private transient final IEssentials ess;

View File

@ -114,6 +114,7 @@ public class EssentialsPlayerListener implements Listener
{
user.toggleGodModeEnabled();
}
ess.getVanishedPlayers().remove(user.getName());
user.setLastLocation();
user.updateActivity(false);
user.dispose();
@ -141,6 +142,14 @@ public class EssentialsPlayerListener implements Listener
user.setLastLogin(System.currentTimeMillis());
user.updateActivity(false);
for (String p : ess.getVanishedPlayers())
{
if (!user.isAuthorized("essentials.vanish.see"))
{
user.hidePlayer(ess.getUser(p));
}
}
if (user.isAuthorized("essentials.sleepingignored"))
{
user.setSleepingIgnored(true);

View File

@ -12,7 +12,7 @@ public class EssentialsTimer implements Runnable
{
private final transient IEssentials ess;
private final transient Set<User> onlineUsers = new HashSet<User>();
private transient long lastPoll = System.currentTimeMillis() - 3000;
private transient long lastPoll = System.currentTimeMillis();
private final transient LinkedList<Float> history = new LinkedList<Float>();
EssentialsTimer(final IEssentials ess)

View File

@ -4,6 +4,7 @@ import com.earth2me.essentials.api.IJails;
import com.earth2me.essentials.metrics.Metrics;
import com.earth2me.essentials.perm.PermissionsHandler;
import com.earth2me.essentials.register.payment.Methods;
import java.util.List;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@ -72,4 +73,6 @@ public interface IEssentials extends Plugin
void setMetrics(Metrics metrics);
EssentialsTimer getTimer();
List<String> getVanishedPlayers();
}

View File

@ -650,5 +650,13 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
public void toggleVanished()
{
vanished = !vanished;
if (vanished)
{
ess.getVanishedPlayers().add(getName());
}
else
{
ess.getVanishedPlayers().remove(getName());
}
}
}

View File

@ -36,5 +36,6 @@ public class Commandvanish extends EssentialsCommand
user.sendMessage(ChatColor.GREEN + _("unvanished"));
}
}
user.toggleVanished();
}
}