Attempt to fix /seen times on vanish.

This commit is contained in:
KHobbits 2013-06-02 17:45:56 +01:00
parent 43f4a69760
commit 5d5fee4612
6 changed files with 39 additions and 12 deletions

View File

@ -287,7 +287,7 @@ public class Essentials extends JavaPlugin implements IEssentials
User user = getUser(p);
if (user.isVanished())
{
user.toggleVanished();
user.setVanished(false);
p.sendMessage(_("unvanishedReload"));
}
}

View File

@ -137,7 +137,7 @@ public class EssentialsPlayerListener implements Listener
}
if (user.isVanished())
{
user.toggleVanished();
user.setVanished(false);
}
user.setLogoutLocation();
if (user.isRecipeSee())

View File

@ -96,7 +96,9 @@ public class EssentialsTimer implements Runnable
final User user = ess.getUser(iterator.next());
if (user.getLastOnlineActivity() < currentTime && user.getLastOnlineActivity() > user.getLastLogout())
{
user.setLastLogout(user.getLastOnlineActivity());
if (!user.isHidden()) {
user.setLastLogout(user.getLastOnlineActivity());
}
iterator.remove();
continue;
}

View File

@ -40,7 +40,31 @@ public interface IUser extends Player
Location getHome(Location loc) throws Exception;
/**
* 'Hidden' Represents when a player is hidden from others.
* This status includes when the player is hidden via other supported plugins.
* Use isVanished() if you want to check if a user is vanished by Essentials.
*
* @return If the user is hidden or not
* @see isVanished
*/
boolean isHidden();
void setHidden(boolean vanish);
/**
* 'Vanished' Represents when a player is hidden from others by Essentials.
* This status does NOT include when the player is hidden via other plugins.
* Use isHidden() if you want to check if a user is vanished by any supported plugin.
*
* @return If the user is vanished or not
* @see isHidden
*/
boolean isVanished();
void setVanished(boolean vanish);
Teleport getTeleport();

View File

@ -44,6 +44,9 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
{
afkPosition = getLocation();
}
if (isOnline()) {
lastOnlineActivity = System.currentTimeMillis();
}
}
User update(final Player base)
@ -485,6 +488,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
return hidden;
}
@Override
public void setHidden(final boolean hidden)
{
this.hidden = hidden;
@ -687,11 +691,13 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
return teleportInvulnerabilityTimestamp != 0 && teleportInvulnerabilityTimestamp >= System.currentTimeMillis();
}
@Override
public boolean isVanished()
{
return vanished;
}
@Override
public void setVanished(final boolean set)
{
vanished = set;
@ -726,12 +732,6 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
}
}
public void toggleVanished()
{
final boolean set = !vanished;
this.setVanished(set);
}
public boolean checkSignThrottle()
{
if (isSignThrottled())

View File

@ -17,14 +17,15 @@ public class Commandvanish extends EssentialsCommand
{
if (args.length < 1)
{
user.toggleVanished();
if (user.isVanished())
{
user.sendMessage(_("vanished"));
user.setVanished(false);
user.sendMessage(_("unvanished"));
}
else
{
user.sendMessage(_("unvanished"));
user.setVanished(true);
user.sendMessage(_("vanished"));
}
}
else