本文整理汇总了Java中org.bukkit.event.entity.PotionSplashEvent.setIntensity方法的典型用法代码示例。如果您正苦于以下问题:Java PotionSplashEvent.setIntensity方法的具体用法?Java PotionSplashEvent.setIntensity怎么用?Java PotionSplashEvent.setIntensity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.event.entity.PotionSplashEvent
的用法示例。
在下文中一共展示了PotionSplashEvent.setIntensity方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPotionSplash
import org.bukkit.event.entity.PotionSplashEvent; //导入方法依赖的package包/类
@EventHandler
public void onPotionSplash(PotionSplashEvent event) {
boolean proceed = false;
for (PotionEffect effect : event.getPotion().getEffects()) {
if (effect.getType().equals(PotionEffectType.POISON) || effect.getType().equals(PotionEffectType.BLINDNESS) ||
effect.getType().equals(PotionEffectType.CONFUSION) || effect.getType().equals(PotionEffectType.HARM) ||
effect.getType().equals(PotionEffectType.HUNGER) || effect.getType().equals(PotionEffectType.SLOW) ||
effect.getType().equals(PotionEffectType.SLOW_DIGGING) || effect.getType().equals(PotionEffectType.WITHER) ||
effect.getType().equals(PotionEffectType.WEAKNESS)) {
proceed = true;
}
}
if (proceed && event.getPotion().getShooter() instanceof Player && TeamManager.getTeamByPlayer((Player) event.getPotion().getShooter()) != null) {
TeamModule team = TeamManager.getTeamByPlayer((Player) event.getPotion().getShooter());
for (LivingEntity affected : event.getAffectedEntities()) {
if (affected instanceof Player && TeamManager.getTeamByPlayer((Player) affected) != null && TeamManager.getTeamByPlayer((Player) affected).equals(team) && !affected.equals(event.getPotion().getShooter())) {
event.setIntensity(affected, 0);
}
}
}
}
示例2: onPlayerSplashedByPotion
import org.bukkit.event.entity.PotionSplashEvent; //导入方法依赖的package包/类
@Override
public void onPlayerSplashedByPotion(PotionSplashEvent event, BPPlayer bpShooter, BPPlayer bpTarget)
{
CTFProperties targetProps = (CTFProperties) bpTarget.getGameProperties();
Player target = bpTarget.getPlayer();
CTFGame game = getGame();
if(targetProps.isEnemy(bpShooter) && !game.hasRoundEnded())
{
if(targetProps.hasSpawnProtection())
{
Player shooter = bpShooter.getPlayer();
shooter.sendMessage(MessageType.PVP_SPAWNKILLING.getTranslation().getValue());
event.setIntensity(target, 0);
}
}
else
event.setIntensity(target, 0);
}
示例3: onPotionSplash
import org.bukkit.event.entity.PotionSplashEvent; //导入方法依赖的package包/类
@EventHandler
public void onPotionSplash(PotionSplashEvent event) {
boolean proceed = false;
for (PotionEffect effect : event.getPotion().getEffects()) {
if (effect.getType().equals(PotionEffectType.POISON) || effect.getType().equals(PotionEffectType.BLINDNESS) ||
effect.getType().equals(PotionEffectType.CONFUSION) || effect.getType().equals(PotionEffectType.HARM) ||
effect.getType().equals(PotionEffectType.HUNGER) || effect.getType().equals(PotionEffectType.SLOW) ||
effect.getType().equals(PotionEffectType.SLOW_DIGGING) || effect.getType().equals(PotionEffectType.WITHER) ||
effect.getType().equals(PotionEffectType.WEAKNESS)) {
proceed = true;
}
}
if (proceed && event.getPotion().getShooter() instanceof Player && TeamUtils.getTeamByPlayer((Player) event.getPotion().getShooter()) != null) {
TeamModule team = TeamUtils.getTeamByPlayer((Player) event.getPotion().getShooter());
for (LivingEntity affected : event.getAffectedEntities()) {
if (affected instanceof Player && TeamUtils.getTeamByPlayer((Player) affected) != null && TeamUtils.getTeamByPlayer((Player) affected) == team && !affected.equals((Player) event.getPotion().getShooter())) {
event.setIntensity(affected, 0);
}
}
}
}
示例4: onPotionSplash
import org.bukkit.event.entity.PotionSplashEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPotionSplash(PotionSplashEvent event) {
ThrownPotion damager = event.getPotion();
Location l = BukkitUtil.getLocation(damager);
if (!PS.get().hasPlotArea(l.getWorld())) {
return;
}
int count = 0;
for (LivingEntity victim : event.getAffectedEntities()) {
if (!entityDamage(damager, victim)) {
event.setIntensity(victim, 0);
count++;
}
}
if ((count > 0 && count == event.getAffectedEntities().size()) || !onProjectileHit(event)) {
event.setCancelled(true);
}
}
示例5: onPotionSplash
import org.bukkit.event.entity.PotionSplashEvent; //导入方法依赖的package包/类
@EventHandler
public void onPotionSplash(PotionSplashEvent event) {
boolean proceed = false;
for (PotionEffect effect : event.getPotion().getEffects()) {
if (effect.getType().equals(PotionEffectType.POISON) || effect.getType().equals(PotionEffectType.BLINDNESS) ||
effect.getType().equals(PotionEffectType.CONFUSION) || effect.getType().equals(PotionEffectType.HARM) ||
effect.getType().equals(PotionEffectType.HUNGER) || effect.getType().equals(PotionEffectType.SLOW) ||
effect.getType().equals(PotionEffectType.SLOW_DIGGING) || effect.getType().equals(PotionEffectType.WITHER) ||
effect.getType().equals(PotionEffectType.WEAKNESS)) {
proceed = true;
}
}
if (proceed && event.getPotion().getShooter() instanceof Player && Teams.getTeamByPlayer((Player) event.getPotion().getShooter()) != null) {
Optional<TeamModule> team = Teams.getTeamByPlayer((Player) event.getPotion().getShooter());
for (LivingEntity affected : event.getAffectedEntities()) {
if (affected instanceof Player && Teams.getTeamByPlayer((Player) affected) != null && Teams.getTeamByPlayer((Player) affected).equals(team) && !affected.equals(event.getPotion().getShooter())) {
event.setIntensity(affected, 0);
}
}
}
}
示例6: onPotionSplash
import org.bukkit.event.entity.PotionSplashEvent; //导入方法依赖的package包/类
@EventHandler
public void onPotionSplash(PotionSplashEvent event) {
ThrownPotion potion = event.getEntity();
boolean harms = canHarm(potion);
if (event.getEntity().getShooter() instanceof Player && disabledPlayers.contains((Player) event.getEntity().getShooter()) && harms) {
event.setCancelled(true);
((Player) event.getEntity().getShooter()).sendMessage(ChatColor.DARK_RED + "You cannot harm other players with PvP off!");
return;
}
boolean cancellations = false;
boolean everyone = true;
for (LivingEntity e : event.getAffectedEntities()) {
if (e instanceof Player && harms && disabledPlayers.contains((Player) e)) {
event.setIntensity(e, 0.0);
cancellations = true;
} else {
everyone = false;
}
}
if (everyone) {
event.setCancelled(true);
((Player) event.getEntity().getShooter()).sendMessage(ChatColor.LIGHT_PURPLE + "All targets of your splash potion has PvP disabled.");
} else if (cancellations) {
((Player) event.getEntity().getShooter()).sendMessage(ChatColor.LIGHT_PURPLE + "Your splash potion's effects have been nullified on targets with PvP disabled.");
}
}
示例7: onPotionSplash
import org.bukkit.event.entity.PotionSplashEvent; //导入方法依赖的package包/类
/**
* Handle PotionSplashEvent events that involve modifying the event.
*
* @param event The event to modify
*/
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPotionSplash(PotionSplashEvent event) {
ProjectileSource shooter = event.getPotion().getShooter();
if (!(shooter instanceof Player)) {
return;
}
Player player = (Player) shooter;
for (LivingEntity entity : event.getAffectedEntities()) {
if (!(entity instanceof Player) || player == entity) {
continue;
}
if (Ghosts.p.getGhostManager().isGhost(player)) {
event.setIntensity(entity, 0);
}
}
}
示例8: onPotionSplash
import org.bukkit.event.entity.PotionSplashEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPotionSplash(final PotionSplashEvent event) {
for(LivingEntity entity : event.getAffectedEntities()) {
if(!getMatch().canInteract(entity)) {
event.setIntensity(entity, 0);
}
}
}
示例9: onPotionSplash
import org.bukkit.event.entity.PotionSplashEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true)
public void onPotionSplash(final PotionSplashEvent event) {
final ThrownPotion potion = event.getPotion();
if(PotionClassification.classify(potion) != PotionClassification.HARMFUL) return;
for(LivingEntity victim : event.getAffectedEntities()) {
final ParticipantState victimState = getMatch().getParticipantState(victim);
final DamageInfo damageInfo = damageResolver.resolveDamage(EntityDamageEvent.DamageCause.MAGIC, victim, potion);
if(victimState != null && queryDamage(event, victimState, damageInfo).isDenied()) {
event.setIntensity(victim, 0);
}
}
}
示例10: onPotionSplash
import org.bukkit.event.entity.PotionSplashEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL)
public void onPotionSplash(PotionSplashEvent event) {
ThrownPotion potion = event.getPotion();
if (potion.getShooter() instanceof Player && BukkitUtils.isDebuff(potion)) {
for (LivingEntity livingEntity : event.getAffectedEntities()) {
if (livingEntity instanceof Player) {
if (getRemaining((Player) livingEntity) > 0L) {
event.setIntensity(livingEntity, 0);
}
}
}
}
}
示例11: onPotionSplash
import org.bukkit.event.entity.PotionSplashEvent; //导入方法依赖的package包/类
@EventHandler
public void onPotionSplash(final PotionSplashEvent event) {
if (event.getEntity().getShooter() instanceof Player) {
final Player shooter = (Player) event.getEntity().getShooter();
if (shooter.isSprinting() && event.getIntensity(shooter) > 0.5D) {
event.setIntensity(shooter, 1.0D);
}
}
}
示例12: blockFriendlyFirePotions
import org.bukkit.event.entity.PotionSplashEvent; //导入方法依赖的package包/类
/**
* Stop negative effect splash potions from hurting a player's own team
*/
@EventHandler(priority = EventPriority.LOW)
public void blockFriendlyFirePotions(PotionSplashEvent event) {
Set<PotionEffectType> blacklist = new HashSet<>();
blacklist.add(PotionEffectType.HARM);
blacklist.add(PotionEffectType.POISON);
blacklist.add(PotionEffectType.WEAKNESS);
blacklist.add(PotionEffectType.SLOW);
blacklist.add(PotionEffectType.INVISIBILITY);
if (!(event.getPotion().getShooter() instanceof Player)) return;
Player damager = (Player) event.getPotion().getShooter();
Arena arena = plugin.getArenaHandler().getArenaForPlayer(damager);
if (arena != null) {
Team dTeam = PlayerUtil.getTeamForPlayer(arena.getMatch(), damager);
for (LivingEntity ent : event.getAffectedEntities()) {
if (!(ent instanceof Player)) continue;
if (dTeam == PlayerUtil.getTeamForPlayer(arena.getMatch(), (Player) ent)) {
for (PotionEffect effect : event.getPotion().getEffects()) {
if (blacklist.contains(effect.getType())) event.setIntensity(ent, 0);
}
}
}
}
}
示例13: onPotionSplash
import org.bukkit.event.entity.PotionSplashEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onPotionSplash(PotionSplashEvent event) {
for (LivingEntity entity : event.getAffectedEntities()) {
if (this.isObserving(entity)) {
event.setIntensity(entity, 0.0D);
}
}
}
示例14: onPlayerSplashedByPotion
import org.bukkit.event.entity.PotionSplashEvent; //导入方法依赖的package包/类
@Override
public void onPlayerSplashedByPotion(PotionSplashEvent event, BPPlayer bpShooter, BPPlayer bpVictim)
{
DMGame game = getGame();
if(game.hasRoundEnded())
event.setIntensity(bpVictim.getPlayer(), 0);
if(bpVictim.equals(bpShooter))
event.setIntensity(bpVictim.getPlayer(), 0);
}
示例15: onPotionSplash
import org.bukkit.event.entity.PotionSplashEvent; //导入方法依赖的package包/类
@EventHandler
public void onPotionSplash(PotionSplashEvent event)
{
ThrownPotion ePotion = event.getPotion();
Entity eShooter = ePotion.getShooter();
if (eShooter instanceof Player)
{
Player shooter = (Player) eShooter;
BPPlayer bpShooter = BPPlayer.get(shooter);
if (bpShooter.isInGame())
{
Game game = bpShooter.getGame();
for (LivingEntity eTarget : event.getAffectedEntities())
if (eTarget instanceof Player)
{
Player target = (Player) eTarget;
BPPlayer bpTarget = BPPlayer.get(target);
if (bpTarget.isInGameWith(bpShooter))
game.getListener().onPlayerSplashedByPotion(event, bpShooter, bpTarget);
else
event.setIntensity(eTarget, 0);
}
else
event.setIntensity(eTarget, 0);
}
else
event.setCancelled(true);
}
else
event.setCancelled(true);
}