本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}
}
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
}
示例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);
}
}
}
}
}
示例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);
}
}
}
示例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);
}
}
示例12: onEntityInteract
import org.bukkit.event.entity.EntityInteractEvent; //导入方法依赖的package包/类
@EventHandler
public void onEntityInteract(EntityInteractEvent event) {
if (event.getBlock().getType() == Material.SOIL)
event.setCancelled(true);
}
示例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);
}
示例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);
}
}
示例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);
}