本文整理汇总了Java中org.bukkit.event.entity.EntityTargetLivingEntityEvent.setCancelled方法的典型用法代码示例。如果您正苦于以下问题:Java EntityTargetLivingEntityEvent.setCancelled方法的具体用法?Java EntityTargetLivingEntityEvent.setCancelled怎么用?Java EntityTargetLivingEntityEvent.setCancelled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.event.entity.EntityTargetLivingEntityEvent
的用法示例。
在下文中一共展示了EntityTargetLivingEntityEvent.setCancelled方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onTarget
import org.bukkit.event.entity.EntityTargetLivingEntityEvent; //导入方法依赖的package包/类
@EventHandler
public void onTarget(EntityTargetLivingEntityEvent event) {
if (!(event.getEntity() instanceof Tameable) || !(event.getEntity() instanceof LivingEntity)
|| event.getTarget() == null || !InventoryManager.isAllowedWorld(event.getTarget().getWorld())) {
return;
}
LivingEntity petEntity = (LivingEntity) event.getEntity();
final OfflinePlayer player = (OfflinePlayer) ((Tameable) petEntity).getOwner();
if (!InventoryManager.playerIsLoaded(player)) {
return;
}
PlayerWrapper playerWrapper = InventoryManager.get(player);
if (playerWrapper.hasPet() && petEntity == playerWrapper.getPet()) {
PetType petType = PetManager.getPetFromEntity(petEntity, player);
if (petType == null) {
return;
}
if (event.getTarget() != null && event.getTarget().getType() == EntityType.PLAYER) {
event.setCancelled(!petType.isAttackPlayers());
} else {
event.setCancelled(!petType.isAttackMobs());
}
}
}
示例2: onTargetWhenPlayerNotLoaded
import org.bukkit.event.entity.EntityTargetLivingEntityEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOW)
public void onTargetWhenPlayerNotLoaded(EntityTargetLivingEntityEvent event) {
if (event.getTarget() == null || event.getTarget().getType() != EntityType.PLAYER) {
return;
}
if (!InventoryManager.playerIsLoaded((Player) event.getTarget())) {
event.setCancelled(true);
}
}
示例3: onTarget
import org.bukkit.event.entity.EntityTargetLivingEntityEvent; //导入方法依赖的package包/类
@EventHandler
public void onTarget(EntityTargetLivingEntityEvent event)
{
if (event.getTarget() instanceof Player && event.getEntity().hasMetadata("Creator") && event.getEntity().getMetadata("Creator").get(0).asString() == ((Player) event.getTarget()).getName())
{
event.setCancelled(true);
}
}
示例4: onEntityTargetLivingEntity
import org.bukkit.event.entity.EntityTargetLivingEntityEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onEntityTargetLivingEntity(EntityTargetLivingEntityEvent event) {
LivingEntity livingEntity = event.getTarget();
if (livingEntity instanceof Player) {
Player player = (Player) livingEntity;
if (Ghosts.p.getGhostManager().isGhost(player)) {
event.setCancelled(true);
}
}
}
示例5: getZombieTarget
import org.bukkit.event.entity.EntityTargetLivingEntityEvent; //导入方法依赖的package包/类
@EventHandler
public void getZombieTarget(EntityTargetLivingEntityEvent e) {
if(e.getEntity() instanceof Zombie) {
if(e.getTarget() instanceof Player) {
if(e.getEntity().getLocation().distance(e.getTarget().getLocation()) > pl.getConfiguration().getEntityConfig().getCustomZombieAggroRange()) {
e.setCancelled(true);
}
}
}
}
示例6: onTarget
import org.bukkit.event.entity.EntityTargetLivingEntityEvent; //导入方法依赖的package包/类
@EventHandler
public void onTarget(EntityTargetLivingEntityEvent e) {
if(e.getTarget() instanceof Player) {
Player p = (Player) e.getTarget();
if(pl.getManagers().getPlayerManager().isOnline(p.getName())) {
XPlayer xp = pl.getManagers().getPlayerManager().getPlayer(p.getName());
if(xp.isInChair()) {
e.setCancelled(true);
}
}
}
}
示例7: isGodModeAfk
import org.bukkit.event.entity.EntityTargetLivingEntityEvent; //导入方法依赖的package包/类
@EventHandler
public void isGodModeAfk(EntityTargetLivingEntityEvent e) {
if(e.getTarget() instanceof Player) {
Player p = (Player) e.getTarget();
if(pl.getConfiguration().getPlayerConfig().isGodModeInAfkEnabled()) {
XPlayer xp = pl.getManagers().getPlayerManager().getPlayer(p.getName());
if(xp.isAfk()) {
e.setCancelled(true);
}
}
}
}
示例8: onTarget
import org.bukkit.event.entity.EntityTargetLivingEntityEvent; //导入方法依赖的package包/类
@EventHandler
public void onTarget(EntityTargetLivingEntityEvent e) {
if(e.getTarget() instanceof Player) {
Player p = (Player) e.getTarget();
if(pl.getManagers().getPlayerManager().isOnline(p.getName())) {
XPlayer xp = pl.getManagers().getPlayerManager().getPlayer(p.getName());
if(xp.isVanished()) {
e.setCancelled(true);
}
}
}
}
示例9: ignoremob
import org.bukkit.event.entity.EntityTargetLivingEntityEvent; //导入方法依赖的package包/类
@EventHandler
public void ignoremob(EntityTargetLivingEntityEvent e) {
if(e.getTarget() instanceof Player) {
Player p = (Player) e.getTarget();
if(vanishApi.isVanished(p)) {
e.setCancelled(true);
}
}
}
示例10: getZombieTarget
import org.bukkit.event.entity.EntityTargetLivingEntityEvent; //导入方法依赖的package包/类
@EventHandler
public void getZombieTarget(EntityTargetLivingEntityEvent e) {
if(e.getEntity() instanceof Zombie) {
if(e.getTarget() instanceof Player) {
if(e.getEntity().getLocation().distance(e.getTarget().getLocation()) > xEssentialsMemory.zombieRange) {
e.setCancelled(true);
}
}
}
}
示例11: GodModeAfk
import org.bukkit.event.entity.EntityTargetLivingEntityEvent; //导入方法依赖的package包/类
@EventHandler
public void GodModeAfk(EntityTargetLivingEntityEvent e) {
if(xEssentialsMemory.playerGodmodeAfk) {
if(e.getTarget() instanceof Player) {
Player p = (Player) e.getTarget();
if(afkList.contains(p.getName())) {
e.setCancelled(true);
}
}
}
}
示例12: onEntityTarget
import org.bukkit.event.entity.EntityTargetLivingEntityEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onEntityTarget(final EntityTargetLivingEntityEvent event) {
if (event.getTarget().getType() == EntityType.PLAYER && this.loggedOutPlayers.containsKey(event.getTarget().getUniqueId())) {
event.setCancelled(true);
}
}