mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-25 22:10:21 +01:00
Rename item to weapon and projectile to projectile item in the event, adjust javadocs, fix using old parameter name when calling event in Player#getProjectile
This commit is contained in:
parent
a5facdc5bc
commit
327417dc67
2 changed files with 16 additions and 20 deletions
|
@ -8,39 +8,35 @@ import org.jetbrains.annotations.ApiStatus;
|
|||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Called when a player tries to draw a bow or load a crossbow without having a suitable projectile in their inventory
|
||||
* Called when a player tries to draw a bow or load a crossbow without having a suitable projectile item in their inventory
|
||||
*/
|
||||
@NullMarked
|
||||
public class PlayerUseBowWithoutProjectileEvent extends PlayerEvent {
|
||||
|
||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
||||
private final ItemStack item;
|
||||
private ItemStack projectile;
|
||||
private final ItemStack weapon;
|
||||
private ItemStack projectileItem;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public PlayerUseBowWithoutProjectileEvent(final Player player, final ItemStack item) {
|
||||
public PlayerUseBowWithoutProjectileEvent(final Player player, final ItemStack weapon) {
|
||||
super(player);
|
||||
this.item = item;
|
||||
this.projectile = ItemStack.empty();
|
||||
this.weapon = weapon;
|
||||
this.projectileItem = ItemStack.empty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the item which the player tries to use
|
||||
*
|
||||
* @return the item
|
||||
* @return The weapon wich the player tries to use
|
||||
*/
|
||||
public ItemStack getItem() {
|
||||
return item.clone();
|
||||
public ItemStack getWeapon() {
|
||||
return weapon.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the projectile that should be used
|
||||
*
|
||||
* @return the projectile
|
||||
* @return The projectile that should be used
|
||||
*/
|
||||
public ItemStack getProjectile() {
|
||||
return projectile.clone();
|
||||
public ItemStack getProjectileItem() {
|
||||
return projectileItem.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -50,8 +46,8 @@ public class PlayerUseBowWithoutProjectileEvent extends PlayerEvent {
|
|||
*
|
||||
* @param projectile the projectile
|
||||
*/
|
||||
public void setProjectile(ItemStack projectile) {
|
||||
this.projectile = projectile.clone();
|
||||
public void setProjectileItem(ItemStack projectile) {
|
||||
this.projectileItem = projectile.clone();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -678,9 +678,9 @@
|
|||
+ if (this.abilities.instabuild) {
|
||||
+ return new ItemStack(Items.ARROW);
|
||||
+ } else {
|
||||
+ io.papermc.paper.event.player.PlayerUseBowWithoutProjectileEvent event = new io.papermc.paper.event.player.PlayerUseBowWithoutProjectileEvent((org.bukkit.entity.Player) getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(stack));
|
||||
+ io.papermc.paper.event.player.PlayerUseBowWithoutProjectileEvent event = new io.papermc.paper.event.player.PlayerUseBowWithoutProjectileEvent((org.bukkit.entity.Player) getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(shootable));
|
||||
+ event.callEvent();
|
||||
+ return org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getProjectile());
|
||||
+ return org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getProjectileItem());
|
||||
+ }
|
||||
+ // Paper end - PlayerUseBowWithoutProjectileEvent
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue