mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-26 11:07:55 +01:00
Prevent afk message after login, also don't show afk message on logout.
This commit is contained in:
parent
e0d913dbaf
commit
382bd24046
@ -17,8 +17,6 @@
|
||||
*/
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import com.earth2me.essentials.perm.IPermissionsHandler;
|
||||
import com.earth2me.essentials.perm.ConfigPermissionsHandler;
|
||||
import com.earth2me.essentials.api.Economy;
|
||||
import com.earth2me.essentials.commands.EssentialsCommand;
|
||||
import java.io.*;
|
||||
@ -42,7 +40,6 @@ import org.bukkit.command.PluginCommand;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event.Priority;
|
||||
import org.bukkit.event.Event.Type;
|
||||
import org.bukkit.event.server.ServerListener;
|
||||
import org.bukkit.plugin.*;
|
||||
import org.bukkit.plugin.java.*;
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
@ -213,7 +210,7 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||
pm.registerEvent(Type.ENTITY_EXPLODE, tntListener, Priority.High, this);
|
||||
|
||||
final EssentialsTimer timer = new EssentialsTimer(this);
|
||||
getScheduler().scheduleSyncRepeatingTask(this, timer, 1, 50);
|
||||
getScheduler().scheduleSyncRepeatingTask(this, timer, 1, 100);
|
||||
Economy.setEss(this);
|
||||
if (getSettings().isUpdateEnabled())
|
||||
{
|
||||
|
@ -73,7 +73,7 @@ public class EssentialsPlayerListener extends PlayerListener
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
user.updateActivity();
|
||||
user.updateActivity(true);
|
||||
if (ess.getSettings().changeDisplayName())
|
||||
{
|
||||
user.setDisplayName(user.getNick());
|
||||
@ -107,7 +107,7 @@ public class EssentialsPlayerListener extends PlayerListener
|
||||
return;
|
||||
}
|
||||
|
||||
user.updateActivity();
|
||||
user.updateActivity(true);
|
||||
|
||||
if (!ess.getSettings().getNetherPortalsEnabled())
|
||||
{
|
||||
@ -226,7 +226,7 @@ public class EssentialsPlayerListener extends PlayerListener
|
||||
user.getInventory().setContents(user.getSavedInventory());
|
||||
user.setSavedInventory(null);
|
||||
}
|
||||
user.updateActivity();
|
||||
user.updateActivity(false);
|
||||
user.dispose();
|
||||
if (!ess.getSettings().getReclaimSetting())
|
||||
{
|
||||
@ -275,7 +275,7 @@ public class EssentialsPlayerListener extends PlayerListener
|
||||
{
|
||||
user.setDisplayName(user.getNick());
|
||||
}
|
||||
user.setAfk(false);
|
||||
user.updateActivity(false);
|
||||
if (user.isAuthorized("essentials.sleepingignored"))
|
||||
{
|
||||
user.setSleepingIgnored(true);
|
||||
@ -489,7 +489,7 @@ public class EssentialsPlayerListener extends PlayerListener
|
||||
}
|
||||
if (!cmd.equalsIgnoreCase("afk"))
|
||||
{
|
||||
user.updateActivity();
|
||||
user.updateActivity(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -413,12 +413,15 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
}
|
||||
}
|
||||
|
||||
public void updateActivity()
|
||||
public void updateActivity(final boolean broadcast)
|
||||
{
|
||||
if (isAfk())
|
||||
{
|
||||
setAfk(false);
|
||||
ess.broadcastMessage(getName(), Util.format("userIsNotAway", getDisplayName()));
|
||||
if (broadcast)
|
||||
{
|
||||
ess.broadcastMessage(getName(), Util.format("userIsNotAway", getDisplayName()));
|
||||
}
|
||||
return;
|
||||
}
|
||||
lastActivity = System.currentTimeMillis();
|
||||
|
@ -35,7 +35,7 @@ public class Commandafk extends EssentialsCommand
|
||||
{
|
||||
//user.sendMessage(Util.i18n("markedAsNotAway"));
|
||||
ess.broadcastMessage(user.getName(), Util.format("userIsNotAway", user.getDisplayName()));
|
||||
user.updateActivity();
|
||||
user.updateActivity(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user