本文整理汇总了Java中cn.nukkit.level.sound.DoorSound类的典型用法代码示例。如果您正苦于以下问题:Java DoorSound类的具体用法?Java DoorSound怎么用?Java DoorSound使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DoorSound类属于cn.nukkit.level.sound包,在下文中一共展示了DoorSound类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toggle
import cn.nukkit.level.sound.DoorSound; //导入依赖的package包/类
public boolean toggle(Player player) {
DoorToggleEvent event = new DoorToggleEvent(this, player);
this.getLevel().getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return false;
}
int sideBit = this.meta & 0x07;
boolean open = isOpen();
this.meta = sideBit;
if (open) {
this.meta |= 0x08;
}
this.level.setBlock(this, this, false, false);
this.level.addSound(new DoorSound(this));
return true;
}
示例2: onActivate
import cn.nukkit.level.sound.DoorSound; //导入依赖的package包/类
@Override
public boolean onActivate(Item item, Player player) {
if (!this.toggle(player)) {
return false;
}
this.level.addSound(new DoorSound(this));
return true;
}
示例3: toggle
import cn.nukkit.level.sound.DoorSound; //导入依赖的package包/类
public boolean toggle(Player player) {
DoorToggleEvent event = new DoorToggleEvent(this, player);
this.getLevel().getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return false;
}
if (isTop(this.meta)) { //Top
Block down = this.down();
if (down.getId() != this.getId()) {
return false;
}
this.getLevel().setBlock(down, Block.get(this.getId(), down.getDamage() ^ 0x04), true);
this.meta ^= 0x04;
this.getLevel().setBlock(this, this, true);
} else { //Down
Block up = this.up();
if (up.getId() != this.getId()) {
return false;
}
this.meta ^= 0x04;
this.getLevel().setBlock(this, this, true);
}
this.level.addSound(new DoorSound(this));
return true;
}
示例4: onActivate
import cn.nukkit.level.sound.DoorSound; //导入依赖的package包/类
@Override
public boolean onActivate(Item item, Player player) {
if (player == null) {
return false;
}
if (!this.toggle(player)) {
return false;
}
this.getLevel().setBlock(this, this, true);
this.getLevel().addSound(new DoorSound(this));
return true;
}
示例5: onActivate
import cn.nukkit.level.sound.DoorSound; //导入依赖的package包/类
@Override
public boolean onActivate(Item item, Player player) {
if (!this.toggle(player)) {
return false;
}
this.getLevel().setBlock(this, this, true);
this.level.addSound(new DoorSound(this));
return true;
}
示例6: toggle
import cn.nukkit.level.sound.DoorSound; //导入依赖的package包/类
public boolean toggle(Player player) {
DoorToggleEvent event = new DoorToggleEvent(this, player);
this.getLevel().getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return false;
}
int sideBit = this.meta & 0x03;
boolean top = isTop();
boolean open = isOpen();
this.meta = 0;
this.meta |= sideBit;
if (!open) {
this.meta |= 0x04;
}
if (top) {
this.meta |= 0x08;
}
this.level.setBlock(this, this, false, false);
this.level.addSound(new DoorSound(this));
return true;
}