mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-28 19:11:53 +01:00
New config option 'cancel-afk-on-move' - Set to false you don't use afk.
This commit is contained in:
parent
6dc2e96509
commit
d927d04765
@ -72,7 +72,8 @@ public class EssentialsPlayerListener implements Listener
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onPlayerMove(final PlayerMoveEvent event)
|
||||
{
|
||||
if (event.getFrom().getBlockX() == event.getTo().getBlockX()
|
||||
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())
|
||||
{
|
||||
@ -80,8 +81,9 @@ public class EssentialsPlayerListener implements Listener
|
||||
}
|
||||
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
|
||||
if (user.isAfk() && ess.getSettings().getFreezeAfkPlayers())
|
||||
if (user.isAfk())
|
||||
{
|
||||
if (ess.getSettings().getFreezeAfkPlayers())
|
||||
{
|
||||
final Location from = event.getFrom();
|
||||
final Location to = event.getTo().clone();
|
||||
@ -105,6 +107,7 @@ public class EssentialsPlayerListener implements Listener
|
||||
user.updateActivity(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPlayerQuit(final PlayerQuitEvent event)
|
||||
@ -346,7 +349,7 @@ public class EssentialsPlayerListener implements Listener
|
||||
break;
|
||||
case LEFT_CLICK_AIR:
|
||||
case LEFT_CLICK_BLOCK:
|
||||
if (event.getItem() != null && event.getMaterial() != Material.AIR)
|
||||
if (event.getItem() != null && event.getItem().getTypeId() != Material.AIR.getId())
|
||||
{
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
if (user.hasPowerTools() && user.arePowerToolsEnabled() && usePowertools(user, event.getItem().getTypeId()))
|
||||
|
@ -146,6 +146,8 @@ public interface ISettings extends IConf
|
||||
|
||||
boolean getFreezeAfkPlayers();
|
||||
|
||||
boolean cancelAfkOnMove();
|
||||
|
||||
boolean areDeathMessagesEnabled();
|
||||
|
||||
public void setDebug(boolean debug);
|
||||
|
@ -385,6 +385,8 @@ public class Settings implements ISettings
|
||||
teleportInvulnerability = _isTeleportInvulnerability();
|
||||
disableItemPickupWhileAfk = _getDisableItemPickupWhileAfk();
|
||||
registerBackInListener = _registerBackInListener();
|
||||
cancelAfkOnMove = _cancelAfkOnMove();
|
||||
getFreezeAfkPlayers = _getFreezeAfkPlayers();
|
||||
itemSpawnBl = _getItemSpawnBlacklist();
|
||||
kits = _getKits();
|
||||
chatFormats.clear();
|
||||
@ -654,12 +656,30 @@ 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()
|
||||
@ -691,7 +711,6 @@ public class Settings implements ISettings
|
||||
{
|
||||
return config.getBoolean("world-teleport-permissions", false);
|
||||
}
|
||||
|
||||
private boolean registerBackInListener;
|
||||
|
||||
@Override
|
||||
@ -704,7 +723,6 @@ public class Settings implements ISettings
|
||||
{
|
||||
return config.getBoolean("register-back-in-listener", false);
|
||||
}
|
||||
|
||||
private boolean disableItemPickupWhileAfk;
|
||||
|
||||
@Override
|
||||
|
@ -272,6 +272,11 @@ freeze-afk-players: false
|
||||
# Enable this, when you don't want people idling in mob traps.
|
||||
disable-item-pickup-while-afk: true
|
||||
|
||||
# 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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user