mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 04:20:41 +00:00
New config option disable-item-pickup-while-afk, defaults to true.
This commit is contained in:
parent
324cd74826
commit
d60de76d87
5 changed files with 33 additions and 6 deletions
|
@ -215,6 +215,7 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||||
pm.registerEvent(Type.PLAYER_ANIMATION, playerListener, Priority.High, this);
|
pm.registerEvent(Type.PLAYER_ANIMATION, playerListener, Priority.High, this);
|
||||||
pm.registerEvent(Type.PLAYER_CHANGED_WORLD, playerListener, Priority.Normal, this);
|
pm.registerEvent(Type.PLAYER_CHANGED_WORLD, playerListener, Priority.Normal, this);
|
||||||
pm.registerEvent(Type.PLAYER_INTERACT, playerListener, Priority.Monitor, this);
|
pm.registerEvent(Type.PLAYER_INTERACT, playerListener, Priority.Monitor, this);
|
||||||
|
pm.registerEvent(Type.PLAYER_PICKUP_ITEM, playerListener, Priority.Low, this);
|
||||||
pm.registerEvent(Type.PLAYER_TELEPORT, new ItemDupeFix(), Priority.Monitor, this);
|
pm.registerEvent(Type.PLAYER_TELEPORT, new ItemDupeFix(), Priority.Monitor, this);
|
||||||
|
|
||||||
final EssentialsBlockListener blockListener = new EssentialsBlockListener(this);
|
final EssentialsBlockListener blockListener = new EssentialsBlockListener(this);
|
||||||
|
|
|
@ -235,7 +235,7 @@ public class EssentialsPlayerListener extends PlayerListener
|
||||||
|
|
||||||
final User user = ess.getUser(event.getPlayer());
|
final User user = ess.getUser(event.getPlayer());
|
||||||
//There is TeleportCause.COMMMAND but plugins have to actively pass the cause in on their teleports.
|
//There is TeleportCause.COMMMAND but plugins have to actively pass the cause in on their teleports.
|
||||||
if((event.getCause() == TeleportCause.PLUGIN || event.getCause() == TeleportCause.COMMAND)&& ess.getSettings().registerBackInListener())
|
if ((event.getCause() == TeleportCause.PLUGIN || event.getCause() == TeleportCause.COMMAND) && ess.getSettings().registerBackInListener())
|
||||||
{
|
{
|
||||||
user.setLastLocation();
|
user.setLastLocation();
|
||||||
}
|
}
|
||||||
|
@ -382,4 +382,18 @@ public class EssentialsPlayerListener extends PlayerListener
|
||||||
SetBed.setBed(event.getPlayer(), event.getClickedBlock());
|
SetBed.setBed(event.getPlayer(), event.getClickedBlock());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPlayerPickupItem(PlayerPickupItemEvent event)
|
||||||
|
{
|
||||||
|
if (event.isCancelled() || !ess.getSettings().getDisableItemPickupWhileAfk())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final User user = ess.getUser(event.getPlayer());
|
||||||
|
if (user.isAfk())
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,4 +146,6 @@ public interface ISettings extends IConf
|
||||||
boolean getIsWorldTeleportPermissions();
|
boolean getIsWorldTeleportPermissions();
|
||||||
|
|
||||||
boolean registerBackInListener();
|
boolean registerBackInListener();
|
||||||
|
|
||||||
|
public boolean getDisableItemPickupWhileAfk();
|
||||||
}
|
}
|
||||||
|
|
|
@ -572,4 +572,10 @@ public class Settings implements ISettings
|
||||||
{
|
{
|
||||||
return config.getBoolean("register-back-in-listener", false);
|
return config.getBoolean("register-back-in-listener", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean getDisableItemPickupWhileAfk()
|
||||||
|
{
|
||||||
|
return config.getBoolean("disable-item-pickup-while-afk", true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,6 +213,10 @@ auto-afk-kick: -1
|
||||||
# The player has to use the command /afk to leave the afk mode.
|
# The player has to use the command /afk to leave the afk mode.
|
||||||
freeze-afk-players: false
|
freeze-afk-players: false
|
||||||
|
|
||||||
|
# When the player is afk, should he be able to pickup items?
|
||||||
|
# Enable this, when you don't want people idling in mob traps.
|
||||||
|
disable-item-pickup-while-afk: true
|
||||||
|
|
||||||
# You can disable the death messages of minecraft here
|
# You can disable the death messages of minecraft here
|
||||||
death-messages: true
|
death-messages: true
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue