Skip to content

Commit

Permalink
Adds support for double slabs.
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed Jul 6, 2019
1 parent 1e1e53c commit 908027e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>world.bentobox</groupId>
<artifactId>level</artifactId>
<version>1.5.1-SNAPSHOT</version>
<version>1.6.0-SNAPSHOT</version>

<name>Level</name>
<description>Level is an add-on for BentoBox, an expandable Minecraft Bukkit plugin for island-type games like SkyBlock or AcidIsland.</description>
Expand Down Expand Up @@ -66,7 +66,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.14.1-R0.1-SNAPSHOT</version>
<version>1.13.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
import org.bukkit.Bukkit;
import org.bukkit.ChunkSnapshot;
import org.bukkit.Material;
import org.bukkit.Tag;
import org.bukkit.World;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.type.Slab;
import org.bukkit.scheduler.BukkitTask;

import com.google.common.collect.HashMultiset;
Expand Down Expand Up @@ -126,26 +129,33 @@ private void scanChunk(ChunkSnapshot chunk) {
}

for (int y = 0; y < island.getCenter().getWorld().getMaxHeight(); y++) {
Material blockData = chunk.getBlockType(x, y, z);
BlockData blockData = chunk.getBlockData(x, y, z);
int seaHeight = addon.getPlugin().getIWM().getSeaHeight(world);
boolean belowSeaLevel = seaHeight > 0 && y <= seaHeight;
// Air is free
if (!blockData.equals(Material.AIR)) {
if (!blockData.getMaterial().equals(Material.AIR)) {
// Slabs can be doubled, so check them twice
if (Tag.SLABS.isTagged(blockData.getMaterial())) {
Slab slab = (Slab)blockData;
if (slab.getType().equals(Slab.Type.DOUBLE)) {
checkBlock(blockData, belowSeaLevel);
}
}
checkBlock(blockData, belowSeaLevel);
}
}
}
}
}

private void checkBlock(Material md, boolean belowSeaLevel) {
int count = limitCount(md);
private void checkBlock(BlockData bd, boolean belowSeaLevel) {
int count = limitCount(bd.getMaterial());
if (belowSeaLevel) {
result.underWaterBlockCount += count;
result.uwCount.add(md);
result.uwCount.add(bd.getMaterial());
} else {
result.rawBlockCount += count;
result.mdCount.add(md);
result.mdCount.add(bd.getMaterial());
}
}

Expand Down

0 comments on commit 908027e

Please sign in to comment.