mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-11-24 03:25:24 +01:00
Updated onFlow hook for the new changes.
This commit is contained in:
parent
70c6b26db5
commit
d09fcab7b3
@ -552,27 +552,30 @@ public boolean onExplode(Block block) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Called when lava wants to flow to a certain block.
|
* Called when fluid wants to flow to a certain block.
|
||||||
* block status represents the type that wants to flow.
|
|
||||||
* (10 & 11 for lava and 8 & 9 for water)
|
* (10 & 11 for lava and 8 & 9 for water)
|
||||||
*
|
*
|
||||||
* @param block
|
* @param blockFrom
|
||||||
* the block beneath where the substance wants to flow to.
|
* the block where the fluid came from.
|
||||||
|
* (blocktype = fluid type)
|
||||||
|
* @param blockTo
|
||||||
|
* the block where fluid wants to flow to.
|
||||||
*
|
*
|
||||||
* for example:
|
|
||||||
* lava want to flow to block x,y,z then the param block is the block x,y-1,z.
|
|
||||||
*
|
*
|
||||||
* @return true if you dont want the substance to flow.
|
* @return true if you dont want the substance to flow.
|
||||||
*/
|
*/
|
||||||
public boolean onFlow(Block block) {
|
public boolean onFlow(Block blockFrom, Block blockTo) {
|
||||||
int x = block.getX();
|
int x = blockFrom.getX();
|
||||||
int y = block.getY();
|
int y = blockFrom.getY();
|
||||||
int z = block.getZ();
|
int z = blockFrom.getZ();
|
||||||
|
|
||||||
if (simulateSponge && (block.getStatus() == 8 || block.getStatus() == 9)) {
|
boolean isWater = blockFrom.getType() == 8 || blockFrom.getType() == 9;
|
||||||
int ox = block.getX();
|
boolean isLava = blockFrom.getType() == 10 || blockFrom.getType() == 11;
|
||||||
int oy = block.getY() + 1;
|
|
||||||
int oz = block.getZ();
|
if (simulateSponge && isWater) {
|
||||||
|
int ox = blockFrom.getX();
|
||||||
|
int oy = blockFrom.getY() + 1;
|
||||||
|
int oz = blockFrom.getZ();
|
||||||
|
|
||||||
Server server = etc.getServer();
|
Server server = etc.getServer();
|
||||||
|
|
||||||
@ -587,16 +590,18 @@ public boolean onFlow(Block block) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (classicWater && (block.getStatus() == 8 || block.getStatus() == 9)) {
|
if (classicWater && isWater) {
|
||||||
int blockBelow = etc.getServer().getBlockIdAt(block.getX(), block.getY(), block.getZ());
|
int blockBelow = etc.getServer().getBlockIdAt(blockFrom.getX(), blockFrom.getY(), blockFrom.getZ());
|
||||||
if (blockBelow != 0 && blockBelow != 8 && blockBelow != 9) {
|
if (blockBelow != 0 && blockBelow != 8 && blockBelow != 9) {
|
||||||
etc.getServer().setBlockAt(9, block.getX(), block.getY() + 1, block.getZ());
|
etc.getServer().setBlockAt(9, blockFrom.getX(), blockFrom.getY() + 1, blockFrom.getZ());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (allowedLavaSpreadOver != null && (block.getStatus() == 10 || block.getStatus() == 11)) {
|
if (allowedLavaSpreadOver != null && isLava) {
|
||||||
if (!allowedLavaSpreadOver.contains(block.getType())) {
|
int targetId = etc.getServer().getBlockIdAt(
|
||||||
|
blockTo.getX(), blockTo.getY() - 1, blockTo.getZ());
|
||||||
|
if (!allowedLavaSpreadOver.contains(targetId)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user