diff --git a/api/src/main/java/net/thenextlvl/protect/event/AreaDeleteEvent.java b/api/src/main/java/net/thenextlvl/protect/event/AreaDeleteEvent.java index 433e38c..9959634 100644 --- a/api/src/main/java/net/thenextlvl/protect/event/AreaDeleteEvent.java +++ b/api/src/main/java/net/thenextlvl/protect/event/AreaDeleteEvent.java @@ -1,8 +1,9 @@ package net.thenextlvl.protect.event; +import com.sk89q.worldedit.regions.Region; import lombok.Getter; import lombok.Setter; -import net.thenextlvl.protect.area.Area; +import net.thenextlvl.protect.area.RegionizedArea; import org.bukkit.event.Cancellable; /** @@ -13,10 +14,10 @@ */ @Getter @Setter -public class AreaDeleteEvent extends AreaEvent implements Cancellable { +public class AreaDeleteEvent extends AreaEvent> implements Cancellable { private boolean cancelled; - public AreaDeleteEvent(Area area) { + public AreaDeleteEvent(RegionizedArea area) { super(area); } } diff --git a/api/src/main/java/net/thenextlvl/protect/event/AreaEvent.java b/api/src/main/java/net/thenextlvl/protect/event/AreaEvent.java index def8a24..23e6a95 100644 --- a/api/src/main/java/net/thenextlvl/protect/event/AreaEvent.java +++ b/api/src/main/java/net/thenextlvl/protect/event/AreaEvent.java @@ -14,9 +14,9 @@ */ @Getter @RequiredArgsConstructor(access = AccessLevel.PROTECTED) -public abstract class AreaEvent extends Event { +public abstract class AreaEvent extends Event { private static final @Getter HandlerList handlerList = new HandlerList(); - private final Area area; + private final T area; @Override public HandlerList getHandlers() { diff --git a/api/src/main/java/net/thenextlvl/protect/event/AreaRedefineEvent.java b/api/src/main/java/net/thenextlvl/protect/event/AreaRedefineEvent.java index c74f04e..418ecd1 100644 --- a/api/src/main/java/net/thenextlvl/protect/event/AreaRedefineEvent.java +++ b/api/src/main/java/net/thenextlvl/protect/event/AreaRedefineEvent.java @@ -14,9 +14,9 @@ */ @Getter @Setter -public class AreaRedefineEvent extends AreaEvent implements Cancellable { - private final T region; +public class AreaRedefineEvent extends AreaEvent> implements Cancellable { private boolean cancelled; + private final T region; public AreaRedefineEvent(RegionizedArea area, T region) { super(area); diff --git a/api/src/main/java/net/thenextlvl/protect/event/AreaSchematicDeleteEvent.java b/api/src/main/java/net/thenextlvl/protect/event/AreaSchematicDeleteEvent.java index ecae706..d36b94d 100644 --- a/api/src/main/java/net/thenextlvl/protect/event/AreaSchematicDeleteEvent.java +++ b/api/src/main/java/net/thenextlvl/protect/event/AreaSchematicDeleteEvent.java @@ -1,8 +1,9 @@ package net.thenextlvl.protect.event; +import com.sk89q.worldedit.regions.Region; import lombok.Getter; import lombok.Setter; -import net.thenextlvl.protect.area.Area; +import net.thenextlvl.protect.area.RegionizedArea; import org.bukkit.event.Cancellable; /** @@ -13,10 +14,10 @@ */ @Getter @Setter -public class AreaSchematicDeleteEvent extends AreaEvent implements Cancellable { +public class AreaSchematicDeleteEvent extends AreaEvent> implements Cancellable { private boolean cancelled; - public AreaSchematicDeleteEvent(Area area) { + public AreaSchematicDeleteEvent(RegionizedArea area) { super(area); } } diff --git a/api/src/main/java/net/thenextlvl/protect/event/AreaSchematicLoadEvent.java b/api/src/main/java/net/thenextlvl/protect/event/AreaSchematicLoadEvent.java index 1c7002b..35e628c 100644 --- a/api/src/main/java/net/thenextlvl/protect/event/AreaSchematicLoadEvent.java +++ b/api/src/main/java/net/thenextlvl/protect/event/AreaSchematicLoadEvent.java @@ -1,7 +1,8 @@ package net.thenextlvl.protect.event; +import com.sk89q.worldedit.regions.Region; import lombok.Getter; -import net.thenextlvl.protect.area.Area; +import net.thenextlvl.protect.area.RegionizedArea; import java.util.ArrayList; import java.util.List; @@ -14,10 +15,10 @@ * @param The type of region associated with the area. */ @Getter -public class AreaSchematicLoadEvent extends AreaEvent { - private final List> successListeners = new ArrayList<>(); +public class AreaSchematicLoadEvent extends AreaEvent> { + private final List>> successListeners = new ArrayList<>(); - public AreaSchematicLoadEvent(Area area) { + public AreaSchematicLoadEvent(RegionizedArea area) { super(area); } } diff --git a/api/src/main/java/net/thenextlvl/protect/event/PlayerAreaEnterEvent.java b/api/src/main/java/net/thenextlvl/protect/event/PlayerAreaEnterEvent.java index f5b6142..9f401be 100644 --- a/api/src/main/java/net/thenextlvl/protect/event/PlayerAreaEnterEvent.java +++ b/api/src/main/java/net/thenextlvl/protect/event/PlayerAreaEnterEvent.java @@ -11,7 +11,7 @@ */ @Getter @Setter -public class PlayerAreaEnterEvent extends PlayerAreaEvent implements Cancellable { +public class PlayerAreaEnterEvent extends PlayerAreaEvent implements Cancellable { private boolean cancelled; public PlayerAreaEnterEvent(Player player, Area area) { diff --git a/api/src/main/java/net/thenextlvl/protect/event/PlayerAreaEvent.java b/api/src/main/java/net/thenextlvl/protect/event/PlayerAreaEvent.java index 0fed047..56ea38a 100644 --- a/api/src/main/java/net/thenextlvl/protect/event/PlayerAreaEvent.java +++ b/api/src/main/java/net/thenextlvl/protect/event/PlayerAreaEvent.java @@ -12,11 +12,11 @@ * @param The type of the area associated with the event. */ @Getter -public abstract class PlayerAreaEvent extends PlayerEvent { +public abstract class PlayerAreaEvent extends PlayerEvent { private static final @Getter HandlerList handlerList = new HandlerList(); - private final Area area; + private final T area; - public PlayerAreaEvent(Player player, Area area) { + public PlayerAreaEvent(Player player, T area) { super(player); this.area = area; } diff --git a/api/src/main/java/net/thenextlvl/protect/event/PlayerAreaLeaveEvent.java b/api/src/main/java/net/thenextlvl/protect/event/PlayerAreaLeaveEvent.java index 04bc08c..90cbe6d 100644 --- a/api/src/main/java/net/thenextlvl/protect/event/PlayerAreaLeaveEvent.java +++ b/api/src/main/java/net/thenextlvl/protect/event/PlayerAreaLeaveEvent.java @@ -11,7 +11,7 @@ */ @Getter @Setter -public class PlayerAreaLeaveEvent extends PlayerAreaEvent implements Cancellable { +public class PlayerAreaLeaveEvent extends PlayerAreaEvent implements Cancellable { private boolean cancelled; public PlayerAreaLeaveEvent(Player player, Area area) { diff --git a/api/src/main/java/net/thenextlvl/protect/event/PlayerAreaTransitionEvent.java b/api/src/main/java/net/thenextlvl/protect/event/PlayerAreaTransitionEvent.java index e46a411..54bbe1f 100644 --- a/api/src/main/java/net/thenextlvl/protect/event/PlayerAreaTransitionEvent.java +++ b/api/src/main/java/net/thenextlvl/protect/event/PlayerAreaTransitionEvent.java @@ -12,7 +12,7 @@ */ @Getter @Setter -public class PlayerAreaTransitionEvent extends PlayerAreaEvent implements Cancellable { +public class PlayerAreaTransitionEvent extends PlayerAreaEvent implements Cancellable { private final Area previous; private boolean cancelled; diff --git a/plugin/src/main/java/net/thenextlvl/protect/area/CraftAreaService.java b/plugin/src/main/java/net/thenextlvl/protect/area/CraftAreaService.java index 65e2e49..99b3eac 100644 --- a/plugin/src/main/java/net/thenextlvl/protect/area/CraftAreaService.java +++ b/plugin/src/main/java/net/thenextlvl/protect/area/CraftAreaService.java @@ -28,13 +28,13 @@ public CuboidArea create(@NamePattern String name, World world, BlockVector3 pos public CuboidArea create(@NamePattern String name, World world, CuboidRegion region) { var area = new CraftCuboidArea(plugin, name, world, region.clone(), 0); plugin.loadAreas(area.getWorld()).getRoot().add(area); - new AreaCreateEvent(area).callEvent(); + new AreaCreateEvent<>(area).callEvent(); return area; } @Override public boolean delete(RegionizedArea area) { - if (!new AreaDeleteEvent(area).callEvent()) return false; + if (!new AreaDeleteEvent<>(area).callEvent()) return false; var remove = plugin.loadAreas(area.getWorld()).getRoot().remove(area); if (remove) handlePostRemove(area); return remove; diff --git a/plugin/src/main/java/net/thenextlvl/protect/area/CraftRegionizedArea.java b/plugin/src/main/java/net/thenextlvl/protect/area/CraftRegionizedArea.java index c74fea1..5e13dbb 100644 --- a/plugin/src/main/java/net/thenextlvl/protect/area/CraftRegionizedArea.java +++ b/plugin/src/main/java/net/thenextlvl/protect/area/CraftRegionizedArea.java @@ -90,7 +90,7 @@ public boolean isTooBig() { @Override public boolean deleteSchematic() { - return getSchematic().exists() && (new AreaSchematicDeleteEvent(this).callEvent() && getSchematic().delete()); + return getSchematic().exists() && (new AreaSchematicDeleteEvent<>(this).callEvent() && getSchematic().delete()); } @Override @@ -113,7 +113,7 @@ public void saveSchematic() throws IOException, WorldEditException { @Override public boolean loadSchematic() throws IOException, WorldEditException { if (!getSchematic().isFile()) return false; - var event = new AreaSchematicLoadEvent(CraftRegionizedArea.this); + var event = new AreaSchematicLoadEvent<>(CraftRegionizedArea.this); if (!event.callEvent()) return false; var world = new BukkitWorld(getWorld()); try (EditSession editSession = WorldEdit.getInstance().newEditSession(world)) {