本文整理汇总了Java中org.bukkit.event.entity.EntityInteractEvent类的典型用法代码示例。如果您正苦于以下问题:Java EntityInteractEvent类的具体用法?Java EntityInteractEvent怎么用?Java EntityInteractEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EntityInteractEvent类属于org.bukkit.event.entity包,在下文中一共展示了EntityInteractEvent类的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: entityInteractEvent
import org.bukkit.event.entity.EntityInteractEvent; //导入依赖的package包/类
@EventHandler
public void entityInteractEvent (EntityInteractEvent event) {
System.out.println("An entity has interacted with something.");
System.out.println("The block is " + event.getBlock().getType().name().toString() + ".");
if (event.getBlock().getType() == Material.STONE_PLATE) {
Block b = event.getBlock();
if (!(getMinePlacer(b) == null)) {
System.out.println("Mine will now be explodified.");
explodeMine(b, event.getEntity(), 5);
}
}
}
示例10: 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);
}
}
}
示例11: 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
示例12: shouldHandleSimpleEvents
import org.bukkit.event.entity.EntityInteractEvent; //导入依赖的package包/类
@Test
public void shouldHandleSimpleEvents() {
withServiceMock(listenerService)
.check(listener::onEntityTarget, EntityTargetEvent.class)
.check(listener::onFoodLevelChange, FoodLevelChangeEvent.class)
.check(listener::onShoot, EntityShootBowEvent.class)
.check(listener::onEntityInteract, EntityInteractEvent.class)
.check(listener::onLowestEntityInteract, EntityInteractEvent.class);
}
示例13: 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);
}
}
示例14: onEntityInteract
import org.bukkit.event.entity.EntityInteractEvent; //导入依赖的package包/类
@EventHandler
public void onEntityInteract(EntityInteractEvent event) {
if (event.getBlock().getType() == Material.SOIL)
event.setCancelled(true);
}
示例15: onEntityEvent
import org.bukkit.event.entity.EntityInteractEvent; //导入依赖的package包/类
@EventHandler
public void onEntityEvent(EntityInteractEvent e) {
RedProtect.get().logger.debug("RPEntityListener - Is EntityInteractEvent");
}