From c6eb573b574ff8959b7a9fe716188ac0d1fd29d0 Mon Sep 17 00:00:00 2001 From: asofold Date: Fri, 2 Nov 2012 10:26:42 +0100 Subject: [PATCH] Add components package with interfaces [likely to be moved around soon]. --- .../components/IComponentRegistry.java | 18 +++++++++++++++++ .../nocheatplus/components/IData.java | 10 ++++++++++ .../components/IHaveCheckType.java | 12 +++++++++++ .../nocheatplus/components/INeedConfig.java | 11 ++++++++++ .../nocheatplus/components/IRemoveData.java | 20 +++++++++++++++++++ .../components/NoCheatPlusAPI.java | 10 ++++++++++ 6 files changed, 81 insertions(+) create mode 100644 src/fr/neatmonster/nocheatplus/components/IComponentRegistry.java create mode 100644 src/fr/neatmonster/nocheatplus/components/IData.java create mode 100644 src/fr/neatmonster/nocheatplus/components/IHaveCheckType.java create mode 100644 src/fr/neatmonster/nocheatplus/components/INeedConfig.java create mode 100644 src/fr/neatmonster/nocheatplus/components/IRemoveData.java create mode 100644 src/fr/neatmonster/nocheatplus/components/NoCheatPlusAPI.java diff --git a/src/fr/neatmonster/nocheatplus/components/IComponentRegistry.java b/src/fr/neatmonster/nocheatplus/components/IComponentRegistry.java new file mode 100644 index 00000000..7f4a837b --- /dev/null +++ b/src/fr/neatmonster/nocheatplus/components/IComponentRegistry.java @@ -0,0 +1,18 @@ +package fr.neatmonster.nocheatplus.components; + +public interface IComponentRegistry { + /** + * Convenience method to add components according to implemented interfaces, + * like Listener, INotifyReload, INeedConfig.
+ * For the NoCheatPlus instance this must be done after the configuration has been initialized. + * @param obj + */ + public void addComponent(final Object onj); + + /** + * Remove a registered component.
+ * Does not unregister listeners currently. + * @param obj + */ + public void removeComponent(final Object obj); +} diff --git a/src/fr/neatmonster/nocheatplus/components/IData.java b/src/fr/neatmonster/nocheatplus/components/IData.java new file mode 100644 index 00000000..8c8ce1db --- /dev/null +++ b/src/fr/neatmonster/nocheatplus/components/IData.java @@ -0,0 +1,10 @@ +package fr.neatmonster.nocheatplus.components; + +/** + * Some (player-related) data is held here. + * @author mc_dev + * + */ +public interface IData { + +} diff --git a/src/fr/neatmonster/nocheatplus/components/IHaveCheckType.java b/src/fr/neatmonster/nocheatplus/components/IHaveCheckType.java new file mode 100644 index 00000000..5fac3bb2 --- /dev/null +++ b/src/fr/neatmonster/nocheatplus/components/IHaveCheckType.java @@ -0,0 +1,12 @@ +package fr.neatmonster.nocheatplus.components; + +import fr.neatmonster.nocheatplus.checks.CheckType; + +/** + * Interface to indicate a component is associated with a CheckType. + * @author mc_dev + * + */ +public interface IHaveCheckType { + public CheckType getCheckType(); +} diff --git a/src/fr/neatmonster/nocheatplus/components/INeedConfig.java b/src/fr/neatmonster/nocheatplus/components/INeedConfig.java new file mode 100644 index 00000000..215aa924 --- /dev/null +++ b/src/fr/neatmonster/nocheatplus/components/INeedConfig.java @@ -0,0 +1,11 @@ +package fr.neatmonster.nocheatplus.components; + +import fr.neatmonster.nocheatplus.command.INotifyReload; + +/** + * Indicate that a component needs config after time of creation but in onEnable. + * @author mc_dev + * + */ +public interface INeedConfig extends INotifyReload{ +} diff --git a/src/fr/neatmonster/nocheatplus/components/IRemoveData.java b/src/fr/neatmonster/nocheatplus/components/IRemoveData.java new file mode 100644 index 00000000..839b5e79 --- /dev/null +++ b/src/fr/neatmonster/nocheatplus/components/IRemoveData.java @@ -0,0 +1,20 @@ +package fr.neatmonster.nocheatplus.components; + +/** + * Interface for component registration to allow cleanup for player data. + * @author mc_dev + * + */ +public interface IRemoveData { + /** + * Remove the data of one player. + * @param playerName + * @return IData instance, if it was present. + */ + public IData removeData(String playerName); + + /** + * Remove the data of all players. + */ + public void removeAllData(); +} diff --git a/src/fr/neatmonster/nocheatplus/components/NoCheatPlusAPI.java b/src/fr/neatmonster/nocheatplus/components/NoCheatPlusAPI.java new file mode 100644 index 00000000..7c2edbf3 --- /dev/null +++ b/src/fr/neatmonster/nocheatplus/components/NoCheatPlusAPI.java @@ -0,0 +1,10 @@ +package fr.neatmonster.nocheatplus.components; + + + + +public interface NoCheatPlusAPI extends IComponentRegistry{ + + + +}