Created by Hexeption on 18/12/2016.
| 24 | * Created by Hexeption on 18/12/2016. |
| 25 | */ |
| 26 | public abstract class Event { |
| 27 | |
| 28 | private boolean cancelled; |
| 29 | |
| 30 | public enum State { |
| 31 | PRE("PRE", 0), |
| 32 | |
| 33 | POST("POST", 1); |
| 34 | |
| 35 | private State(final String string, final int number) { |
| 36 | |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | |
| 41 | |
| 42 | public Event call() { |
| 43 | |
| 44 | this.cancelled = false; |
| 45 | call(this); |
| 46 | return this; |
| 47 | } |
| 48 | |
| 49 | public boolean isCancelled() { |
| 50 | |
| 51 | return cancelled; |
| 52 | } |
| 53 | |
| 54 | public void setCancelled(boolean cancelled) { |
| 55 | |
| 56 | this.cancelled = cancelled; |
| 57 | } |
| 58 | |
| 59 | private static final void call(final Event event) { |
| 60 | |
| 61 | final ArrayHelper<Data> dataList = EventManager.INSTANCE.get(event.getClass()); |
| 62 | |
| 63 | if (dataList != null) { |
| 64 | for (final Data data : dataList) { |
| 65 | |
| 66 | try { |
| 67 | data.target.invoke(data.source, event); |
| 68 | } catch (IllegalAccessException e) { |
| 69 | e.printStackTrace(); |
| 70 | } catch (InvocationTargetException e) { |
| 71 | e.printStackTrace(); |
| 72 | } |
| 73 | |
| 74 | } |
| 75 | } |
| 76 | } |
| 77 | } |
nothing calls this directly
no outgoing calls
no test coverage detected