mirror of
https://github.com/PaperMC/Paper.git
synced 2025-05-19 13:40:24 -07:00
Fix PlayerSwapHandItemsEvent throwing exception when mainhand or offhand set to null
This commit is contained in:
parent
b7bb062734
commit
3c50e35f30
@ -31,7 +31,7 @@ public class PlayerSwapHandItemsEvent extends PlayerEvent implements Cancellable
|
|||||||
*
|
*
|
||||||
* @return item in the main hand
|
* @return item in the main hand
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@NotNull // Paper
|
||||||
public ItemStack getMainHandItem() {
|
public ItemStack getMainHandItem() {
|
||||||
return mainHandItem;
|
return mainHandItem;
|
||||||
}
|
}
|
||||||
@ -42,7 +42,7 @@ public class PlayerSwapHandItemsEvent extends PlayerEvent implements Cancellable
|
|||||||
* @param mainHandItem new item in the main hand
|
* @param mainHandItem new item in the main hand
|
||||||
*/
|
*/
|
||||||
public void setMainHandItem(@Nullable ItemStack mainHandItem) {
|
public void setMainHandItem(@Nullable ItemStack mainHandItem) {
|
||||||
this.mainHandItem = mainHandItem;
|
this.mainHandItem = mainHandItem == null ? ItemStack.empty() : mainHandItem; // Paper
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -50,7 +50,7 @@ public class PlayerSwapHandItemsEvent extends PlayerEvent implements Cancellable
|
|||||||
*
|
*
|
||||||
* @return item in the off hand
|
* @return item in the off hand
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@NotNull // Paper
|
||||||
public ItemStack getOffHandItem() {
|
public ItemStack getOffHandItem() {
|
||||||
return offHandItem;
|
return offHandItem;
|
||||||
}
|
}
|
||||||
@ -61,7 +61,7 @@ public class PlayerSwapHandItemsEvent extends PlayerEvent implements Cancellable
|
|||||||
* @param offHandItem new item in the off hand
|
* @param offHandItem new item in the off hand
|
||||||
*/
|
*/
|
||||||
public void setOffHandItem(@Nullable ItemStack offHandItem) {
|
public void setOffHandItem(@Nullable ItemStack offHandItem) {
|
||||||
this.offHandItem = offHandItem;
|
this.offHandItem = offHandItem == null ? ItemStack.empty() : offHandItem; // Paper
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user