mirror of
https://github.com/BentoBoxWorld/Level.git
synced 2024-12-17 22:17:38 +01:00
Adds support for double slabs.
https://github.com/BentoBoxWorld/Level/issues/64
This commit is contained in:
parent
1e1e53cf57
commit
908027e6ba
4
pom.xml
4
pom.xml
@ -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>
|
||||
@ -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>
|
||||
|
@ -12,7 +12,10 @@ import java.util.UUID;
|
||||
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;
|
||||
@ -126,11 +129,18 @@ public class CalcIslandLevel {
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -138,14 +148,14 @@ public class CalcIslandLevel {
|
||||
}
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user