VirtualComputer/VirtualComputerMSCOM/src/main/java/sznp/virtualcomputer/EventHandler.java
NorbiPeti 580d48d7d0 Fixes for Windows and MSCOM implementation
Still can't pass Java objects to COM
2020-08-11 19:00:00 +02:00

32 lines
742 B
Java

package sznp.virtualcomputer;
import org.virtualbox_6_1.IEvent;
import sznp.virtualcomputer.util.COMObjectBase;
import sznp.virtualcomputer.util.IEventHandler;
/**
* A Bukkit-like event system which calls the appropriate methods on an event.
*/
public final class EventHandler extends COMObjectBase {
private final IEventHandler handler;
private boolean enabled = true;
/**
* New MSCOM event handler.
*
* @param handler The handle method that handles what needs to be handled
*/
public EventHandler(IEventHandler handler) {
this.handler = handler;
}
public final void handleEvent(IEvent iEvent) {
if (!enabled)
return;
handler.handleEvent(iEvent);
}
public void disable() {
enabled = false;
}
}