Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 04:20:08 +01:00
SPIGOT-5950: Add PrepareSmithingEvent event
Dieser Commit ist enthalten in:
Ursprung
8b831a9652
Commit
5db13eea60
@ -18,6 +18,21 @@
|
||||
|
||||
public ContainerSmithing(int i, PlayerInventory playerinventory) {
|
||||
this(i, playerinventory, ContainerAccess.a);
|
||||
@@ -52,12 +57,12 @@
|
||||
List<RecipeSmithing> list = this.g.getCraftingManager().b(Recipes.SMITHING, this.repairInventory, this.g);
|
||||
|
||||
if (list.isEmpty()) {
|
||||
- this.resultInventory.setItem(0, ItemStack.b);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareSmithingEvent(getBukkitView(), ItemStack.b); // CraftBukkit
|
||||
} else {
|
||||
this.h = (RecipeSmithing) list.get(0);
|
||||
ItemStack itemstack = this.h.a(this.repairInventory);
|
||||
|
||||
- this.resultInventory.setItem(0, itemstack);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareSmithingEvent(getBukkitView(), itemstack); // CraftBukkit
|
||||
}
|
||||
|
||||
}
|
||||
@@ -68,4 +73,18 @@
|
||||
return recipesmithing.a(itemstack);
|
||||
});
|
||||
|
@ -188,6 +188,7 @@ import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
import org.bukkit.event.inventory.InventoryOpenEvent;
|
||||
import org.bukkit.event.inventory.PrepareAnvilEvent;
|
||||
import org.bukkit.event.inventory.PrepareItemCraftEvent;
|
||||
import org.bukkit.event.inventory.PrepareSmithingEvent;
|
||||
import org.bukkit.event.inventory.TradeSelectEvent;
|
||||
import org.bukkit.event.player.PlayerBedEnterEvent;
|
||||
import org.bukkit.event.player.PlayerBedEnterEvent.BedEnterResult;
|
||||
@ -1413,6 +1414,13 @@ public class CraftEventFactory {
|
||||
return event;
|
||||
}
|
||||
|
||||
public static PrepareSmithingEvent callPrepareSmithingEvent(InventoryView view, ItemStack item) {
|
||||
PrepareSmithingEvent event = new PrepareSmithingEvent(view, CraftItemStack.asCraftMirror(item).clone());
|
||||
event.getView().getPlayer().getServer().getPluginManager().callEvent(event);
|
||||
event.getInventory().setItem(2, event.getResult());
|
||||
return event;
|
||||
}
|
||||
|
||||
public static EntityToggleGlideEvent callToggleGlideEvent(EntityLiving entity, boolean gliding) {
|
||||
EntityToggleGlideEvent event = new EntityToggleGlideEvent((LivingEntity) entity.getBukkitEntity(), gliding);
|
||||
entity.world.getServer().getPluginManager().callEvent(event);
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren