diff --git a/src/event/BaseEvent.php b/src/event/BaseEvent.php new file mode 100644 index 000000000..9a73cfeb5 --- /dev/null +++ b/src/event/BaseEvent.php @@ -0,0 +1,56 @@ +eventName !== null ? get_class($this) : $this->eventName; + } + + final public function setPrioritySlot($slot){ + $this->prioritySlot = (int) $slot; + } + + final public function getPrioritySlot(){ + return (int) $this->prioritySlot; + } + + + public function isAllowed(){ + return $this->status === BaseEvent::ALLOW; + } + + public function setAllowed($forceAllow = false){ + $this->status = BaseEvent::ALLOW & ($forceAllow === true ? BaseEvent::FORCE : 0); + } + + public function isForced(){ + return ($this->status & BaseEvent::FORCE) > 0; + } + +} \ No newline at end of file diff --git a/src/event/CancellableEvent.php b/src/event/CancellableEvent.php new file mode 100644 index 000000000..5d3fab8f0 --- /dev/null +++ b/src/event/CancellableEvent.php @@ -0,0 +1,30 @@ +status === BaseEvent::DENY; + } + + public function setCancelled($forceCancel = false){ + $this->status = BaseEvent::DENY & ($forceCancel === true ? BaseEvent::FORCE : 0); + } +} \ No newline at end of file diff --git a/src/event/EventPriority.php b/src/event/EventPriority.php new file mode 100644 index 000000000..f42e8d732 --- /dev/null +++ b/src/event/EventPriority.php @@ -0,0 +1,52 @@ +