本文整理汇总了Java中org.bukkit.material.PistonBaseMaterial类的典型用法代码示例。如果您正苦于以下问题:Java PistonBaseMaterial类的具体用法?Java PistonBaseMaterial怎么用?Java PistonBaseMaterial使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PistonBaseMaterial类属于org.bukkit.material包,在下文中一共展示了PistonBaseMaterial类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: oreGinPistonPull
import org.bukkit.material.PistonBaseMaterial; //导入依赖的package包/类
/**
* Stop Piston from pulling an OreGin or it's light
*/
@EventHandler
public void oreGinPistonPull(BlockPistonRetractEvent event)
{
MaterialData materialData = event.getBlock().getState().getData();
BlockFace blockFace;
Block movedBlock;
if (materialData instanceof PistonBaseMaterial)
{
blockFace = ((PistonBaseMaterial) materialData).getFacing();
movedBlock = event.getBlock().getRelative(blockFace, 2);
if (event.isSticky() && movedBlock != null)
{
if (oreGinMan.machineExistsAt(movedBlock.getLocation())
|| oreGinMan.oreGinLightExistsAt(movedBlock.getLocation()))
{
event.setCancelled(true);
}
}
}
}
示例2: get
import org.bukkit.material.PistonBaseMaterial; //导入依赖的package包/类
@Override
@Nullable
protected Boolean[] get(Event e) {
MaterialData piston = block.getSingle(e).getState().getData();
if (piston instanceof PistonBaseMaterial) {
return new Boolean[]{((PistonBaseMaterial)piston).isPowered()};
}
return null;
}
示例3: change
import org.bukkit.material.PistonBaseMaterial; //导入依赖的package包/类
@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode){
if (mode == ChangeMode.SET) {
BlockState state = block.getSingle(e).getState();
MaterialData piston = state.getData();
if (piston instanceof PistonBaseMaterial) {
((PistonBaseMaterial)piston).setPowered((Boolean)delta[0]);
state.setData(piston);
state.update(true, false);
Bukkit.getLogger().info(((PistonBaseMaterial)piston).isPowered() + " TEST1");
Bukkit.getLogger().info(((PistonBaseMaterial)block.getSingle(e).getState().getData()).isPowered() + " TEST2");
}
}
}
示例4: check
import org.bukkit.material.PistonBaseMaterial; //导入依赖的package包/类
public boolean check(Event e) {
MaterialData piston = block.getSingle(e).getState().getData();
if (!(piston instanceof PistonBaseMaterial)) {
return false;
}
if (((PistonBaseMaterial)piston).isSticky()) {
return isNegated();
} else {
return !isNegated();
}
}
示例5: PistonBaseMaterial
import org.bukkit.material.PistonBaseMaterial; //导入依赖的package包/类
@Deprecated public PistonBaseMaterial(int type) {
}
示例6: clone
import org.bukkit.material.PistonBaseMaterial; //导入依赖的package包/类
public PistonBaseMaterial clone() {
return null;
}