Code cleanup.

This commit is contained in:
Tastybento 2018-02-07 19:44:10 -08:00
parent 1d5086531d
commit 41dd491f05
3 changed files with 11 additions and 19 deletions

View File

@ -92,22 +92,19 @@ public class HurtingListener extends AbstractFlagListener {
if (e.getCaught() == null)
return;
if (e.getCaught() instanceof Animals || e.getCaught() instanceof IronGolem || e.getCaught() instanceof Snowman
|| e.getCaught() instanceof Villager) {
if (checkIsland(e, e.getCaught().getLocation(), Flags.HURT_MONSTERS)) {
e.getHook().remove();
return;
}
if ((e.getCaught() instanceof Animals || e.getCaught() instanceof IronGolem || e.getCaught() instanceof Snowman
|| e.getCaught() instanceof Villager) && checkIsland(e, e.getCaught().getLocation(), Flags.HURT_MONSTERS)) {
e.getHook().remove();
return;
}
if (e.getCaught() instanceof Monster || e.getCaught() instanceof Squid || e.getCaught() instanceof Slime) {
if (checkIsland(e, e.getCaught().getLocation(), Flags.HURT_MONSTERS)) {
e.getHook().remove();
return;
}
if ((e.getCaught() instanceof Monster || e.getCaught() instanceof Squid || e.getCaught() instanceof Slime)
&& checkIsland(e, e.getCaught().getLocation(), Flags.HURT_MONSTERS)) {
e.getHook().remove();
return;
}
}
/**
* Handles feeding cookies to animals, which may hurt them
* @param e
@ -173,8 +170,8 @@ public class HurtingListener extends AbstractFlagListener {
// Store it and remove it when the effect is gone
thrownPotions.put(e.getAreaEffectCloud().getEntityId(), uuid);
plugin.getServer().getScheduler().runTaskLater(plugin, () -> {
thrownPotions.remove(e.getAreaEffectCloud().getEntityId());
}, e.getAreaEffectCloud().getDuration());
thrownPotions.remove(e.getAreaEffectCloud().getEntityId());
}, e.getAreaEffectCloud().getDuration());
}
}

View File

@ -106,7 +106,6 @@ public final class AddonsManager {
// Obtain the addon.yml file
JarEntry entry = jar.getJarEntry("addon.yml");
if (entry == null) {
jar.close();
throw new InvalidAddonFormatException("Addon doesn't contains description file");
}

View File

@ -14,14 +14,10 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.material.MaterialData;
import org.bukkit.material.SimpleAttachableMaterialData;
import org.bukkit.material.TrapDoor;
import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.plugin.Plugin;