Make CancellableEvent a trait

This commit is contained in:
TheMode 2021-06-09 07:11:01 +02:00
parent dd44b752c3
commit 16d8597195
31 changed files with 34 additions and 42 deletions

View File

@ -1,6 +1,7 @@
package net.minestom.server.event; package net.minestom.server.event;
import net.minestom.server.MinecraftServer; import net.minestom.server.MinecraftServer;
import net.minestom.server.event.trait.CancellableEvent;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
public class EventDispatcher { public class EventDispatcher {

View File

@ -1,5 +1,6 @@
package net.minestom.server.event; package net.minestom.server.event;
import net.minestom.server.event.trait.CancellableEvent;
import net.minestom.server.tag.Tag; import net.minestom.server.tag.Tag;
import net.minestom.server.tag.TagReadable; import net.minestom.server.tag.TagReadable;
import net.minestom.server.utils.validate.Check; import net.minestom.server.utils.validate.Check;

View File

@ -3,7 +3,7 @@ package net.minestom.server.event.entity;
import net.minestom.server.entity.Entity; import net.minestom.server.entity.Entity;
import net.minestom.server.entity.LivingEntity; import net.minestom.server.entity.LivingEntity;
import net.minestom.server.entity.damage.DamageType; import net.minestom.server.entity.damage.DamageType;
import net.minestom.server.event.CancellableEvent; import net.minestom.server.event.trait.CancellableEvent;
import net.minestom.server.event.trait.EntityEvent; import net.minestom.server.event.trait.EntityEvent;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -1,7 +1,7 @@
package net.minestom.server.event.entity; package net.minestom.server.event.entity;
import net.minestom.server.entity.Entity; import net.minestom.server.entity.Entity;
import net.minestom.server.event.CancellableEvent; import net.minestom.server.event.trait.CancellableEvent;
import net.minestom.server.event.trait.EntityEvent; import net.minestom.server.event.trait.EntityEvent;
import net.minestom.server.utils.time.TimeUnit; import net.minestom.server.utils.time.TimeUnit;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -2,7 +2,7 @@ package net.minestom.server.event.entity;
import net.minestom.server.entity.Entity; import net.minestom.server.entity.Entity;
import net.minestom.server.entity.ItemEntity; import net.minestom.server.entity.ItemEntity;
import net.minestom.server.event.CancellableEvent; import net.minestom.server.event.trait.CancellableEvent;
import net.minestom.server.event.trait.EntityEvent; import net.minestom.server.event.trait.EntityEvent;
import net.minestom.server.item.ItemStack; import net.minestom.server.item.ItemStack;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -1,7 +1,7 @@
package net.minestom.server.event.entity; package net.minestom.server.event.entity;
import net.minestom.server.entity.Entity; import net.minestom.server.entity.Entity;
import net.minestom.server.event.CancellableEvent; import net.minestom.server.event.trait.CancellableEvent;
import net.minestom.server.event.trait.EntityEvent; import net.minestom.server.event.trait.EntityEvent;
import net.minestom.server.utils.Position; import net.minestom.server.utils.Position;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -1,7 +1,7 @@
package net.minestom.server.event.entity; package net.minestom.server.event.entity;
import net.minestom.server.entity.Entity; import net.minestom.server.entity.Entity;
import net.minestom.server.event.CancellableEvent; import net.minestom.server.event.trait.CancellableEvent;
import net.minestom.server.event.trait.EntityEvent; import net.minestom.server.event.trait.EntityEvent;
import net.minestom.server.utils.Vector; import net.minestom.server.utils.Vector;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -1,7 +1,7 @@
package net.minestom.server.event.instance; package net.minestom.server.event.instance;
import net.minestom.server.entity.Entity; import net.minestom.server.entity.Entity;
import net.minestom.server.event.CancellableEvent; import net.minestom.server.event.trait.CancellableEvent;
import net.minestom.server.event.trait.EntityEvent; import net.minestom.server.event.trait.EntityEvent;
import net.minestom.server.event.trait.InstanceEvent; import net.minestom.server.event.trait.InstanceEvent;
import net.minestom.server.instance.Instance; import net.minestom.server.instance.Instance;

View File

@ -1,7 +1,7 @@
package net.minestom.server.event.instance; package net.minestom.server.event.instance;
import net.minestom.server.entity.Entity; import net.minestom.server.entity.Entity;
import net.minestom.server.event.CancellableEvent; import net.minestom.server.event.trait.CancellableEvent;
import net.minestom.server.event.trait.EntityEvent; import net.minestom.server.event.trait.EntityEvent;
import net.minestom.server.event.trait.InstanceEvent; import net.minestom.server.event.trait.InstanceEvent;
import net.minestom.server.instance.Instance; import net.minestom.server.instance.Instance;

View File

@ -1,7 +1,7 @@
package net.minestom.server.event.inventory; package net.minestom.server.event.inventory;
import net.minestom.server.entity.Player; import net.minestom.server.entity.Player;
import net.minestom.server.event.CancellableEvent; import net.minestom.server.event.trait.CancellableEvent;
import net.minestom.server.event.trait.InventoryEvent; import net.minestom.server.event.trait.InventoryEvent;
import net.minestom.server.event.trait.PlayerEvent; import net.minestom.server.event.trait.PlayerEvent;
import net.minestom.server.inventory.Inventory; import net.minestom.server.inventory.Inventory;

View File

@ -1,7 +1,7 @@
package net.minestom.server.event.inventory; package net.minestom.server.event.inventory;
import net.minestom.server.entity.Player; import net.minestom.server.entity.Player;
import net.minestom.server.event.CancellableEvent; import net.minestom.server.event.trait.CancellableEvent;
import net.minestom.server.event.trait.InventoryEvent; import net.minestom.server.event.trait.InventoryEvent;
import net.minestom.server.event.trait.PlayerEvent; import net.minestom.server.event.trait.PlayerEvent;
import net.minestom.server.inventory.Inventory; import net.minestom.server.inventory.Inventory;

View File

@ -1,7 +1,7 @@
package net.minestom.server.event.item; package net.minestom.server.event.item;
import net.minestom.server.entity.Player; import net.minestom.server.entity.Player;
import net.minestom.server.event.CancellableEvent; import net.minestom.server.event.trait.CancellableEvent;
import net.minestom.server.event.trait.ItemEvent; import net.minestom.server.event.trait.ItemEvent;
import net.minestom.server.item.ItemStack; import net.minestom.server.item.ItemStack;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -1,8 +1,7 @@
package net.minestom.server.event.item; package net.minestom.server.event.item;
import net.minestom.server.entity.ExperienceOrb; import net.minestom.server.entity.ExperienceOrb;
import net.minestom.server.event.CancellableEvent; import net.minestom.server.event.trait.CancellableEvent;
import net.minestom.server.event.Event;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
public class PickupExperienceEvent implements CancellableEvent { public class PickupExperienceEvent implements CancellableEvent {

View File

@ -3,7 +3,7 @@ package net.minestom.server.event.item;
import net.minestom.server.entity.Entity; import net.minestom.server.entity.Entity;
import net.minestom.server.entity.ItemEntity; import net.minestom.server.entity.ItemEntity;
import net.minestom.server.entity.LivingEntity; import net.minestom.server.entity.LivingEntity;
import net.minestom.server.event.CancellableEvent; import net.minestom.server.event.trait.CancellableEvent;
import net.minestom.server.event.trait.EntityEvent; import net.minestom.server.event.trait.EntityEvent;
import net.minestom.server.event.trait.ItemEvent; import net.minestom.server.event.trait.ItemEvent;
import net.minestom.server.item.ItemStack; import net.minestom.server.item.ItemStack;

View File

@ -2,8 +2,7 @@ package net.minestom.server.event.player;
import net.minestom.server.MinecraftServer; import net.minestom.server.MinecraftServer;
import net.minestom.server.entity.Player; import net.minestom.server.entity.Player;
import net.minestom.server.event.CancellableEvent; import net.minestom.server.event.trait.CancellableEvent;
import net.minestom.server.event.Event;
import net.minestom.server.event.trait.PlayerEvent; import net.minestom.server.event.trait.PlayerEvent;
import net.minestom.server.instance.block.BlockManager; import net.minestom.server.instance.block.BlockManager;
import net.minestom.server.instance.block.CustomBlock; import net.minestom.server.instance.block.CustomBlock;

View File

@ -1,8 +1,7 @@
package net.minestom.server.event.player; package net.minestom.server.event.player;
import net.minestom.server.entity.Player; import net.minestom.server.entity.Player;
import net.minestom.server.event.CancellableEvent; import net.minestom.server.event.trait.CancellableEvent;
import net.minestom.server.event.Event;
import net.minestom.server.event.trait.PlayerEvent; import net.minestom.server.event.trait.PlayerEvent;
import net.minestom.server.instance.block.BlockFace; import net.minestom.server.instance.block.BlockFace;
import net.minestom.server.utils.BlockPosition; import net.minestom.server.utils.BlockPosition;

View File

@ -3,8 +3,7 @@ package net.minestom.server.event.player;
import net.minestom.server.MinecraftServer; import net.minestom.server.MinecraftServer;
import net.minestom.server.data.Data; import net.minestom.server.data.Data;
import net.minestom.server.entity.Player; import net.minestom.server.entity.Player;
import net.minestom.server.event.CancellableEvent; import net.minestom.server.event.trait.CancellableEvent;
import net.minestom.server.event.Event;
import net.minestom.server.event.trait.PlayerEvent; import net.minestom.server.event.trait.PlayerEvent;
import net.minestom.server.instance.block.Block; import net.minestom.server.instance.block.Block;
import net.minestom.server.instance.block.BlockManager; import net.minestom.server.instance.block.BlockManager;

View File

@ -1,8 +1,7 @@
package net.minestom.server.event.player; package net.minestom.server.event.player;
import net.minestom.server.entity.Player; import net.minestom.server.entity.Player;
import net.minestom.server.event.CancellableEvent; import net.minestom.server.event.trait.CancellableEvent;
import net.minestom.server.event.Event;
import net.minestom.server.event.trait.PlayerEvent; import net.minestom.server.event.trait.PlayerEvent;
import net.minestom.server.utils.MathUtils; import net.minestom.server.utils.MathUtils;
import net.minestom.server.utils.validate.Check; import net.minestom.server.utils.validate.Check;

View File

@ -3,8 +3,7 @@ package net.minestom.server.event.player;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.minestom.server.chat.JsonMessage; import net.minestom.server.chat.JsonMessage;
import net.minestom.server.entity.Player; import net.minestom.server.entity.Player;
import net.minestom.server.event.CancellableEvent; import net.minestom.server.event.trait.CancellableEvent;
import net.minestom.server.event.Event;
import net.minestom.server.event.trait.PlayerEvent; import net.minestom.server.event.trait.PlayerEvent;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;

View File

@ -1,8 +1,7 @@
package net.minestom.server.event.player; package net.minestom.server.event.player;
import net.minestom.server.entity.Player; import net.minestom.server.entity.Player;
import net.minestom.server.event.CancellableEvent; import net.minestom.server.event.trait.CancellableEvent;
import net.minestom.server.event.Event;
import net.minestom.server.event.trait.PlayerEvent; import net.minestom.server.event.trait.PlayerEvent;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -1,8 +1,7 @@
package net.minestom.server.event.player; package net.minestom.server.event.player;
import net.minestom.server.entity.Player; import net.minestom.server.entity.Player;
import net.minestom.server.event.CancellableEvent; import net.minestom.server.event.trait.CancellableEvent;
import net.minestom.server.event.Event;
import net.minestom.server.event.trait.PlayerEvent; import net.minestom.server.event.trait.PlayerEvent;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -1,8 +1,7 @@
package net.minestom.server.event.player; package net.minestom.server.event.player;
import net.minestom.server.entity.Player; import net.minestom.server.entity.Player;
import net.minestom.server.event.CancellableEvent; import net.minestom.server.event.trait.CancellableEvent;
import net.minestom.server.event.Event;
import net.minestom.server.event.trait.PlayerEvent; import net.minestom.server.event.trait.PlayerEvent;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -1,8 +1,7 @@
package net.minestom.server.event.player; package net.minestom.server.event.player;
import net.minestom.server.entity.Player; import net.minestom.server.entity.Player;
import net.minestom.server.event.CancellableEvent; import net.minestom.server.event.trait.CancellableEvent;
import net.minestom.server.event.Event;
import net.minestom.server.event.trait.PlayerEvent; import net.minestom.server.event.trait.PlayerEvent;
import net.minestom.server.utils.Position; import net.minestom.server.utils.Position;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -1,7 +1,7 @@
package net.minestom.server.event.player; package net.minestom.server.event.player;
import net.minestom.server.entity.Player; import net.minestom.server.entity.Player;
import net.minestom.server.event.CancellableEvent; import net.minestom.server.event.trait.CancellableEvent;
import net.minestom.server.event.trait.PlayerEvent; import net.minestom.server.event.trait.PlayerEvent;
import net.minestom.server.network.packet.client.ClientPacket; import net.minestom.server.network.packet.client.ClientPacket;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -1,8 +1,7 @@
package net.minestom.server.event.player; package net.minestom.server.event.player;
import net.minestom.server.entity.Player; import net.minestom.server.entity.Player;
import net.minestom.server.event.CancellableEvent; import net.minestom.server.event.trait.CancellableEvent;
import net.minestom.server.event.Event;
import net.minestom.server.event.trait.PlayerEvent; import net.minestom.server.event.trait.PlayerEvent;
import net.minestom.server.item.ItemStack; import net.minestom.server.item.ItemStack;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -1,8 +1,7 @@
package net.minestom.server.event.player; package net.minestom.server.event.player;
import net.minestom.server.entity.Player; import net.minestom.server.entity.Player;
import net.minestom.server.event.CancellableEvent; import net.minestom.server.event.trait.CancellableEvent;
import net.minestom.server.event.Event;
import net.minestom.server.event.trait.PlayerEvent; import net.minestom.server.event.trait.PlayerEvent;
import net.minestom.server.utils.BlockPosition; import net.minestom.server.utils.BlockPosition;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -1,8 +1,7 @@
package net.minestom.server.event.player; package net.minestom.server.event.player;
import net.minestom.server.entity.Player; import net.minestom.server.entity.Player;
import net.minestom.server.event.CancellableEvent; import net.minestom.server.event.trait.CancellableEvent;
import net.minestom.server.event.Event;
import net.minestom.server.event.trait.PlayerEvent; import net.minestom.server.event.trait.PlayerEvent;
import net.minestom.server.item.ItemStack; import net.minestom.server.item.ItemStack;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -1,7 +1,7 @@
package net.minestom.server.event.player; package net.minestom.server.event.player;
import net.minestom.server.entity.Player; import net.minestom.server.entity.Player;
import net.minestom.server.event.CancellableEvent; import net.minestom.server.event.trait.CancellableEvent;
import net.minestom.server.event.trait.ItemEvent; import net.minestom.server.event.trait.ItemEvent;
import net.minestom.server.event.trait.PlayerEvent; import net.minestom.server.event.trait.PlayerEvent;
import net.minestom.server.item.ItemStack; import net.minestom.server.item.ItemStack;

View File

@ -1,7 +1,7 @@
package net.minestom.server.event.server; package net.minestom.server.event.server;
import net.minestom.server.MinecraftServer; import net.minestom.server.MinecraftServer;
import net.minestom.server.event.CancellableEvent; import net.minestom.server.event.trait.CancellableEvent;
import net.minestom.server.network.player.PlayerConnection; import net.minestom.server.network.player.PlayerConnection;
import net.minestom.server.ping.ResponseData; import net.minestom.server.ping.ResponseData;
import net.minestom.server.ping.ResponseDataConsumer; import net.minestom.server.ping.ResponseDataConsumer;

View File

@ -1,4 +1,7 @@
package net.minestom.server.event; package net.minestom.server.event.trait;
import net.minestom.server.event.Event;
import net.minestom.server.event.EventDispatcher;
/** /**
* Represents an {@link Event} which can be cancelled. * Represents an {@link Event} which can be cancelled.

View File

@ -1,6 +1,6 @@
package net.minestom.server.extras.query.event; package net.minestom.server.extras.query.event;
import net.minestom.server.event.CancellableEvent; import net.minestom.server.event.trait.CancellableEvent;
import net.minestom.server.utils.binary.Writeable; import net.minestom.server.utils.binary.Writeable;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;