mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-11-03 01:19:58 +01:00
Merge branch 'master' of github.com:essentials/Essentials
This commit is contained in:
commit
9fca3728c3
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,5 +36,6 @@ public class Commandvanish extends EssentialsCommand
|
||||
user.sendMessage(ChatColor.GREEN + _("unvanished"));
|
||||
}
|
||||
}
|
||||
user.toggleVanished();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user