Skip to content

Commit

Permalink
extend EntityEvent instead
Browse files Browse the repository at this point in the history
  • Loading branch information
xGinko committed Dec 12, 2024
1 parent 363e6d0 commit 8cbf93e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,12 @@ public boolean hasExploded() {
return hasExploded;
}

@NotNull
@Override
public HandlerList getHandlers() {
public @NotNull HandlerList getHandlers() {
return handlers;
}

@NotNull
public static HandlerList getHandlerList() {
public static @NotNull HandlerList getHandlerList() {
return handlers;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,12 @@ public boolean isCancelled() {
return isCancelled;
}

@NotNull
@Override
public HandlerList getHandlers() {
public @NotNull HandlerList getHandlers() {
return handlers;
}

@NotNull
public static HandlerList getHandlerList() {
public static @NotNull HandlerList getHandlerList() {
return handlers;
}
}
25 changes: 8 additions & 17 deletions src/main/java/me/xginko/snowballfight/events/SnowballEvent.java
Original file line number Diff line number Diff line change
@@ -1,37 +1,28 @@
package me.xginko.snowballfight.events;

import org.bukkit.entity.Snowball;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.bukkit.event.entity.EntityEvent;
import org.jetbrains.annotations.NotNull;

public abstract class SnowballEvent extends Event {
public abstract class SnowballEvent extends EntityEvent {

private static final @NotNull HandlerList handlers = new HandlerList();

private final Snowball snowball;

public SnowballEvent(boolean isAsync, Snowball snowball) {
super(isAsync);
this.snowball = snowball;
}

public SnowballEvent(Snowball snowball) {
this.snowball = snowball;
public SnowballEvent(@NotNull Snowball snowball) {
super(snowball);
}

public Snowball getSnowball() {
return snowball;
public @NotNull Snowball getSnowball() {
return (Snowball) entity;
}

@NotNull
@Override
public HandlerList getHandlers() {
public @NotNull HandlerList getHandlers() {
return handlers;
}

@NotNull
public static HandlerList getHandlerList() {
public static @NotNull HandlerList getHandlerList() {
return handlers;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,12 @@ public boolean getBreakBlocks() {
return breakBlocks;
}

@NotNull
@Override
public HandlerList getHandlers() {
public @NotNull HandlerList getHandlers() {
return handlers;
}

@NotNull
public static HandlerList getHandlerList() {
public static @NotNull HandlerList getHandlerList() {
return handlers;
}
}

0 comments on commit 8cbf93e

Please sign in to comment.