Revert "New config option 'cancel-afk-on-move' - Set to false you don't use afk." -- This should fix afk mode.

This reverts commit d927d04765.

Conflicts:

	Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
This commit is contained in:
snowleo 2012-04-26 10:41:24 +02:00
parent e37b1946f5
commit 95e6db6797
4 changed files with 31 additions and 59 deletions

View File

@ -73,40 +73,37 @@ public class EssentialsPlayerListener implements Listener
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onPlayerMove(final PlayerMoveEvent event)
{
if ((!ess.getSettings().cancelAfkOnMove() && !ess.getSettings().getFreezeAfkPlayers())
|| event.getFrom().getBlockX() == event.getTo().getBlockX()
&& event.getFrom().getBlockZ() == event.getTo().getBlockZ()
&& event.getFrom().getBlockY() == event.getTo().getBlockY())
if (event.getFrom().getBlockX() == event.getTo().getBlockX()
&& event.getFrom().getBlockZ() == event.getTo().getBlockZ()
&& event.getFrom().getBlockY() == event.getTo().getBlockY())
{
return;
}
final User user = ess.getUser(event.getPlayer());
if (user.isAfk())
{
if (ess.getSettings().getFreezeAfkPlayers())
{
final Location from = event.getFrom();
final Location to = event.getTo().clone();
to.setX(from.getX());
to.setY(from.getY());
to.setZ(from.getZ());
try
{
event.setTo(Util.getSafeDestination(to));
}
catch (Exception ex)
{
event.setTo(to);
}
return;
}
final Location afk = user.getAfkPosition();
if (afk == null || event.getTo().getWorld() != afk.getWorld() || afk.distanceSquared(event.getTo()) > 9)
if (user.isAfk() && ess.getSettings().getFreezeAfkPlayers())
{
final Location from = event.getFrom();
final Location to = event.getTo().clone();
to.setX(from.getX());
to.setY(from.getY());
to.setZ(from.getZ());
try
{
user.updateActivity(true);
event.setTo(Util.getSafeDestination(to));
}
catch (Exception ex)
{
event.setTo(to);
}
return;
}
final Location afk = user.getAfkPosition();
if (afk == null || !event.getTo().getWorld().equals(afk.getWorld()) || afk.distanceSquared(event.getTo()) > 9)
{
user.updateActivity(true);
}
}

View File

@ -127,7 +127,7 @@ public interface ISettings extends IConf
boolean removeGodOnDisconnect();
boolean changeDisplayName();
boolean changePlayerListName();
boolean isPlayerCommand(String string);
@ -146,8 +146,6 @@ public interface ISettings extends IConf
boolean getFreezeAfkPlayers();
boolean cancelAfkOnMove();
boolean areDeathMessagesEnabled();
public void setDebug(boolean debug);
@ -167,12 +165,12 @@ public interface ISettings extends IConf
EventPriority getRespawnPriority();
long getTpaAcceptCancellation();
boolean isMetricsEnabled();
void setMetricsEnabled(boolean metricsEnabled);
long getTeleportInvulnerability();
boolean isTeleportInvulnerability();
}

View File

@ -385,8 +385,6 @@ public class Settings implements ISettings
teleportInvulnerability = _isTeleportInvulnerability();
disableItemPickupWhileAfk = _getDisableItemPickupWhileAfk();
registerBackInListener = _registerBackInListener();
cancelAfkOnMove = _cancelAfkOnMove();
getFreezeAfkPlayers = _getFreezeAfkPlayers();
itemSpawnBl = _getItemSpawnBlacklist();
kits = _getKits();
chatFormats.clear();
@ -656,30 +654,12 @@ public class Settings implements ISettings
{
return config.getLong("auto-afk-kick", -1);
}
private boolean getFreezeAfkPlayers;
@Override
public boolean getFreezeAfkPlayers()
{
return getFreezeAfkPlayers;
}
private boolean _getFreezeAfkPlayers()
{
return config.getBoolean("freeze-afk-players", false);
}
private boolean cancelAfkOnMove;
@Override
public boolean cancelAfkOnMove()
{
return cancelAfkOnMove;
}
private boolean _cancelAfkOnMove()
{
return config.getBoolean("cancel-afk-on-move", true);
}
@Override
public boolean areDeathMessagesEnabled()
@ -711,18 +691,20 @@ public class Settings implements ISettings
{
return config.getBoolean("world-teleport-permissions", false);
}
private boolean registerBackInListener;
private boolean registerBackInListener;
@Override
public boolean registerBackInListener()
{
return registerBackInListener;
}
private boolean _registerBackInListener()
{
return config.getBoolean("register-back-in-listener", false);
}
private boolean disableItemPickupWhileAfk;
@Override

View File

@ -272,11 +272,6 @@ freeze-afk-players: false
# Enable this, when you don't want people idling in mob traps.
disable-item-pickup-while-afk: false
# Should we automatically remove afk status when the player moves?
# Player will be removed from afk on chat/command reguardless of this setting.
# Disable this to reduce server lag.
cancel-afk-on-move: true
# You can disable the death messages of minecraft here
death-messages: true