Add PrepareResultEvent / PrepareGrindstoneEvent

Adds a new event for all crafting stations that generate a result slot item

Anvil, Grindstone and Smithing now extend this event

Grindstone is a backwards compat from a previous PrepareGrindstoneEvent
This commit is contained in:
William Blake Galbreath
2020-07-03 11:58:56 -05:00
parent 6c89cc29e4
commit 48046af5ef
6 changed files with 84 additions and 36 deletions

View File

@@ -10,9 +10,9 @@ import org.jetbrains.annotations.Nullable;
/**
* Called when an item is put in a slot for repair by an anvil.
*/
public class PrepareAnvilEvent extends PrepareInventoryResultEvent {
public class PrepareAnvilEvent extends com.destroystokyo.paper.event.inventory.PrepareResultEvent {
private static final HandlerList handlers = new HandlerList();
// Paper - move HandlerList to PrepareInventoryResultEvent
public PrepareAnvilEvent(@NotNull AnvilView inventory, @Nullable ItemStack result) {
super(inventory, result);
@@ -44,14 +44,5 @@ public class PrepareAnvilEvent extends PrepareInventoryResultEvent {
return (AnvilView) super.getView();
}
@NotNull
@Override
public HandlerList getHandlers() {
return handlers;
}
@NotNull
public static HandlerList getHandlerList() {
return handlers;
}
// Paper - move HandlerList to PrepareInventoryResultEvent
}

View File

@@ -10,9 +10,9 @@ import org.jetbrains.annotations.Nullable;
/**
* Called when an item is put in a slot for repair or unenchanting in a grindstone.
*/
public class PrepareGrindstoneEvent extends PrepareInventoryResultEvent {
public class PrepareGrindstoneEvent extends com.destroystokyo.paper.event.inventory.PrepareGrindstoneEvent { // Paper
private static final HandlerList handlers = new HandlerList();
// Paper - move HandlerList to PrepareInventoryResultEvent
public PrepareGrindstoneEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) {
super(inventory, result);
@@ -24,14 +24,5 @@ public class PrepareGrindstoneEvent extends PrepareInventoryResultEvent {
return (GrindstoneInventory) super.getInventory();
}
@NotNull
@Override
public HandlerList getHandlers() {
return handlers;
}
@NotNull
public static HandlerList getHandlerList() {
return handlers;
}
// Paper - move HandlerList to PrepareInventoryResultEvent
}

View File

@@ -8,7 +8,9 @@ import org.jetbrains.annotations.Nullable;
/**
* Called when an item is put in a slot and the result is calculated.
* @deprecated use {@link com.destroystokyo.paper.event.inventory.PrepareResultEvent}
*/
@Deprecated @org.bukkit.Warning(false) // Paper
public class PrepareInventoryResultEvent extends InventoryEvent {
private static final HandlerList handlers = new HandlerList();

View File

@@ -10,9 +10,9 @@ import org.jetbrains.annotations.Nullable;
/**
* Called when an item is put in a slot for upgrade by a Smithing Table.
*/
public class PrepareSmithingEvent extends PrepareInventoryResultEvent {
public class PrepareSmithingEvent extends com.destroystokyo.paper.event.inventory.PrepareResultEvent {
private static final HandlerList handlers = new HandlerList();
// Paper - move HandlerList ot PrepareInventoryResultEvent
public PrepareSmithingEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) {
super(inventory, result);
@@ -24,14 +24,5 @@ public class PrepareSmithingEvent extends PrepareInventoryResultEvent {
return (SmithingInventory) super.getInventory();
}
@NotNull
@Override
public HandlerList getHandlers() {
return handlers;
}
@NotNull
public static HandlerList getHandlerList() {
return handlers;
}
// Paper - move HandlerList to PrepareInventoryResultEvent
}