mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-05-28 00:23:53 +00:00
blockstate, more block events, command preprocess event.
This commit is contained in:
parent
21b5accc69
commit
18a673bd46
34 changed files with 1359 additions and 58 deletions
45
Minecraft.Server.FourKit/Event/Block/BlockPistonEvent.cs
Normal file
45
Minecraft.Server.FourKit/Event/Block/BlockPistonEvent.cs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
namespace Minecraft.Server.FourKit.Event.Block;
|
||||
|
||||
using Minecraft.Server.FourKit.Block;
|
||||
|
||||
/// <summary>
|
||||
/// Called when a piston block is triggered.
|
||||
/// </summary>
|
||||
public abstract class BlockPistonEvent : BlockEvent, Cancellable
|
||||
{
|
||||
private bool _cancel;
|
||||
private readonly BlockFace _direction;
|
||||
|
||||
internal protected BlockPistonEvent(Block block, BlockFace direction) : base(block)
|
||||
{
|
||||
_direction = direction;
|
||||
_cancel = false;
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool isCancelled() => _cancel;
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public void setCancelled(bool cancelled)
|
||||
{
|
||||
_cancel = cancelled;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the Piston in the event is sticky.
|
||||
/// </summary>
|
||||
/// <returns>Stickiness of the piston.</returns>
|
||||
public bool isSticky()
|
||||
{
|
||||
var type = getBlock().getType();
|
||||
return type == Material.PISTON_STICKY_BASE;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the direction in which the piston will operate.
|
||||
/// </summary>
|
||||
/// <returns>Direction of the piston.</returns>
|
||||
public BlockFace getDirection() => _direction;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue