mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-24 19:55:17 +01:00
Code clean up
This commit is contained in:
parent
e3731994b3
commit
dec162744c
@ -65,14 +65,14 @@ public class PlaceBlocksListener extends AbstractFlagListener {
|
|||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
// Check in-hand items
|
// Check in-hand items
|
||||||
if (e.getMaterial() != null) {
|
// This check protects against an exploit in 1.7.9 against cactus
|
||||||
// This check protects against an exploit in 1.7.9 against cactus
|
// and sugar cane and placing boats on non-liquids
|
||||||
// and sugar cane and placing boats on non-liquids
|
if (e.getMaterial() != null
|
||||||
if (e.getMaterial().equals(Material.END_CRYSTAL) || e.getMaterial() == Material.WOOD_DOOR || e.getMaterial() == Material.CHEST
|
&& (e.getMaterial().equals(Material.END_CRYSTAL) || e.getMaterial().equals(Material.WOOD_DOOR)
|
||||||
|| e.getMaterial() == Material.TRAPPED_CHEST || e.getMaterial() == Material.IRON_DOOR
|
|| e.getMaterial().equals(Material.CHEST) || e.getMaterial().equals(Material.TRAPPED_CHEST)
|
||||||
|| (e.getMaterial().name().contains("BOAT") && !e.getClickedBlock().isLiquid())) {
|
|| e.getMaterial().equals(Material.IRON_DOOR) || (e.getMaterial().name().contains("BOAT")
|
||||||
checkIsland(e, e.getPlayer().getLocation(), Flags.PLACE_BLOCKS);
|
&& !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 {
|
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)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onUserTeleport(PlayerTeleportEvent e) {
|
public void onUserTeleport(PlayerTeleportEvent e) {
|
||||||
// Only process if flag is active
|
// Only process if flag is active
|
||||||
@ -43,6 +32,13 @@ public class RemoveMobsListener extends AbstractFlagListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void clearArea(Location loc) {
|
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()
|
loc.getWorld().getNearbyEntities(loc, 5D, 5D, 5D).stream()
|
||||||
.filter(en -> (en instanceof Monster))
|
.filter(en -> (en instanceof Monster))
|
||||||
.filter(en -> !keepers.contains(en.getType()))
|
.filter(en -> !keepers.contains(en.getType()))
|
||||||
|
@ -39,6 +39,9 @@ import us.tastybento.bskyblock.listeners.flags.clicklisteners.WorldToggleClickLi
|
|||||||
import us.tastybento.bskyblock.managers.RanksManager;
|
import us.tastybento.bskyblock.managers.RanksManager;
|
||||||
|
|
||||||
public class Flags {
|
public class Flags {
|
||||||
|
|
||||||
|
private Flags() {}
|
||||||
|
|
||||||
// Disabled setting 'rank'
|
// Disabled setting 'rank'
|
||||||
private static final int DISABLED = -1;
|
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.api.events.island.IslandEvent.Reason;
|
||||||
import us.tastybento.bskyblock.database.objects.Island;
|
import us.tastybento.bskyblock.database.objects.Island;
|
||||||
|
|
||||||
//import com.wasteofplastic.askyblock.nms.NMSAbstraction;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes islands fast using chunk regeneration
|
* Deletes islands fast using chunk regeneration
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user