mirror of
https://github.com/BentoBoxWorld/Level.git
synced 2024-11-25 20:25:28 +01:00
Add UltimateStacker hook for stacked blocks (#281)
This commit is contained in:
parent
c093796a6e
commit
9c42a8d007
11
pom.xml
11
pom.xml
@ -149,6 +149,11 @@
|
|||||||
<id>rosewood-repo</id>
|
<id>rosewood-repo</id>
|
||||||
<url>https://repo.rosewooddev.io/repository/public/</url>
|
<url>https://repo.rosewooddev.io/repository/public/</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
<!-- UltimateStacker repo -->
|
||||||
|
<repository>
|
||||||
|
<id>songoda-public</id>
|
||||||
|
<url>https://repo.songoda.com/repository/public/</url>
|
||||||
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@ -234,6 +239,12 @@
|
|||||||
<version>1.3.0</version>
|
<version>1.3.0</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.songoda</groupId>
|
||||||
|
<artifactId>UltimateStacker</artifactId>
|
||||||
|
<version>2.3.3</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@ -58,6 +58,7 @@ public class Level extends Addon {
|
|||||||
private boolean stackersEnabled;
|
private boolean stackersEnabled;
|
||||||
private boolean advChestEnabled;
|
private boolean advChestEnabled;
|
||||||
private boolean roseStackersEnabled;
|
private boolean roseStackersEnabled;
|
||||||
|
private boolean ultimateStackerEnabled;
|
||||||
private final List<GameModeAddon> registeredGameModes = new ArrayList<>();
|
private final List<GameModeAddon> registeredGameModes = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -146,6 +147,12 @@ public class Level extends Addon {
|
|||||||
if (roseStackersEnabled) {
|
if (roseStackersEnabled) {
|
||||||
log("Hooked into RoseStackers.");
|
log("Hooked into RoseStackers.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if UltimateStacker is enabled
|
||||||
|
ultimateStackerEnabled = Bukkit.getPluginManager().isPluginEnabled("UltimateStacker");
|
||||||
|
if (ultimateStackerEnabled) {
|
||||||
|
log("Hooked into UltimateStacker.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -403,6 +410,13 @@ public class Level extends Addon {
|
|||||||
return roseStackersEnabled;
|
return roseStackersEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the ultimateStackerEnabled
|
||||||
|
*/
|
||||||
|
public boolean isUltimateStackerEnabled() {
|
||||||
|
return ultimateStackerEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method Level#getVisitHook returns the visitHook of this object.
|
* Method Level#getVisitHook returns the visitHook of this object.
|
||||||
*
|
*
|
||||||
|
@ -16,6 +16,9 @@ import java.util.UUID;
|
|||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
|
|
||||||
|
import com.songoda.ultimatestacker.UltimateStacker;
|
||||||
|
import com.songoda.ultimatestacker.core.compatibility.CompatibleMaterial;
|
||||||
|
import com.songoda.ultimatestacker.stackable.block.BlockStack;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.ChunkSnapshot;
|
import org.bukkit.ChunkSnapshot;
|
||||||
@ -524,6 +527,25 @@ public class IslandLevelCalculator {
|
|||||||
if (addon.isStackersEnabled() && (blockData.getMaterial().equals(Material.CAULDRON) || blockData.getMaterial().equals(Material.SPAWNER))) {
|
if (addon.isStackersEnabled() && (blockData.getMaterial().equals(Material.CAULDRON) || blockData.getMaterial().equals(Material.SPAWNER))) {
|
||||||
stackedBlocks.add(new Location(cp.world, (double)x + cp.chunkSnapshot.getX() * 16, y, (double)z + cp.chunkSnapshot.getZ() * 16));
|
stackedBlocks.add(new Location(cp.world, (double)x + cp.chunkSnapshot.getX() * 16, y, (double)z + cp.chunkSnapshot.getZ() * 16));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Block block = cp.chunk.getBlock(x, y, z);
|
||||||
|
|
||||||
|
if (addon.isUltimateStackerEnabled()) {
|
||||||
|
if (!blockData.getMaterial().equals(Material.AIR)) {
|
||||||
|
BlockStack stack = UltimateStacker.getInstance().getBlockStackManager().getBlock(block, CompatibleMaterial.getMaterial(block));
|
||||||
|
if (stack != null) {
|
||||||
|
int value = limitCount(blockData.getMaterial());
|
||||||
|
if (belowSeaLevel) {
|
||||||
|
results.underWaterBlockCount.addAndGet((long) stack.getAmount() * value);
|
||||||
|
results.uwCount.add(blockData.getMaterial());
|
||||||
|
} else {
|
||||||
|
results.rawBlockCount.addAndGet((long) stack.getAmount() * value);
|
||||||
|
results.mdCount.add(blockData.getMaterial());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Scan chests
|
// Scan chests
|
||||||
if (addon.getSettings().isIncludeChests() && CHESTS.contains(blockData.getMaterial())) {
|
if (addon.getSettings().isIncludeChests() && CHESTS.contains(blockData.getMaterial())) {
|
||||||
chestBlocks.add(cp.chunk);
|
chestBlocks.add(cp.chunk);
|
||||||
|
Loading…
Reference in New Issue
Block a user