Code clean up

This commit is contained in:
tastybento 2018-06-23 19:20:02 -07:00
parent e3731994b3
commit dec162744c
4 changed files with 18 additions and 21 deletions

View File

@ -65,17 +65,17 @@ public class PlaceBlocksListener extends AbstractFlagListener {
return;
default:
// Check in-hand items
if (e.getMaterial() != null) {
// This check protects against an exploit in 1.7.9 against cactus
// and sugar cane and placing boats on non-liquids
if (e.getMaterial().equals(Material.END_CRYSTAL) || e.getMaterial() == Material.WOOD_DOOR || e.getMaterial() == Material.CHEST
|| e.getMaterial() == Material.TRAPPED_CHEST || e.getMaterial() == Material.IRON_DOOR
|| (e.getMaterial().name().contains("BOAT") && !e.getClickedBlock().isLiquid())) {
if (e.getMaterial() != null
&& (e.getMaterial().equals(Material.END_CRYSTAL) || e.getMaterial().equals(Material.WOOD_DOOR)
|| e.getMaterial().equals(Material.CHEST) || e.getMaterial().equals(Material.TRAPPED_CHEST)
|| e.getMaterial().equals(Material.IRON_DOOR) || (e.getMaterial().name().contains("BOAT")
&& !e.getClickedBlock().isLiquid()))) {
checkIsland(e, e.getPlayer().getLocation(), Flags.PLACE_BLOCKS);
}
}
}
}
/**
* Handles Frost Walking on visitor's islands. This creates ice blocks, which is like placing blocks

View File

@ -23,17 +23,6 @@ import us.tastybento.bskyblock.lists.Flags;
*/
public class RemoveMobsListener extends AbstractFlagListener {
private static Set<EntityType> keepers;
public RemoveMobsListener() {
keepers = new HashSet<>();
keepers.add(EntityType.ZOMBIE_VILLAGER);
keepers.add(EntityType.PIG_ZOMBIE);
keepers.add(EntityType.WITHER);
keepers.add(EntityType.ENDERMAN);
keepers.add(EntityType.GHAST);
}
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onUserTeleport(PlayerTeleportEvent e) {
// Only process if flag is active
@ -43,6 +32,13 @@ public class RemoveMobsListener extends AbstractFlagListener {
}
public static void clearArea(Location loc) {
Set<EntityType> keepers = new HashSet<>();
keepers.add(EntityType.ZOMBIE_VILLAGER);
keepers.add(EntityType.PIG_ZOMBIE);
keepers.add(EntityType.WITHER);
keepers.add(EntityType.ENDERMAN);
keepers.add(EntityType.GHAST);
loc.getWorld().getNearbyEntities(loc, 5D, 5D, 5D).stream()
.filter(en -> (en instanceof Monster))
.filter(en -> !keepers.contains(en.getType()))

View File

@ -39,6 +39,9 @@ import us.tastybento.bskyblock.listeners.flags.clicklisteners.WorldToggleClickLi
import us.tastybento.bskyblock.managers.RanksManager;
public class Flags {
private Flags() {}
// Disabled setting 'rank'
private static final int DISABLED = -1;

View File

@ -8,8 +8,6 @@ import us.tastybento.bskyblock.api.events.island.IslandEvent;
import us.tastybento.bskyblock.api.events.island.IslandEvent.Reason;
import us.tastybento.bskyblock.database.objects.Island;
//import com.wasteofplastic.askyblock.nms.NMSAbstraction;
/**
* Deletes islands fast using chunk regeneration
*