Compare commits

...

17 Commits

Author SHA1 Message Date
d79d139cae change blocks on revive
All checks were successful
continuous-integration/drone/tag Build is passing
2020-06-28 21:14:18 +02:00
f0e8ee791a implemented new multiblock for summon head 2020-06-28 18:12:11 +02:00
350858d221 changed revive multiblock 2020-06-28 18:11:51 +02:00
93209ff3f2 implemented multiblock on revive player 2020-06-28 15:32:18 +02:00
f8a466a955 improved dev stuff. Local server and build 2020-06-28 15:08:12 +02:00
46e97dcb43 added strcuture constraints 2020-06-28 15:05:23 +02:00
ce00fcf596 reimplemented block componenets 2020-06-28 02:45:33 +02:00
ecda11b620 made fields protected. now usable in callback 2020-06-28 02:13:13 +02:00
9cbfd393ed added documentation 2020-06-28 02:11:28 +02:00
2a86656188 fixed custom function interface location 2020-06-28 01:51:26 +02:00
8bbcc2ae44 fixed valid check 2020-06-28 01:42:28 +02:00
d7f1759502 added single type constructor to block component 2020-06-28 01:41:40 +02:00
bfa145b862 implemented custom check function 2020-06-27 17:14:22 +02:00
8e90d957f7 implemented MultiblockListener 2020-06-27 16:57:41 +02:00
eba9493f63 get componenets with BlockVector 2020-06-27 16:48:13 +02:00
9ce6ebe8e0 implemented multiblock structure 2020-06-27 16:40:30 +02:00
c5eae6172c implemented multiblock block component 2020-06-27 16:30:25 +02:00
24 changed files with 444 additions and 82 deletions

2
.gitignore vendored
View File

@@ -2,6 +2,8 @@
**/build/ **/build/
!src/**/build/ !src/**/build/
dev/container dev/container
dev/server
dev/build
# Ignore Gradle GUI config # Ignore Gradle GUI config
gradle-app.setting gradle-app.setting

15
.idea/runConfigurations/Attach.xml generated Normal file
View File

@@ -0,0 +1,15 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Attach" type="Remote">
<option name="USE_SOCKET_TRANSPORT" value="true" />
<option name="SERVER_MODE" value="false" />
<option name="SHMEM_ADDRESS" />
<option name="HOST" value="127.0.0.1" />
<option name="PORT" value="5005" />
<option name="AUTO_RESTART" value="false" />
<RunnerSettings RunnerId="Debug">
<option name="DEBUG_PORT" value="5005" />
<option name="LOCAL" value="false" />
</RunnerSettings>
<method v="2" />
</configuration>
</component>

View File

@@ -15,6 +15,13 @@ Running gradle from Intellij works fine but from the terminal i had to use
# Dev tools # Dev tools
## Local Server
You can compile the spigot server on your own by running `./buildSpigot.sh 1.16.1` inside the dev directory. The first
parameter is the version. If no version is given the `latest` tag is used which is not always the newest minecraft
version.
After that you can start the server and it will run inside the `server` directory.
## Server ## Server
You can run a spigot server for development. Run `sudo docker-compose up` inside of `dev`. You can run a spigot server for development. Run `sudo docker-compose up` inside of `dev`.
To make inserting the plugin easier change the `SPIGOT_UID` to your UID (run the `id` command). The only problem is To make inserting the plugin easier change the `SPIGOT_UID` to your UID (run the `id` command). The only problem is

15
dev/buildSpigot.sh Executable file
View File

@@ -0,0 +1,15 @@
#!/usr/bin/env sh
SCRIPT=$(readlink -f "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
mkdir $SCRIPTPATH/build
mkdir $SCRIPTPATH/server
cd $SCRIPTPATH/build
curl -o BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
java -jar BuildTools.jar --rev ${1:-latest}
cd $SCRIPTPATH/server
echo "eula=true" > eula.txt

View File

@@ -3,7 +3,7 @@ version: "3"
services: services:
spigot-dev: spigot-dev:
image: "nimmis/spigot" image: "nimmis/spigot"
container_name: "spigot-dev-hc-revive" container_name: "spigot-dev"
environment: environment:
- EULA=true - EULA=true
- MC_MAXMEM=4g - MC_MAXMEM=4g

5
dev/docker/insertPlugin.sh Executable file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env sh
SCRIPT=$(readlink -f "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
cp $SCRIPTPATH/../../build/libs/* $SCRIPTPATH/container/plugins

2
dev/docker/log.sh Executable file
View File

@@ -0,0 +1,2 @@
#!/usr/bin/env sh
sudo docker exec spigot-dev mc_log

2
dev/docker/restartServer.sh Executable file
View File

@@ -0,0 +1,2 @@
#!/usr/bin/env sh
sudo docker exec spigot-dev mc_restart

View File

@@ -2,4 +2,4 @@
SCRIPT=$(readlink -f "$0") SCRIPT=$(readlink -f "$0")
SCRIPTPATH=$(dirname "$SCRIPT") SCRIPTPATH=$(dirname "$SCRIPT")
cp $SCRIPTPATH/../build/libs/* $SCRIPTPATH/container/plugins cp $SCRIPTPATH/../build/libs/* $SCRIPTPATH/server/plugins

View File

@@ -1,2 +0,0 @@
#!/usr/bin/env sh
sudo docker exec spigot-dev-hc-revive mc_log

View File

@@ -1,2 +0,0 @@
#!/usr/bin/env sh
sudo docker exec spigot-dev-hc-revive mc_restart

7
dev/startServer.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env sh
SCRIPT=$(readlink -f "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
cd $SCRIPTPATH/server
java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=127.0.0.1:5005 -jar $SCRIPTPATH/build/spigot-*.jar nogui

View File

@@ -7,41 +7,82 @@ import org.bukkit.OfflinePlayer;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.Skull; import org.bukkit.block.Skull;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.BlockVector;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import org.kapelle.multiblock.MultiblockListener;
import org.kapelle.multiblock.MultiblockStructure;
import org.kapelle.multiblock.block_component.IBlockComponent;
import org.kapelle.multiblock.block_component.MultipleBlocks;
import org.kapelle.multiblock.block_component.SingleBlock;
public class RevivePlayer implements Listener { import java.util.Arrays;
private JavaPlugin plugin; import java.util.HashSet;
public class RevivePlayer{
private final JavaPlugin plugin;
public RevivePlayer(JavaPlugin plugin){ public RevivePlayer(JavaPlugin plugin){
this.plugin = plugin; this.plugin = plugin;
plugin.getServer().getPluginManager().registerEvents(this, plugin); new MultiblockListener(plugin, getMultiblockStructure(), new BlockVector(1, 2, 1)) {
@Override
protected void callback(Location coreBlockLocation) {
onMultiblockValid(coreBlockLocation);
}
};
} }
@EventHandler private MultiblockStructure getMultiblockStructure() {
public void onBlockPlace(BlockPlaceEvent event){ IBlockComponent gold = new SingleBlock(Material.GOLD_BLOCK);
if(event.getBlockPlaced().getType() == Material.PLAYER_HEAD && !event.isCancelled()){ IBlockComponent soulSand = new MultipleBlocks(new HashSet<Material>() {{
if(isValidMultiblock(event.getBlockPlaced().getLocation())){ add(Material.SOUL_SAND);
OfflinePlayer spirit = getPlayerFromHead(event.getBlockPlaced()); add(Material.SOUL_SOIL);
}});
IBlockComponent head = new SingleBlock(Material.PLAYER_HEAD);
IBlockComponent air = new SingleBlock(Material.AIR);
IBlockComponent obsidian = new SingleBlock(Material.CRYING_OBSIDIAN);
IBlockComponent dia = new SingleBlock(Material.DIAMOND_BLOCK);
return new MultiblockStructure(
Arrays.asList(
// Bottom layer
Arrays.asList(
Arrays.asList(gold, obsidian, gold),
Arrays.asList(obsidian, dia, obsidian),
Arrays.asList(gold, obsidian, gold)
),
// Mid layer
Arrays.asList(
Arrays.asList(air, air, air),
Arrays.asList(air, soulSand, air),
Arrays.asList(air, air, air)
),
// Top layer
Arrays.asList(
Arrays.asList(air, air, air),
Arrays.asList(air, head, air),
Arrays.asList(air, air, air)
)
));
}
private void onMultiblockValid(Location coreBlockLocation){
OfflinePlayer spirit = getPlayerFromHead(coreBlockLocation.getBlock());
if (spirit.isOnline() /* && spirit.getPlayer().getGameMode() == GameMode.SPECTATOR */){ if (spirit.isOnline() /* && spirit.getPlayer().getGameMode() == GameMode.SPECTATOR */){
revivePlayer(spirit.getPlayer(),event.getBlockPlaced().getLocation()); revivePlayer(spirit.getPlayer(),coreBlockLocation);
}else{ }else{
// Player is not online or not dead // Player is not online or not dead
plugin.getServer().broadcastMessage("Player not ded"); plugin.getServer().broadcastMessage("Player not ded");
// TODO // TODO
} }
} }
}
}
private boolean isValidMultiblock(Location lastPlacedBlock){
return lastPlacedBlock.clone().add(new Vector(0,-1,0)).getBlock().getType() == Material.GOLD_BLOCK
&& lastPlacedBlock.clone().add(new Vector(0,-2,0)).getBlock().getType() == Material.MAGMA_BLOCK;
}
private OfflinePlayer getPlayerFromHead(Block head){ private OfflinePlayer getPlayerFromHead(Block head){
Skull skull = (Skull) (head.getState()); Skull skull = (Skull) (head.getState());
@@ -51,13 +92,21 @@ public class RevivePlayer implements Listener {
private void revivePlayer(Player player, Location headLocation){ private void revivePlayer(Player player, Location headLocation){
// Break blocks // Break blocks
headLocation.getBlock().setType(Material.AIR); headLocation.getBlock().setType(Material.AIR);
headLocation.add(new Vector(0,-1,0)).getBlock().setType(Material.AIR); headLocation.clone().add(0,-1,0).getBlock().setType(Material.AIR);
headLocation.add(new Vector(0,-1,0)).getBlock().setType(Material.AIR);
for (int x = -1; x < 2; x++) {
for (int y = -1; y < 2; y++) {
headLocation.clone().add(x,-2,y).getBlock().setType(Material.ANDESITE);
}
}
// Teleport player // Teleport player
player.teleport(headLocation); player.teleport(headLocation);
// Set player gamemode // Set player gamemode
player.setGameMode(GameMode.SURVIVAL); player.setGameMode(GameMode.SURVIVAL);
// Set player to 1 heart
player.setHealth(2);
} }
} }

View File

@@ -1,76 +1,84 @@
package org.kapelle.hardcore_revive; package org.kapelle.hardcore_revive;
import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Particle; import org.bukkit.Particle;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.Sign; import org.bukkit.block.Sign;
import org.bukkit.block.Skull;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta; import org.bukkit.inventory.meta.SkullMeta;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.BlockVector;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import org.kapelle.multiblock.MultiblockListener;
import org.kapelle.multiblock.MultiblockStructure;
import org.kapelle.multiblock.block_component.IBlockComponent;
import org.kapelle.multiblock.block_component.MultipleBlocks;
import org.kapelle.multiblock.block_component.SingleBlock;
public class SummonHead implements Listener { import java.util.Arrays;
import java.util.HashSet;
public class SummonHead{
private final JavaPlugin plugin; private final JavaPlugin plugin;
public SummonHead(JavaPlugin plugin){ public SummonHead(JavaPlugin plugin){
this.plugin = plugin; this.plugin = plugin;
plugin.getServer().getPluginManager().registerEvents(this, plugin);
new MultiblockListener(plugin, getMultiblockStructure(), new BlockVector(0, 0, 0)) {
@Override
protected void callback(Location coreBlockLocation) {
summonHead(coreBlockLocation);
}
};
} }
@EventHandler private MultiblockStructure getMultiblockStructure(){
public void onBlockPlace(BlockPlaceEvent event){ IBlockComponent sign = new MultipleBlocks(new HashSet<Material>(){{
if(event.getBlockPlaced().getType() == Material.SOUL_CAMPFIRE && !event.isCancelled()){ add(Material.SPRUCE_SIGN);
if (isValidMultiblock(event.getBlockPlaced().getLocation())){ add(Material.ACACIA_SIGN);
summonHead(event.getBlockPlaced().getLocation()); add(Material.CRIMSON_SIGN);
} add(Material.JUNGLE_SIGN);
} add(Material.OAK_SIGN);
} add(Material.WARPED_SIGN);
}});
/** IBlockComponent hayBale = new SingleBlock(Material.HAY_BLOCK);
* Checks if a block type is a sign that is standing (not mounted on a wall)
* @param block
* @return
*/
private boolean isStandingSign(Material block){
return block == Material.SPRUCE_SIGN
|| block == Material.ACACIA_SIGN
|| block == Material.BIRCH_SIGN
|| block == Material.CRIMSON_SIGN
|| block == Material.DARK_OAK_SIGN
|| block == Material.JUNGLE_SIGN
|| block == Material.OAK_SIGN
|| block == Material.WARPED_SIGN;
}
/** IBlockComponent pumpkin = new MultipleBlocks(new HashSet<Material>(){{
* Checks if the last placed block is a valid multiblock. add(Material.JACK_O_LANTERN);
* The valid structure is from top to bottom: Standing sign, soul sand, soul campfire, soul sand add(Material.CARVED_PUMPKIN);
* @param lastBlockLocation Exprected to be the soul campfire }});
* @return if the structure is valid
*/
private boolean isValidMultiblock(Location lastBlockLocation){
return lastBlockLocation.clone().add(new Vector(0,-1,0)).getBlock().getType() == Material.SOUL_SAND
&& lastBlockLocation.clone().add(new Vector(0,1,0)).getBlock().getType() == Material.SOUL_SAND
&& isStandingSign(lastBlockLocation.clone().add(new Vector(0,2,0)).getBlock().getType());
return new MultiblockStructure(Arrays.asList(
// Bottom layer
Arrays.asList(
Arrays.asList(hayBale)
),
// Mid Layer
Arrays.asList(
Arrays.asList(pumpkin)
),
// Top layer
Arrays.asList(
Arrays.asList(sign)
)
));
} }
/** /**
* Perform the head summoning ritual. * Perform the head summoning ritual.
* @param lastBlockLocation The location of the core block of the multiblock structure. In this case * @param coreBlockLocation The location of the core block of the multiblock structure. In this case
* the soul campfire. * the soul campfire.
*/ */
private void summonHead(Location lastBlockLocation){ private void summonHead(Location coreBlockLocation){
Block topBlock = lastBlockLocation.clone().add(new Vector(0,2,0)).getBlock(); Location signBlock = coreBlockLocation.clone().add(new Vector(0,2,0));
Location pumpkin = coreBlockLocation.clone().add(new Vector(0,1,0));
String spiritName = getSignText((Sign) topBlock.getState()); String spiritName = getSignText((Sign) signBlock.getBlock().getState());
Player spirit = plugin.getServer().getPlayerExact(spiritName); Player spirit = plugin.getServer().getPlayerExact(spiritName);
if (spirit == null) { if (spirit == null) {
@@ -79,10 +87,11 @@ public class SummonHead implements Listener {
} }
// Remove sign // Remove sign
topBlock.setType(Material.AIR); signBlock.getBlock().setType(Material.AIR);
pumpkin.getBlock().setType(Material.AIR);
// Spawn particle at sign // Spawn particle at sign
topBlock.getWorld().spawnParticle(Particle.SPELL_WITCH,topBlock.getLocation(),20); pumpkin.getWorld().spawnParticle(Particle.SPELL_WITCH,pumpkin,20);
// Prepare head to be spawned // Prepare head to be spawned
ItemStack head = new ItemStack(Material.PLAYER_HEAD); ItemStack head = new ItemStack(Material.PLAYER_HEAD);
@@ -92,11 +101,7 @@ public class SummonHead implements Listener {
head.setItemMeta(headMeta); head.setItemMeta(headMeta);
// Spawn head at the position of the sign // Spawn head at the position of the sign
lastBlockLocation.getWorld().dropItem(topBlock.getLocation(),head); pumpkin.getWorld().dropItem(pumpkin,head);
// Remove soul campfire
// FIXME: removing the campfire raises an execption somewhere else. But i think its fine. Maybe removing a tile entity works different
lastBlockLocation.getBlock().setType(Material.AIR);
} }
/** /**

View File

@@ -0,0 +1,44 @@
package org.kapelle.multiblock;
import org.bukkit.Location;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.BlockVector;
import org.kapelle.multiblock.block_component.IBlockComponent;
/**
* Listens for block placements and checks if it is part of a the multiblock structure.
*/
public abstract class MultiblockListener implements Listener {
protected final IBlockComponent coreBlock;
protected final BlockVector coreBlockOffset;
protected final MultiblockStructure structure;
public MultiblockListener(JavaPlugin plugin, MultiblockStructure structure, BlockVector coreBlockOffset){
this.structure = structure;
this.coreBlockOffset = coreBlockOffset;
this.coreBlock = structure.getComponent(coreBlockOffset);
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
@EventHandler
public void onBlockPlaced(BlockPlaceEvent event){
Location placedLocation = event.getBlockPlaced().getLocation();
if(!event.isCancelled() && this.coreBlock.isValidBlock(placedLocation)){
if(this.structure.isValid(placedLocation,this.coreBlockOffset)){
callback(placedLocation);
}
}
}
/**
* Gets called on successfully validating a multiblock
* @param coreBlockLocation location of the core block
*/
protected abstract void callback(Location coreBlockLocation);
}

View File

@@ -0,0 +1,77 @@
package org.kapelle.multiblock;
import org.bukkit.Location;
import org.bukkit.util.BlockVector;
import org.kapelle.multiblock.block_component.IBlockComponent;
import org.kapelle.multiblock.block_component.ICheckFunction;
import org.kapelle.multiblock.constraint.IConstraint;
import java.util.ArrayList;
import java.util.List;
/**
* Represents a full multiblock.
* Contains the individual block components.
*/
public class MultiblockStructure {
private final List<List<List<IBlockComponent>>> structure;
private final List<IConstraint> constraints = new ArrayList<>();
/**
* Create a multiblock structure.
* The format is like this: [y][z][x]
* So you describe the layers from bottom to top.
* @param structure structure in the format: [y][z][x]
*/
public MultiblockStructure(List<List<List<IBlockComponent>>> structure){
this.structure = structure;
}
public IBlockComponent getComponent(BlockVector offset){
return getComponent(offset.getBlockX(),offset.getBlockY(),offset.getBlockZ());
}
public IBlockComponent getComponent(int x, int y, int z){
return structure.get(y).get(z).get(x);
}
public Location getBlockLocation(Location location, BlockVector offset, BlockVector localPosition){
return location.clone().subtract(offset).add(localPosition);
}
/**
* Checks if the multiblock is valid at the given location.
* @param location Location of a block in a multiblock structure.
* @param offset the offset of the location from <0,0,0>
* @return true if valid
*/
public boolean isValid(Location location, BlockVector offset){
for (int y = 0; y < structure.size(); y++) {
for (int z = 0; z < structure.get(y).size(); z++) {
for (int x = 0; x < structure.get(y).get(z).size() ; x++) {
IBlockComponent currentComponent = getComponent(x,y,z);
Location globalBlockLocation = getBlockLocation(location,offset,new BlockVector(x,y,z));
if(!currentComponent.isValidBlock(globalBlockLocation)){
return false;
}
}
}
}
for (IConstraint constraint:constraints) {
if(!constraint.isValid(location,offset,this)){
return false;
}
}
return true;
}
public void addConstraint(IConstraint constraint){
this.constraints.add(constraint);
}
}

View File

@@ -0,0 +1,21 @@
package org.kapelle.multiblock.block_component;
import org.bukkit.Location;
public class AnyBlock implements IBlockComponent{
private static final AnyBlock singleton = new AnyBlock();
private AnyBlock(){
}
@Override
public boolean isValidBlock(Location location) {
return true;
}
public static AnyBlock getInstance(){
return AnyBlock.singleton;
}
}

View File

@@ -0,0 +1,10 @@
package org.kapelle.multiblock.block_component;
import org.bukkit.Location;
/**
* Represents a single position in a multiblock.
*/
public interface IBlockComponent {
public boolean isValidBlock(Location location);
}

View File

@@ -0,0 +1,10 @@
package org.kapelle.multiblock.block_component;
import org.bukkit.Location;
/**
* Interface for a custom check function.
*/
public interface ICheckFunction {
boolean apply(Location location);
}

View File

@@ -0,0 +1,16 @@
package org.kapelle.multiblock.block_component;
import org.bukkit.Location;
public class LambdaComponent implements IBlockComponent{
private final ICheckFunction checkFunction;
public LambdaComponent(ICheckFunction checkFunction){
this.checkFunction = checkFunction;
}
@Override
public boolean isValidBlock(Location location) {
return checkFunction.apply(location);
}
}

View File

@@ -0,0 +1,19 @@
package org.kapelle.multiblock.block_component;
import org.bukkit.Location;
import org.bukkit.Material;
import java.util.Set;
public class MultipleBlocks implements IBlockComponent{
private final Set<Material> validMaterial;
public MultipleBlocks(Set<Material> validMaterial){
this.validMaterial = validMaterial;
}
@Override
public boolean isValidBlock(Location location) {
return this.validMaterial.contains(location.getBlock().getType());
}
}

View File

@@ -0,0 +1,17 @@
package org.kapelle.multiblock.block_component;
import org.bukkit.Location;
import org.bukkit.Material;
public class SingleBlock implements IBlockComponent{
private final Material material;
public SingleBlock(Material material){
this.material = material;
}
@Override
public boolean isValidBlock(Location location) {
return location.getBlock().getType() == this.material;
}
}

View File

@@ -0,0 +1,9 @@
package org.kapelle.multiblock.constraint;
import org.bukkit.Location;
import org.bukkit.util.BlockVector;
import org.kapelle.multiblock.MultiblockStructure;
public interface IConstraint {
public boolean isValid(Location coreBlockLocation, BlockVector offset, MultiblockStructure structure);
}

View File

@@ -0,0 +1,34 @@
package org.kapelle.multiblock.constraint;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.util.BlockVector;
import org.kapelle.multiblock.MultiblockStructure;
import java.security.InvalidParameterException;
import java.util.List;
public class SameBlockConstraint implements IConstraint{
private final List<BlockVector> positions;
public SameBlockConstraint(List<BlockVector> positions){
this.positions = positions;
if (positions.size() <= 1){
throw new InvalidParameterException("position need at least 2 positions");
}
}
@Override
public boolean isValid(Location coreBlockLocation, BlockVector offset, MultiblockStructure structure) {
Material material = structure.getBlockLocation(coreBlockLocation,offset,positions.get(0)).getBlock().getType();
for (BlockVector pos : positions) {
if(structure.getBlockLocation(coreBlockLocation,offset,pos).getBlock().getType() != material){
return false;
}
}
return true;
}
}