Improved pull request codestyle

This commit is contained in:
Auxilor 2021-01-16 18:00:47 +00:00
parent 5afeb01acb
commit 152d12a97e

View File

@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.special;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@ -65,10 +66,11 @@ public class Soulbound extends EcoEnchant {
player.setMetadata("soulbound-items", this.getPlugin().getMetadataValueFactory().create(soulboundItems));
}
public boolean hasEmptyInventory(Player p) {
for(ItemStack it : p.getInventory().getContents())
{
if(it != null) return false;
public boolean hasEmptyInventory(@NotNull final Player player) {
for (ItemStack itemStack : player.getInventory().getContents()) {
if (itemStack != null && itemStack.getType() != Material.AIR) {
return false;
}
}
return true;
}
@ -78,7 +80,6 @@ public class Soulbound extends EcoEnchant {
Player player = event.getPlayer();
this.getPlugin().getScheduler().runLater(() -> {
if (!hasEmptyInventory(player)) {
return;
}
@ -102,7 +103,6 @@ public class Soulbound extends EcoEnchant {
meta.getPersistentDataContainer().remove(this.getPlugin().getNamespacedKeyFactory().create("soulbound"));
soulboundItem.setItemMeta(meta);
player.getInventory().addItem(soulboundItem);
}
player.removeMetadata("soulbound-items", this.getPlugin());