mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-12-29 12:37:37 +01:00
Code clean up
This commit is contained in:
parent
e3731994b3
commit
dec162744c
@ -65,14 +65,14 @@ 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())) {
|
||||
checkIsland(e, e.getPlayer().getLocation(), Flags.PLACE_BLOCKS);
|
||||
}
|
||||
// This check protects against an exploit in 1.7.9 against cactus
|
||||
// and sugar cane and placing boats on non-liquids
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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()))
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user