mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
Attempt to fix bug #2360
This commit is contained in:
commit
7d5c34a8c6
@ -32,6 +32,7 @@ import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||
* @author VoidAngel
|
||||
* @author Poslovitch
|
||||
* @author TheBusyBiscuit
|
||||
* @author AccelShark
|
||||
*
|
||||
*/
|
||||
public class BlockPhysicsListener implements Listener {
|
||||
@ -54,21 +55,29 @@ public class BlockPhysicsListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPistonExtend(BlockPistonExtendEvent e) {
|
||||
for (Block b : e.getBlocks()) {
|
||||
if (BlockStorage.hasBlockInfo(b) || (b.getRelative(e.getDirection()).getType() == Material.AIR && BlockStorage.hasBlockInfo(b.getRelative(e.getDirection())))) {
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
if (BlockStorage.hasBlockInfo(e.getBlock())) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
else {
|
||||
for (Block b : e.getBlocks()) {
|
||||
if (BlockStorage.hasBlockInfo(b) || (b.getRelative(e.getDirection()).getType() == Material.AIR && BlockStorage.hasBlockInfo(b.getRelative(e.getDirection())))) {
|
||||
e.setCancelled(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPistonRetract(BlockPistonRetractEvent e) {
|
||||
if (e.isSticky()) {
|
||||
if (BlockStorage.hasBlockInfo(e.getBlock())) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
else if (e.isSticky()) {
|
||||
for (Block b : e.getBlocks()) {
|
||||
if (BlockStorage.hasBlockInfo(b) || (b.getRelative(e.getDirection()).getType() == Material.AIR && BlockStorage.hasBlockInfo(b.getRelative(e.getDirection())))) {
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user