mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-11-07 03:02:11 +01:00
Make NCP listeners identifiable by implementing ComponentWithName
(adding NCPListener, CheckListener).
This commit is contained in:
parent
448ae2249b
commit
040947b6d3
@ -40,6 +40,7 @@ import fr.neatmonster.nocheatplus.command.CommandHandler;
|
|||||||
import fr.neatmonster.nocheatplus.command.INotifyReload;
|
import fr.neatmonster.nocheatplus.command.INotifyReload;
|
||||||
import fr.neatmonster.nocheatplus.components.ComponentWithName;
|
import fr.neatmonster.nocheatplus.components.ComponentWithName;
|
||||||
import fr.neatmonster.nocheatplus.components.INeedConfig;
|
import fr.neatmonster.nocheatplus.components.INeedConfig;
|
||||||
|
import fr.neatmonster.nocheatplus.components.NCPListener;
|
||||||
import fr.neatmonster.nocheatplus.components.NameSetPermState;
|
import fr.neatmonster.nocheatplus.components.NameSetPermState;
|
||||||
import fr.neatmonster.nocheatplus.components.NoCheatPlusAPI;
|
import fr.neatmonster.nocheatplus.components.NoCheatPlusAPI;
|
||||||
import fr.neatmonster.nocheatplus.components.PermStateReceiver;
|
import fr.neatmonster.nocheatplus.components.PermStateReceiver;
|
||||||
@ -606,7 +607,7 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private Listener getCoreListener() {
|
private Listener getCoreListener() {
|
||||||
return new Listener() {
|
return new NCPListener() {
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onPlayerLogin(final PlayerLoginEvent event) {
|
public void onPlayerLogin(final PlayerLoginEvent event) {
|
||||||
|
29
src/fr/neatmonster/nocheatplus/checks/CheckListener.java
Normal file
29
src/fr/neatmonster/nocheatplus/checks/CheckListener.java
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
package fr.neatmonster.nocheatplus.checks;
|
||||||
|
|
||||||
|
import fr.neatmonster.nocheatplus.components.NCPListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class provides naming etc for registration with ListenerManager.
|
||||||
|
* For listeners registered by NoCheatPlus only.
|
||||||
|
* @author mc_dev
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class CheckListener extends NCPListener{
|
||||||
|
|
||||||
|
/** Check group / type which this listener is for. */
|
||||||
|
protected final CheckType checkType;
|
||||||
|
|
||||||
|
public CheckListener(){
|
||||||
|
this(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CheckListener(CheckType checkType){
|
||||||
|
this.checkType = checkType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getComponentName() {
|
||||||
|
final String part = super.getComponentName();
|
||||||
|
return checkType == null ? part : part + "_" + checkType.name();
|
||||||
|
}
|
||||||
|
}
|
@ -6,13 +6,14 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
import org.bukkit.event.block.BlockDamageEvent;
|
import org.bukkit.event.block.BlockDamageEvent;
|
||||||
import org.bukkit.event.player.PlayerAnimationEvent;
|
import org.bukkit.event.player.PlayerAnimationEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
|
||||||
|
import fr.neatmonster.nocheatplus.checks.CheckListener;
|
||||||
|
import fr.neatmonster.nocheatplus.checks.CheckType;
|
||||||
import fr.neatmonster.nocheatplus.checks.inventory.Items;
|
import fr.neatmonster.nocheatplus.checks.inventory.Items;
|
||||||
import fr.neatmonster.nocheatplus.permissions.Permissions;
|
import fr.neatmonster.nocheatplus.permissions.Permissions;
|
||||||
import fr.neatmonster.nocheatplus.utilities.BlockProperties;
|
import fr.neatmonster.nocheatplus.utilities.BlockProperties;
|
||||||
@ -40,7 +41,7 @@ import fr.neatmonster.nocheatplus.utilities.TickTask;
|
|||||||
*
|
*
|
||||||
* @see BlockBreakEvent
|
* @see BlockBreakEvent
|
||||||
*/
|
*/
|
||||||
public class BlockBreakListener implements Listener {
|
public class BlockBreakListener extends CheckListener {
|
||||||
|
|
||||||
/** The direction check. */
|
/** The direction check. */
|
||||||
private final Direction direction = new Direction();
|
private final Direction direction = new Direction();
|
||||||
@ -62,6 +63,10 @@ public class BlockBreakListener implements Listener {
|
|||||||
|
|
||||||
private boolean isInstaBreak = false;
|
private boolean isInstaBreak = false;
|
||||||
|
|
||||||
|
public BlockBreakListener(){
|
||||||
|
super(CheckType.BLOCKBREAK);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We listen to BlockBreak events for obvious reasons.
|
* We listen to BlockBreak events for obvious reasons.
|
||||||
*
|
*
|
||||||
|
@ -4,10 +4,12 @@ import org.bukkit.block.Block;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
|
||||||
|
import fr.neatmonster.nocheatplus.checks.CheckListener;
|
||||||
|
import fr.neatmonster.nocheatplus.checks.CheckType;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* M#"""""""'M dP dP M""M dP dP
|
* M#"""""""'M dP dP M""M dP dP
|
||||||
* ## mmmm. `M 88 88 M M 88 88
|
* ## mmmm. `M 88 88 M M 88 88
|
||||||
@ -30,7 +32,7 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
|||||||
*
|
*
|
||||||
* @see BlockInteractEvent
|
* @see BlockInteractEvent
|
||||||
*/
|
*/
|
||||||
public class BlockInteractListener implements Listener {
|
public class BlockInteractListener extends CheckListener {
|
||||||
|
|
||||||
/** The direction check. */
|
/** The direction check. */
|
||||||
private final Direction direction = new Direction();
|
private final Direction direction = new Direction();
|
||||||
@ -38,6 +40,10 @@ public class BlockInteractListener implements Listener {
|
|||||||
/** The reach check. */
|
/** The reach check. */
|
||||||
private final Reach reach = new Reach();
|
private final Reach reach = new Reach();
|
||||||
|
|
||||||
|
public BlockInteractListener(){
|
||||||
|
super(CheckType.BLOCKINTERACT);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We listen to PlayerInteractEvent events for obvious reasons.
|
* We listen to PlayerInteractEvent events for obvious reasons.
|
||||||
*
|
*
|
||||||
|
@ -7,7 +7,6 @@ import org.bukkit.block.BlockFace;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||||
@ -15,6 +14,8 @@ import org.bukkit.event.player.PlayerAnimationEvent;
|
|||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import fr.neatmonster.nocheatplus.checks.CheckListener;
|
||||||
|
import fr.neatmonster.nocheatplus.checks.CheckType;
|
||||||
import fr.neatmonster.nocheatplus.checks.combined.Combined;
|
import fr.neatmonster.nocheatplus.checks.combined.Combined;
|
||||||
import fr.neatmonster.nocheatplus.checks.combined.Improbable;
|
import fr.neatmonster.nocheatplus.checks.combined.Improbable;
|
||||||
import fr.neatmonster.nocheatplus.permissions.Permissions;
|
import fr.neatmonster.nocheatplus.permissions.Permissions;
|
||||||
@ -42,7 +43,7 @@ import fr.neatmonster.nocheatplus.utilities.BlockProperties;
|
|||||||
*
|
*
|
||||||
* @see BlockPlaceEvent
|
* @see BlockPlaceEvent
|
||||||
*/
|
*/
|
||||||
public class BlockPlaceListener implements Listener {
|
public class BlockPlaceListener extends CheckListener {
|
||||||
|
|
||||||
/** The direction check. */
|
/** The direction check. */
|
||||||
private final Direction direction = new Direction();
|
private final Direction direction = new Direction();
|
||||||
@ -59,6 +60,10 @@ public class BlockPlaceListener implements Listener {
|
|||||||
/** The speed check. */
|
/** The speed check. */
|
||||||
private final Speed speed = new Speed();
|
private final Speed speed = new Speed();
|
||||||
|
|
||||||
|
public BlockPlaceListener(){
|
||||||
|
super(CheckType.BLOCKPLACE);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We listen to BlockPlace events for obvious reasons.
|
* We listen to BlockPlace events for obvious reasons.
|
||||||
*
|
*
|
||||||
|
@ -4,7 +4,6 @@ import org.bukkit.ChatColor;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||||
import org.bukkit.event.player.PlayerChangedWorldEvent;
|
import org.bukkit.event.player.PlayerChangedWorldEvent;
|
||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||||
@ -12,6 +11,7 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
|||||||
import org.bukkit.event.player.PlayerLoginEvent;
|
import org.bukkit.event.player.PlayerLoginEvent;
|
||||||
import org.bukkit.event.player.PlayerLoginEvent.Result;
|
import org.bukkit.event.player.PlayerLoginEvent.Result;
|
||||||
|
|
||||||
|
import fr.neatmonster.nocheatplus.checks.CheckListener;
|
||||||
import fr.neatmonster.nocheatplus.checks.CheckType;
|
import fr.neatmonster.nocheatplus.checks.CheckType;
|
||||||
import fr.neatmonster.nocheatplus.command.CommandUtil;
|
import fr.neatmonster.nocheatplus.command.CommandUtil;
|
||||||
import fr.neatmonster.nocheatplus.command.INotifyReload;
|
import fr.neatmonster.nocheatplus.command.INotifyReload;
|
||||||
@ -36,7 +36,7 @@ import fr.neatmonster.nocheatplus.utilities.ds.prefixtree.SimpleCharPrefixTree;
|
|||||||
*
|
*
|
||||||
* @see ChatEvent
|
* @see ChatEvent
|
||||||
*/
|
*/
|
||||||
public class ChatListener implements Listener, INotifyReload {
|
public class ChatListener extends CheckListener implements INotifyReload {
|
||||||
|
|
||||||
// Checks.
|
// Checks.
|
||||||
|
|
||||||
@ -66,8 +66,8 @@ public class ChatListener implements Listener, INotifyReload {
|
|||||||
/** Commands to be handled as chat. */
|
/** Commands to be handled as chat. */
|
||||||
private final SimpleCharPrefixTree chatCommands = new SimpleCharPrefixTree();
|
private final SimpleCharPrefixTree chatCommands = new SimpleCharPrefixTree();
|
||||||
|
|
||||||
|
|
||||||
public ChatListener(){
|
public ChatListener(){
|
||||||
|
super(CheckType.CHAT);
|
||||||
ConfigFile config = ConfigManager.getConfigFile();
|
ConfigFile config = ConfigManager.getConfigFile();
|
||||||
initFilters(config);
|
initFilters(config);
|
||||||
// (text inits in constructor.)
|
// (text inits in constructor.)
|
||||||
|
@ -7,13 +7,14 @@ import org.bukkit.entity.Entity;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||||
import org.bukkit.event.player.PlayerToggleSprintEvent;
|
import org.bukkit.event.player.PlayerToggleSprintEvent;
|
||||||
|
|
||||||
|
import fr.neatmonster.nocheatplus.checks.CheckListener;
|
||||||
|
import fr.neatmonster.nocheatplus.checks.CheckType;
|
||||||
import fr.neatmonster.nocheatplus.utilities.TickTask;
|
import fr.neatmonster.nocheatplus.utilities.TickTask;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -21,11 +22,12 @@ import fr.neatmonster.nocheatplus.utilities.TickTask;
|
|||||||
* @author mc_dev
|
* @author mc_dev
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class CombinedListener implements Listener {
|
public class CombinedListener extends CheckListener {
|
||||||
|
|
||||||
protected final Improbable improbable;
|
protected final Improbable improbable;
|
||||||
|
|
||||||
public CombinedListener(){
|
public CombinedListener(){
|
||||||
|
super(CheckType.COMBINED);
|
||||||
this.improbable = new Improbable();
|
this.improbable = new Improbable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ import org.bukkit.entity.Entity;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
@ -14,6 +13,8 @@ import org.bukkit.event.player.PlayerAnimationEvent;
|
|||||||
import org.bukkit.event.player.PlayerToggleSprintEvent;
|
import org.bukkit.event.player.PlayerToggleSprintEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import fr.neatmonster.nocheatplus.checks.CheckListener;
|
||||||
|
import fr.neatmonster.nocheatplus.checks.CheckType;
|
||||||
import fr.neatmonster.nocheatplus.checks.combined.Combined;
|
import fr.neatmonster.nocheatplus.checks.combined.Combined;
|
||||||
import fr.neatmonster.nocheatplus.checks.combined.Improbable;
|
import fr.neatmonster.nocheatplus.checks.combined.Improbable;
|
||||||
import fr.neatmonster.nocheatplus.checks.inventory.Items;
|
import fr.neatmonster.nocheatplus.checks.inventory.Items;
|
||||||
@ -35,7 +36,7 @@ import fr.neatmonster.nocheatplus.utilities.TickTask;
|
|||||||
*
|
*
|
||||||
* @see FightEvent
|
* @see FightEvent
|
||||||
*/
|
*/
|
||||||
public class FightListener implements Listener {
|
public class FightListener extends CheckListener {
|
||||||
|
|
||||||
/** The angle check. */
|
/** The angle check. */
|
||||||
private final Angle angle = new Angle();
|
private final Angle angle = new Angle();
|
||||||
@ -64,6 +65,10 @@ public class FightListener implements Listener {
|
|||||||
/** The speed check. */
|
/** The speed check. */
|
||||||
private final Speed speed = new Speed();
|
private final Speed speed = new Speed();
|
||||||
|
|
||||||
|
public FightListener(){
|
||||||
|
super(CheckType.FIGHT);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A player attacked something with DamageCause ENTITY_ATTACK. That's most likely what we want to really check.
|
* A player attacked something with DamageCause ENTITY_ATTACK. That's most likely what we want to really check.
|
||||||
*
|
*
|
||||||
|
@ -7,7 +7,6 @@ import org.bukkit.entity.Item;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||||
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||||
@ -19,6 +18,8 @@ import org.bukkit.event.player.PlayerItemHeldEvent;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.PlayerInventory;
|
import org.bukkit.inventory.PlayerInventory;
|
||||||
|
|
||||||
|
import fr.neatmonster.nocheatplus.checks.CheckListener;
|
||||||
|
import fr.neatmonster.nocheatplus.checks.CheckType;
|
||||||
import fr.neatmonster.nocheatplus.checks.combined.Combined;
|
import fr.neatmonster.nocheatplus.checks.combined.Combined;
|
||||||
import fr.neatmonster.nocheatplus.checks.combined.Improbable;
|
import fr.neatmonster.nocheatplus.checks.combined.Improbable;
|
||||||
|
|
||||||
@ -45,7 +46,7 @@ import fr.neatmonster.nocheatplus.checks.combined.Improbable;
|
|||||||
*
|
*
|
||||||
* @see InventoryEvent
|
* @see InventoryEvent
|
||||||
*/
|
*/
|
||||||
public class InventoryListener implements Listener {
|
public class InventoryListener extends CheckListener {
|
||||||
|
|
||||||
/** The drop check. */
|
/** The drop check. */
|
||||||
private final Drop drop = new Drop();
|
private final Drop drop = new Drop();
|
||||||
@ -61,6 +62,10 @@ public class InventoryListener implements Listener {
|
|||||||
|
|
||||||
protected final Items items = new Items();
|
protected final Items items = new Items();
|
||||||
|
|
||||||
|
public InventoryListener(){
|
||||||
|
super(CheckType.INVENTORY);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We listen to EntityShootBow events for the InstantBow check.
|
* We listen to EntityShootBow events for the InstantBow check.
|
||||||
*
|
*
|
||||||
|
@ -15,7 +15,6 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.entity.Vehicle;
|
import org.bukkit.entity.Vehicle;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
@ -36,6 +35,7 @@ import org.bukkit.event.vehicle.VehicleMoveEvent;
|
|||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import fr.neatmonster.nocheatplus.NoCheatPlus;
|
import fr.neatmonster.nocheatplus.NoCheatPlus;
|
||||||
|
import fr.neatmonster.nocheatplus.checks.CheckListener;
|
||||||
import fr.neatmonster.nocheatplus.checks.CheckType;
|
import fr.neatmonster.nocheatplus.checks.CheckType;
|
||||||
import fr.neatmonster.nocheatplus.checks.combined.Combined;
|
import fr.neatmonster.nocheatplus.checks.combined.Combined;
|
||||||
import fr.neatmonster.nocheatplus.checks.combined.CombinedData;
|
import fr.neatmonster.nocheatplus.checks.combined.CombinedData;
|
||||||
@ -70,7 +70,7 @@ import fr.neatmonster.nocheatplus.utilities.PlayerLocation;
|
|||||||
*
|
*
|
||||||
* @see MovingEvent
|
* @see MovingEvent
|
||||||
*/
|
*/
|
||||||
public class MovingListener implements Listener {
|
public class MovingListener extends CheckListener{
|
||||||
|
|
||||||
private static final class MoveInfo{
|
private static final class MoveInfo{
|
||||||
public final PlayerLocation from = new PlayerLocation();
|
public final PlayerLocation from = new PlayerLocation();
|
||||||
@ -117,6 +117,10 @@ public class MovingListener implements Listener {
|
|||||||
*/
|
*/
|
||||||
private final List<MoveInfo> parkedInfo = new ArrayList<MoveInfo>(10);
|
private final List<MoveInfo> parkedInfo = new ArrayList<MoveInfo>(10);
|
||||||
|
|
||||||
|
public MovingListener() {
|
||||||
|
super(CheckType.MOVING);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A workaround for players placing blocks below them getting pushed off the block by NoCheatPlus.
|
* A workaround for players placing blocks below them getting pushed off the block by NoCheatPlus.
|
||||||
*
|
*
|
||||||
|
17
src/fr/neatmonster/nocheatplus/components/NCPListener.java
Normal file
17
src/fr/neatmonster/nocheatplus/components/NCPListener.java
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
package fr.neatmonster.nocheatplus.components;
|
||||||
|
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers with default name "NoCheatPlus_Listener".
|
||||||
|
* @author mc_dev
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public abstract class NCPListener implements Listener, ComponentWithName {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getComponentName() {
|
||||||
|
return "NoCheatPlus_Listener";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -15,6 +15,7 @@ import org.bukkit.event.player.PlayerKickEvent;
|
|||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
|
||||||
import fr.neatmonster.nocheatplus.checks.CheckType;
|
import fr.neatmonster.nocheatplus.checks.CheckType;
|
||||||
|
import fr.neatmonster.nocheatplus.components.NCPListener;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* M"""""""`YM MM'""""'YMM MM"""""""`YM MM""""""""`M dP oo
|
* M"""""""`YM MM'""""'YMM MM"""""""`YM MM""""""""`M dP oo
|
||||||
@ -119,7 +120,7 @@ public class NCPExemptionManager {
|
|||||||
* @return the listener
|
* @return the listener
|
||||||
*/
|
*/
|
||||||
public static Listener getListener() {
|
public static Listener getListener() {
|
||||||
return new Listener() {
|
return new NCPListener() {
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onPlayerJoin(final PlayerJoinEvent event) {
|
public void onPlayerJoin(final PlayerJoinEvent event) {
|
||||||
|
@ -32,6 +32,7 @@ import fr.neatmonster.nocheatplus.checks.inventory.InventoryConfig;
|
|||||||
import fr.neatmonster.nocheatplus.checks.moving.MovingConfig;
|
import fr.neatmonster.nocheatplus.checks.moving.MovingConfig;
|
||||||
import fr.neatmonster.nocheatplus.command.INotifyReload;
|
import fr.neatmonster.nocheatplus.command.INotifyReload;
|
||||||
import fr.neatmonster.nocheatplus.components.ComponentRegistry;
|
import fr.neatmonster.nocheatplus.components.ComponentRegistry;
|
||||||
|
import fr.neatmonster.nocheatplus.components.ComponentWithName;
|
||||||
import fr.neatmonster.nocheatplus.components.IHaveCheckType;
|
import fr.neatmonster.nocheatplus.components.IHaveCheckType;
|
||||||
import fr.neatmonster.nocheatplus.components.INeedConfig;
|
import fr.neatmonster.nocheatplus.components.INeedConfig;
|
||||||
import fr.neatmonster.nocheatplus.components.IRemoveData;
|
import fr.neatmonster.nocheatplus.components.IRemoveData;
|
||||||
@ -48,7 +49,7 @@ import fr.neatmonster.nocheatplus.hooks.APIUtils;
|
|||||||
* @author mc_dev
|
* @author mc_dev
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class DataManager implements Listener, INotifyReload, INeedConfig, ComponentRegistry{
|
public class DataManager implements Listener, INotifyReload, INeedConfig, ComponentRegistry, ComponentWithName{
|
||||||
|
|
||||||
protected static DataManager instance = null;
|
protected static DataManager instance = null;
|
||||||
|
|
||||||
@ -328,4 +329,9 @@ public class DataManager implements Listener, INotifyReload, INeedConfig, Compon
|
|||||||
lastLogout.clear();
|
lastLogout.clear();
|
||||||
executionHistories.clear();
|
executionHistories.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getComponentName() {
|
||||||
|
return "NoCheatPlus_DataManager";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user