Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
TrueDarkLord committed Feb 14, 2024
1 parent 2c4a0e7 commit 34a64c9
Showing 1 changed file with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import com.badbones69.crazyenchantments.paper.api.PluginSupport.SupportedPlugins;
import com.badbones69.crazyenchantments.paper.api.enums.CEnchantments;
import com.badbones69.crazyenchantments.paper.api.objects.CEnchantment;
import com.badbones69.crazyenchantments.paper.api.support.anticheats.SpartanSupport;
import com.badbones69.crazyenchantments.paper.controllers.settings.EnchantmentBookSettings;
import com.badbones69.crazyenchantments.paper.utilities.misc.EnchantUtils;
import org.bukkit.Bukkit;
Expand Down Expand Up @@ -36,8 +35,6 @@ public class ArmorMoveProcessor extends Processor<UUID> {
// Plugin Support.
private final PluginSupport pluginSupport = starter.getPluginSupport();

private final SpartanSupport spartanSupport = starter.getSpartanSupport();

private final EnchantmentBookSettings enchantmentBookSettings = starter.getEnchantmentBookSettings();

private final Processor<Runnable> syncProcessor;
Expand Down Expand Up @@ -106,7 +103,10 @@ private void checkCommander(ItemStack armor, Player player, Map<CEnchantment, In

private void checkAngel(ItemStack armor, Player player, Map<CEnchantment, Integer> enchantments, int radius) {
if (!EnchantUtils.isMoveEventActive(CEnchantments.ANGEL, player, enchantments)) return;
List<Player> players = player.getNearbyEntities(radius, radius, radius).stream().filter(entity -> entity instanceof Player && pluginSupport.isFriendly(player, entity)).map(entity -> (Player) entity).toList();

List<Player> players = player.getNearbyEntities(radius, radius, radius).stream().filter(entity ->
pluginSupport.isFriendly(player, entity)).map(entity -> (Player) entity).toList();

if (players.isEmpty()) return;

plugin.getServer().getScheduler().runTask(plugin, () -> {
Expand All @@ -121,15 +121,7 @@ private void checkImplants(ItemStack armor, Player player, Map<CEnchantment, Int

plugin.getServer().getScheduler().runTask(plugin, () -> {
if (EnchantUtils.normalEnchantEvent(CEnchantments.IMPLANTS, player, armor)) {

int foodIncrease = 1;

if (SupportedPlugins.SPARTAN.isPluginLoaded()) spartanSupport.cancelFastEat(player);

if (player.getFoodLevel() + foodIncrease <= 20)
player.setFoodLevel(player.getFoodLevel() + foodIncrease);

if (player.getFoodLevel() + foodIncrease >= 20) player.setFoodLevel(20);
player.setFoodLevel(Math.min(20, player.getFoodLevel() + enchantments.get(CEnchantments.IMPLANTS.getEnchantment())));
}
});
}
Expand All @@ -153,7 +145,7 @@ private void useHellForge(Player player, ItemStack item, Map<CEnchantment, Integ
plugin.getServer().getScheduler().runTask(plugin, () -> {
if (EnchantUtils.normalEnchantEvent(CEnchantments.HELLFORGED, player, item)) {
int finalArmorDurability = armorDurability;
finalArmorDurability -= crazyManager.getLevel(item, CEnchantments.HELLFORGED);
finalArmorDurability -= enchantments.get(CEnchantments.HELLFORGED.getEnchantment());
methods.setDurability(item, finalArmorDurability);
}
});
Expand Down

0 comments on commit 34a64c9

Please sign in to comment.