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;
|
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
|
@NullMarked
|
||||||
public class PlayerUseBowWithoutProjectileEvent extends PlayerEvent {
|
public class PlayerUseBowWithoutProjectileEvent extends PlayerEvent {
|
||||||
|
|
||||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||||
|
|
||||||
private final ItemStack item;
|
private final ItemStack weapon;
|
||||||
private ItemStack projectile;
|
private ItemStack projectileItem;
|
||||||
|
|
||||||
@ApiStatus.Internal
|
@ApiStatus.Internal
|
||||||
public PlayerUseBowWithoutProjectileEvent(final Player player, final ItemStack item) {
|
public PlayerUseBowWithoutProjectileEvent(final Player player, final ItemStack weapon) {
|
||||||
super(player);
|
super(player);
|
||||||
this.item = item;
|
this.weapon = weapon;
|
||||||
this.projectile = ItemStack.empty();
|
this.projectileItem = ItemStack.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the item which the player tries to use
|
* @return The weapon wich the player tries to use
|
||||||
*
|
|
||||||
* @return the item
|
|
||||||
*/
|
*/
|
||||||
public ItemStack getItem() {
|
public ItemStack getWeapon() {
|
||||||
return item.clone();
|
return weapon.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the projectile that should be used
|
* @return The projectile that should be used
|
||||||
*
|
|
||||||
* @return the projectile
|
|
||||||
*/
|
*/
|
||||||
public ItemStack getProjectile() {
|
public ItemStack getProjectileItem() {
|
||||||
return projectile.clone();
|
return projectileItem.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -50,8 +46,8 @@ public class PlayerUseBowWithoutProjectileEvent extends PlayerEvent {
|
||||||
*
|
*
|
||||||
* @param projectile the projectile
|
* @param projectile the projectile
|
||||||
*/
|
*/
|
||||||
public void setProjectile(ItemStack projectile) {
|
public void setProjectileItem(ItemStack projectile) {
|
||||||
this.projectile = projectile.clone();
|
this.projectileItem = projectile.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -678,9 +678,9 @@
|
||||||
+ if (this.abilities.instabuild) {
|
+ if (this.abilities.instabuild) {
|
||||||
+ return new ItemStack(Items.ARROW);
|
+ return new ItemStack(Items.ARROW);
|
||||||
+ } else {
|
+ } 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();
|
+ event.callEvent();
|
||||||
+ return org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getProjectile());
|
+ return org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getProjectileItem());
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end - PlayerUseBowWithoutProjectileEvent
|
+ // Paper end - PlayerUseBowWithoutProjectileEvent
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue