Skip to content
This repository has been archived by the owner on Oct 9, 2021. It is now read-only.
/ EventAPI Public archive

a event api for minecraft hacked client and other project

License

Notifications You must be signed in to change notification settings

UnlegitMC/EventAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EventAPI

a simple event api for minecraft development

<repository>
  <id>EZ4H-repo</id>
  <url>http://repo.liulihaocai.pw/</url>
</repository>

<dependency>
    <groupId>me.method17</groupId>
    <artifactId>EventAPI</artifactId>
    <version>1.0-SNAPSHOT</version>
</dependency>

Usage

Create Event

create a new class and implements Event

import me.method17.eventapi.events.Event;

public class TestEvent implements Event {

if u want a cancellable event plz extends CancellableEvent

import me.method17.eventapi.events.CancellableEvent;

public class TestEvent extends CancellableEvent {

Cancellable Event

use event.setCancelled() to set event to cancelled
or use event.setCancelled(boolean stage) to change cancel stage
and use event.isCancelled() to check is the event cancelled

@EventHandler
public void onEvent(TestCancellableEvent event){
    event.setCancelled((Math.random()>0.5)?true:false);
    if(event.isCancelled()){
        System.out.println("Event Cancelled!");
    }
}

Call Event

new an event object and use EventManager to call it

import me.method17.eventapi.EventManager;

EventManager.callEvent(new TestEvent());

Listen an Event

first create a class extends Listener

import me.method17.eventapi.listener.Listener;

public class TestListener extends Listener {

listener will register automatically
then create a method with annotation @EventHandler

import me.method17.eventapi.events.EventHandler;

@EventHandler
public void onEvent(TestEvent event){
    //code...
}

About

a event api for minecraft hacked client and other project

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages