mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 03:35:51 +00:00
Null checks
This commit is contained in:
parent
8b9705a0b4
commit
a000c92d93
@ -1,6 +1,7 @@
|
||||
package io.github.thebusybiscuit.slimefun4.implementation.items.armor;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
@ -41,7 +42,7 @@ public class ElytraCap extends SlimefunArmorPiece implements DamageableItem, Pro
|
||||
}
|
||||
|
||||
@Override
|
||||
public void damageItem(@Nonnull Player p, ItemStack item) {
|
||||
public void damageItem(@Nonnull Player p, @Nullable ItemStack item) {
|
||||
if (p.getGameMode() != GameMode.CREATIVE) {
|
||||
DamageableItem.super.damageItem(p, item);
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.magical.staves;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
@ -106,7 +107,7 @@ public class StormStaff extends SimpleSlimefunItem<ItemUseHandler> {
|
||||
}
|
||||
|
||||
@ParametersAreNonnullByDefault
|
||||
private void damageItem(Player p, ItemStack item) {
|
||||
private void damageItem(@Nonnull Player p, @Nullable ItemStack item) {
|
||||
if (item.getAmount() > 1) {
|
||||
item.setAmount(item.getAmount() - 1);
|
||||
|
||||
|
@ -11,6 +11,7 @@ import java.util.UUID;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
@ -235,7 +236,7 @@ public class ClimbingPick extends SimpleSlimefunItem<ItemUseHandler> implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public void damageItem(@Nonnull Player p, ItemStack item) {
|
||||
public void damageItem(@Nonnull Player p, @Nullable ItemStack item) {
|
||||
if (p.getGameMode() != GameMode.CREATIVE) {
|
||||
DamageableItem.super.damageItem(p, item);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user