mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-01-02 06:28:13 +01:00
Code smells cleanup
Removed unnecessary cast in Island. Combined if statement Removed unnecessary {}
This commit is contained in:
parent
84e3ae3e8b
commit
c76c854ed3
@ -316,8 +316,8 @@ public class Island implements DataObject {
|
||||
*/
|
||||
public int getTileEntityCount(Material material, World world) {
|
||||
int result = 0;
|
||||
for (int x = (int) (getMinProtectedX() /16); x <= (getMinProtectedX() + getProtectionRange() - 1)/16; x++) {
|
||||
for (int z = (int) (getMinProtectedZ() /16); z <= (getMinProtectedZ() + getProtectionRange() - 1)/16; z++) {
|
||||
for (int x = getMinProtectedX() /16; x <= (getMinProtectedX() + getProtectionRange() - 1)/16; x++) {
|
||||
for (int z = getMinProtectedZ() /16; z <= (getMinProtectedZ() + getProtectionRange() - 1)/16; z++) {
|
||||
for (BlockState holder : world.getChunkAt(x, z).getTileEntities()) {
|
||||
//plugin.getLogger().info("DEBUG: tile entity: " + holder.getType());
|
||||
if (onIsland(holder.getLocation())) {
|
||||
|
@ -40,20 +40,14 @@ public class BucketListener extends AbstractFlagListener {
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onBucketFill(final PlayerBucketFillEvent e) {
|
||||
// Check filling of various liquids
|
||||
if (e.getItemStack().getType().equals(Material.LAVA_BUCKET)) {
|
||||
if (!checkIsland(e, e.getBlockClicked().getLocation(), Flags.COLLECT_LAVA)) {
|
||||
return;
|
||||
}
|
||||
if (e.getItemStack().getType().equals(Material.LAVA_BUCKET) && (!checkIsland(e, e.getBlockClicked().getLocation(), Flags.COLLECT_LAVA))) {
|
||||
return;
|
||||
}
|
||||
if (e.getItemStack().getType().equals(Material.WATER_BUCKET)) {
|
||||
if (!checkIsland(e, e.getBlockClicked().getLocation(), Flags.COLLECT_WATER)) {
|
||||
return;
|
||||
}
|
||||
if (e.getItemStack().getType().equals(Material.WATER_BUCKET) && (!checkIsland(e, e.getBlockClicked().getLocation(), Flags.COLLECT_WATER))) {
|
||||
return;
|
||||
}
|
||||
if (e.getItemStack().getType().equals(Material.MILK_BUCKET)) {
|
||||
if (!checkIsland(e, e.getBlockClicked().getLocation(), Flags.MILKING)) {
|
||||
return;
|
||||
}
|
||||
if (e.getItemStack().getType().equals(Material.MILK_BUCKET) && (!checkIsland(e, e.getBlockClicked().getLocation(), Flags.MILKING))) {
|
||||
return;
|
||||
}
|
||||
// Check general bucket use
|
||||
checkIsland(e, e.getBlockClicked().getLocation(), Flags.BUCKET);
|
||||
|
@ -170,9 +170,7 @@ public class HurtingListener extends AbstractFlagListener {
|
||||
UUID uuid = ((Player)projectile.getShooter()).getUniqueId();
|
||||
// Store it and remove it when the effect is gone
|
||||
thrownPotions.put(e.getAreaEffectCloud().getEntityId(), uuid);
|
||||
getPlugin().getServer().getScheduler().runTaskLater(getPlugin(), () -> {
|
||||
thrownPotions.remove(e.getAreaEffectCloud().getEntityId());
|
||||
}, e.getAreaEffectCloud().getDuration());
|
||||
getPlugin().getServer().getScheduler().runTaskLater(getPlugin(), () -> thrownPotions.remove(e.getAreaEffectCloud().getEntityId()), e.getAreaEffectCloud().getDuration());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -132,9 +132,7 @@ public class PVPListener extends AbstractFlagListener {
|
||||
UUID uuid = ((Player)projectile.getShooter()).getUniqueId();
|
||||
// Store it and remove it when the effect is gone
|
||||
thrownPotions.put(e.getAreaEffectCloud().getEntityId(), uuid);
|
||||
getPlugin().getServer().getScheduler().runTaskLater(getPlugin(), () -> {
|
||||
thrownPotions.remove(e.getAreaEffectCloud().getEntityId());
|
||||
}, e.getAreaEffectCloud().getDuration());
|
||||
getPlugin().getServer().getScheduler().runTaskLater(getPlugin(), () -> thrownPotions.remove(e.getAreaEffectCloud().getEntityId()), e.getAreaEffectCloud().getDuration());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user