当前位置: 首页>>代码示例>>Java>>正文


Java EntityInteractEvent.setCancelled方法代码示例

本文整理汇总了Java中org.bukkit.event.entity.EntityInteractEvent.setCancelled方法的典型用法代码示例。如果您正苦于以下问题:Java EntityInteractEvent.setCancelled方法的具体用法?Java EntityInteractEvent.setCancelled怎么用?Java EntityInteractEvent.setCancelled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.event.entity.EntityInteractEvent的用法示例。


在下文中一共展示了EntityInteractEvent.setCancelled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onEntityInteract

import org.bukkit.event.entity.EntityInteractEvent; //导入方法依赖的package包/类
@EventHandler
public void onEntityInteract(EntityInteractEvent event) {
  if (!(event.getEntity() instanceof Player)) {
    return;
  }

  if (event.getBlock().getType() != Material.SOIL
      && event.getBlock().getType() != Material.WHEAT) {
    return;
  }

  Player player = (Player) event.getEntity();
  Game game = BedwarsRel.getInstance().getGameManager().getGameOfPlayer(player);

  if (game == null) {
    return;
  }

  if (game.getState() == GameState.WAITING) {
    event.setCancelled(true);
  }
}
 
开发者ID:BedwarsRel,项目名称:BedwarsRel,代码行数:23,代码来源:EntityListener.java

示例2: onEntityInteract

import org.bukkit.event.entity.EntityInteractEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST)
public void onEntityInteract(final EntityInteractEvent event) {
    final Block block = event.getBlock();

    // Confirms that the block is not null.
    if (block == null) {
        return;
    }

    final Location location = block.getLocation();

    if (!reinforcementManager.isWorldActive(location.getWorld().getName())) {
        return;
    }

    // If the affected block is soil, and it is reinforced, then the soil is not allowed to decay.
    if (Material.SOIL.equals(block.getType()) && reinforcementManager.isReinforced(location)) {
        event.setCancelled(true);
    }
}
 
开发者ID:MinerAp,项目名称:block-saver,代码行数:21,代码来源:GeneralListener.java

示例3: EntityFarmChecker

import org.bukkit.event.entity.EntityInteractEvent; //导入方法依赖的package包/类
@EventHandler
public void EntityFarmChecker(EntityInteractEvent event){
    if(ConfigFunction.ProtectFarmenable){
        if(event.getEntityType() != EntityType.PLAYER){
            Block block = event.getBlock();
            if(block.getType() == Material.SOIL||block.getType() == Material.CROPS){
                event.setCancelled(true);
            }
        }
    }
}
 
开发者ID:GelandiAssociation,项目名称:EscapeLag,代码行数:12,代码来源:FarmProtecter.java

示例4: onMobJump

import org.bukkit.event.entity.EntityInteractEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onMobJump(EntityInteractEvent e) {
	if (!cm.farmProtectEnabled) {
		return;
	}
	if (e.getEntityType() == EntityType.PLAYER) {
		return;
	}
	if (e.getBlock().getType() == Material.SOIL) {
		e.setCancelled(true);
	}
}
 
开发者ID:jiongjionger,项目名称:NeverLag,代码行数:13,代码来源:FarmProtecter.java

示例5: onEntityInteract

import org.bukkit.event.entity.EntityInteractEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onEntityInteract(EntityInteractEvent event)
{
	if(!GriefPrevention.instance.config_creaturesTrampleCrops && event.getBlock().getType() == Material.SOIL)
	{
		event.setCancelled(true);
	}
}
 
开发者ID:john01dav,项目名称:GriefPreventionPlus,代码行数:9,代码来源:EntityEventHandler.java

示例6: onEntityInteract

import org.bukkit.event.entity.EntityInteractEvent; //导入方法依赖的package包/类
@EventHandler
public void onEntityInteract(EntityInteractEvent event) {
    BlockProtection blockProtection = this.module.getProtectManager().getBlockProtection(event.getBlock().getLocation());
    if(blockProtection.exists()) {
        event.setCancelled(true);
    }
}
 
开发者ID:Steveice10,项目名称:Peacecraft,代码行数:8,代码来源:ProtectListener.java

示例7: OnEntityInteractEvent

import org.bukkit.event.entity.EntityInteractEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL)
public void OnEntityInteractEvent(EntityInteractEvent event) {
	if (event.getBlock() != null) {			
		if (CivSettings.switchItems.contains(event.getBlock().getType())) {
			coord.setFromLocation(event.getBlock().getLocation());
			TownChunk tc = CivGlobal.getTownChunk(coord);

			if (tc == null) {
				return;
			}

			/* A non-player entity is trying to trigger something, if interact permission is
			 * off for others then disallow it.
			 */
			if (tc.perms.interact.isPermitOthers()) {
				return;
			}

			if (event.getEntity() instanceof Player) {
				CivMessage.sendErrorNoRepeat((Player)event.getEntity(), "You do not have permission to interact here...");
			}

			event.setCancelled(true);
		}
	}

}
 
开发者ID:netizen539,项目名称:civcraft,代码行数:28,代码来源:BlockListener.java

示例8: onEntityInteract

import org.bukkit.event.entity.EntityInteractEvent; //导入方法依赖的package包/类
@EventHandler
public void onEntityInteract(EntityInteractEvent event){
	if(event.getBlock().getType() == Material.WOOD_BUTTON){
		if(event.getEntity() instanceof Arrow){
			Arrow a = (Arrow) event.getEntity();
			if(a.getShooter() instanceof Player){
				Player p = (Player) a.getShooter();
				if(!canBuild(p, event.getBlock())){
					event.setCancelled(true);
				}
			}
		}
		
	}
}
 
开发者ID:StarQuestMinecraft,项目名称:StarQuestCode,代码行数:16,代码来源:ButtonBlocker.java

示例9: onEntityInteractEvent

import org.bukkit.event.entity.EntityInteractEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onEntityInteractEvent(final ExtendedEntityInteractEvent ext) {
    final EntityInteractEvent event = (EntityInteractEvent)ext.getBaseEvent();
    if (event.getBlock().getType() == Material.SOIL) {
        if (ext.getRegion() != null && ext.getRegion().getFlag(Flag.FARM)) {
            event.setCancelled(true);
        }
    }
}
 
开发者ID:Ribesg,项目名称:NPlugins,代码行数:10,代码来源:FarmFlagListener.java

示例10: onInteract

import org.bukkit.event.entity.EntityInteractEvent; //导入方法依赖的package包/类
@EventHandler
public void onInteract(EntityInteractEvent e) {
	
	if(e.isCancelled()) {
		return;
	}
	
	if(e.getEntity() instanceof LivingEntity && e.getEntity().getType() != EntityType.PLAYER) {
		if(e.getBlock().getType() == Material.STONE_PLATE) {
			e.setCancelled(true);	
		}
	}
}
 
开发者ID:xEssentials,项目名称:xEssentials-deprecated-bukkit,代码行数:14,代码来源:EntityPressurePlateInteractEvent.java

示例11: onEntityInteract

import org.bukkit.event.entity.EntityInteractEvent; //导入方法依赖的package包/类
@EventHandler (priority = EventPriority.LOW, ignoreCancelled = true)
public void onEntityInteract(EntityInteractEvent event) {
    // Prevent trampling from other Entities
    final Material mat = event.getBlock().getType();
    final Entity entity = event.getEntity();
    //TODO: Placement source is generic, not limited to soil or soulsand
    if (entity instanceof LivingEntity && (mat == Material.SOIL || mat == Material.SOUL_SAND)) {
        event.setCancelled(true);
    }
}
 
开发者ID:AlmuraDev,项目名称:Sprout,代码行数:11,代码来源:SproutListener.java

示例12: onEntityInteract

import org.bukkit.event.entity.EntityInteractEvent; //导入方法依赖的package包/类
@EventHandler
public void onEntityInteract(EntityInteractEvent event) {
    if (event.getBlock().getType() == Material.SOIL)
        event.setCancelled(true);
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:6,代码来源:EnvironmentManager.java

示例13: onEntityInteractEvent

import org.bukkit.event.entity.EntityInteractEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void onEntityInteractEvent(EntityInteractEvent event) {
	if (!RuleNoBreak.RULE.check(event.getEntity())) return;
	event.setCancelled(true);
}
 
开发者ID:imfanhua,项目名称:Minecraft-UAPI,代码行数:6,代码来源:BreakListener.java

示例14: soilChangeEntity

import org.bukkit.event.entity.EntityInteractEvent; //导入方法依赖的package包/类
@EventHandler
public void soilChangeEntity(EntityInteractEvent event) {
	if (event.getEntityType() != EntityType.PLAYER && event.getBlock().getType().equals(Material.SOIL)) {
		event.setCancelled(true);
	}
}
 
开发者ID:caoli5288,项目名称:ProtectPlugin,代码行数:7,代码来源:AntiBreakFarm.java

示例15: onEntityInteract

import org.bukkit.event.entity.EntityInteractEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGH)
public void onEntityInteract(final EntityInteractEvent event) {
    if (Zones.inNoDemigodsZone(event.getEntity().getLocation()) || !(event.getEntity() instanceof Projectile) || DemigodsStructureType.Util.getInRadiusWithFlag(event.getBlock().getLocation(), DemigodsStructureType.Flag.NO_GRIEFING) == null)
        return;
    event.setCancelled(true);
}
 
开发者ID:DemigodsRPG,项目名称:Demigods3,代码行数:7,代码来源:GriefListener.java


注:本文中的org.bukkit.event.entity.EntityInteractEvent.setCancelled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。