summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2013-06-02 17:45:56 +0100
committerKHobbits <rob@khobbits.co.uk>2013-06-02 17:45:56 +0100
commit5d5fee4612d155eff320e6d5dec0f902f6ad9ecc (patch)
treedb91862c48a5250f0b823d863dd0a90fe9bfd8d2
parent43f4a697605848bd62fb68f070534aa3e36bf27e (diff)
downloadEssentials-5d5fee4612d155eff320e6d5dec0f902f6ad9ecc.tar
Essentials-5d5fee4612d155eff320e6d5dec0f902f6ad9ecc.tar.gz
Essentials-5d5fee4612d155eff320e6d5dec0f902f6ad9ecc.tar.lz
Essentials-5d5fee4612d155eff320e6d5dec0f902f6ad9ecc.tar.xz
Essentials-5d5fee4612d155eff320e6d5dec0f902f6ad9ecc.zip
Attempt to fix /seen times on vanish.
-rw-r--r--Essentials/src/com/earth2me/essentials/Essentials.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsTimer.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/IUser.java24
-rw-r--r--Essentials/src/com/earth2me/essentials/User.java12
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandvanish.java7
6 files changed, 39 insertions, 12 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java
index d48fdd951..594a63d83 100644
--- a/Essentials/src/com/earth2me/essentials/Essentials.java
+++ b/Essentials/src/com/earth2me/essentials/Essentials.java
@@ -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"));
}
}
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
index fba01d544..047ab1886 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
@@ -137,7 +137,7 @@ public class EssentialsPlayerListener implements Listener
}
if (user.isVanished())
{
- user.toggleVanished();
+ user.setVanished(false);
}
user.setLogoutLocation();
if (user.isRecipeSee())
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsTimer.java b/Essentials/src/com/earth2me/essentials/EssentialsTimer.java
index d2ee913d5..2d3b4a1cc 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsTimer.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsTimer.java
@@ -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;
}
diff --git a/Essentials/src/com/earth2me/essentials/IUser.java b/Essentials/src/com/earth2me/essentials/IUser.java
index 227cfa480..88ff78532 100644
--- a/Essentials/src/com/earth2me/essentials/IUser.java
+++ b/Essentials/src/com/earth2me/essentials/IUser.java
@@ -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();
diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java
index 0d112dd79..f25ea5f1d 100644
--- a/Essentials/src/com/earth2me/essentials/User.java
+++ b/Essentials/src/com/earth2me/essentials/User.java
@@ -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())
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandvanish.java b/Essentials/src/com/earth2me/essentials/commands/Commandvanish.java
index ea051e4be..d3a876146 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandvanish.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandvanish.java
@@ -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