mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-27 11:38:03 +01:00
Remove unnecessary #callEvent override in Entity
This commit is contained in:
parent
08f7b1c715
commit
30d257c847
@ -641,16 +641,6 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer, P
|
||||
return eventCallbacks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <E extends Event> void callEvent(@NotNull Class<E> eventClass, @NotNull E event) {
|
||||
EventHandler.super.callEvent(eventClass, event);
|
||||
|
||||
// Call the same event for the current entity instance
|
||||
if (instance != null) {
|
||||
instance.callEvent(eventClass, event);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Each entity has an unique id (server-wide) which will change after a restart.
|
||||
*
|
||||
|
@ -1,8 +1,10 @@
|
||||
package net.minestom.server.event.handler;
|
||||
|
||||
import net.minestom.server.entity.Entity;
|
||||
import net.minestom.server.event.CancellableEvent;
|
||||
import net.minestom.server.event.Event;
|
||||
import net.minestom.server.event.EventCallback;
|
||||
import net.minestom.server.instance.Instance;
|
||||
import net.minestom.server.utils.validate.Check;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -92,6 +94,14 @@ public interface EventHandler {
|
||||
for (EventCallback<E> eventCallback : eventCallbacks) {
|
||||
eventCallback.run(event);
|
||||
}
|
||||
|
||||
// Call the same event for the current entity instance
|
||||
if (this instanceof Entity) {
|
||||
final Instance instance = ((Entity) this).getInstance();
|
||||
if (instance != null) {
|
||||
instance.callEvent(eventClass, event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user