本文整理汇总了Java中cn.nukkit.event.block.BlockPlaceEvent类的典型用法代码示例。如果您正苦于以下问题:Java BlockPlaceEvent类的具体用法?Java BlockPlaceEvent怎么用?Java BlockPlaceEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BlockPlaceEvent类属于cn.nukkit.event.block包,在下文中一共展示了BlockPlaceEvent类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onBlockPlace
import cn.nukkit.event.block.BlockPlaceEvent; //导入依赖的package包/类
@EventHandler
public void onBlockPlace(BlockPlaceEvent evt){
if(SpawnProtect.enabled()){
if(!evt.getPlayer().isOp()){
if(evt.getPlayer().getLevel().equals(Spawn.getLoc().getLevel())){
double d = evt.getBlock().getLocation().distance(Spawn.getLocAsV3());
if(d < SpawnProtect.getRange()){
if(SpawnProtect.warnBuild()){
evt.getPlayer().sendMessage(msg.PNB_BLOCK_CANCEL.getContent());
}
evt.setCancelled(true);
}
}
}
}
}
示例2: onBlockPlaceEvent
import cn.nukkit.event.block.BlockPlaceEvent; //导入依赖的package包/类
@EventHandler
public void onBlockPlaceEvent(final BlockPlaceEvent event){
Player player = event.getPlayer();
if(plugin.ifProtectToPlayer(player,player.getLevel().getFolderName())){
player.sendTip(TextFormat.RED+"\n\n\n\nYou don't have permission to place this block");
}
}
示例3: dnp
import cn.nukkit.event.block.BlockPlaceEvent; //导入依赖的package包/类
@EventHandler
public void dnp(BlockPlaceEvent event){
int str = event.getBlock().getId();
if (str==174|str==79|str==58|str==57|str==56|str==30|str==287|str==26|str==16|str==15|str==14|str==13){
event.setCancelled(true);
}
}
示例4: onBlockPlace
import cn.nukkit.event.block.BlockPlaceEvent; //导入依赖的package包/类
@EventHandler
public void onBlockPlace(BlockPlaceEvent event) {
Player player = event.getPlayer();
if (player.isOp())
return;
Skyblock skyblock = Skyblock.getSkyblockByPos(event.getBlock());
if (!event.getBlock().getLevel().getName().startsWith("skyblock")) {
return;
}
if (skyblock == null || (!skyblock.isOwner(player) && !skyblock.isShare(player))) {
event.setCancelled();
}
}
示例5: onBlockPlace
import cn.nukkit.event.block.BlockPlaceEvent; //导入依赖的package包/类
@EventHandler
public void onBlockPlace(BlockPlaceEvent event){
Player player = event.getPlayer();
if(this.placeQueue.contains(player)){
event.setCancelled();
this.placeQueue.remove(player);
}
}
示例6: onPlace
import cn.nukkit.event.block.BlockPlaceEvent; //导入依赖的package包/类
@EventHandler
public void onPlace(BlockPlaceEvent event){
if(!this.manager.isAuthenticated(event.getPlayer())){
event.setCancelled();
if(this.getConfig().get("message.send-login", true)){
this.sendLoginMessage(event.getPlayer());
}
}
}
示例7: blockCreate
import cn.nukkit.event.block.BlockPlaceEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void blockCreate(BlockPlaceEvent event) {
Location location = NukkitUtil.getLocation(event.getBlock().getLocation());
PlotArea area = location.getPlotArea();
if (area == null) {
return;
}
Player player = event.getPlayer();
PlotPlayer pp = NukkitUtil.getPlayer(player);
Plot plot = area.getPlotAbs(location);
if (plot != null) {
if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_UNOWNED)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_UNOWNED);
event.setCancelled(true);
return;
}
} else if (!plot.isAdded(pp.getUUID())) {
Set<PlotBlock> place = plot.getFlag(Flags.PLACE, null);
if (place != null) {
Block block = event.getBlock();
if (place.contains(PlotBlock.get((short) block.getId(), block.getDamage()))) {
return;
}
}
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER);
event.setCancelled(true);
return;
}
} else if (Settings.Done.RESTRICT_BUILDING && plot.getFlags().containsKey(Flags.DONE)) {
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER);
event.setCancelled(true);
return;
}
}
if (location.getY() > area.MAX_BUILD_HEIGHT && location.getY() < area.MIN_BUILD_HEIGHT && !Permissions
.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_HEIGHTLIMIT)) {
event.setCancelled(true);
MainUtil.sendMessage(pp, C.HEIGHT_LIMIT.s().replace("{limit}", String.valueOf(area.MAX_BUILD_HEIGHT)));
}
} else if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_ROAD);
event.setCancelled(true);
}
}
示例8: onPlayerPlaceEvent
import cn.nukkit.event.block.BlockPlaceEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerPlaceEvent(BlockPlaceEvent e){
if(!isLogged(e.getPlayer().getName().toLowerCase())){
e.setCancelled();
}
}