本文整理汇总了Java中org.bukkit.entity.Snowball.getShooter方法的典型用法代码示例。如果您正苦于以下问题:Java Snowball.getShooter方法的具体用法?Java Snowball.getShooter怎么用?Java Snowball.getShooter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.entity.Snowball
的用法示例。
在下文中一共展示了Snowball.getShooter方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: projectilehit
import org.bukkit.entity.Snowball; //导入方法依赖的package包/类
@EventHandler
public void projectilehit(EntityDamageByEntityEvent e){
if((e.getEntity() instanceof Player) && (e.getDamager() instanceof Snowball)){
Player hitp = (Player) e.getEntity();
if(GadgetManager.isImmune(hitp.getName())){
Snowball s = (Snowball) e.getDamager();
Player shooter = (Player) s.getShooter();
shooter.sendMessage(ChatColor.BLUE + "Hub > "
+ ChatColor.GRAY + "Player " + ChatColor.RED + hitp.getName() + ChatColor.GRAY
+ " is not playing hub games!");
return;
}
if(hit.contains(hitp.getName()))
return;
doSnowBallHit(hitp);
}
}
示例2: onProjectileHit
import org.bukkit.entity.Snowball; //导入方法依赖的package包/类
@EventHandler
public void onProjectileHit(ProjectileHitEvent event) {
Entity entity = event.getEntity();
// Config
float size = plugin.getConfig().getInt("Size of Explosion");
boolean damage = plugin.getConfig().getBoolean("Block Damage");
boolean fire = plugin.getConfig().getBoolean("Set Fire");
if (entity instanceof Snowball) {
Snowball snowball = (Snowball) entity;
Entity shooter = snowball.getShooter();
if (shooter instanceof Player) {
Player player = (Player) shooter;
Location sb = snowball.getLocation();
if (plugin.players.contains(player.getName())) {
player.getWorld().createExplosion(sb.getX(), sb.getY(),
sb.getZ(), size, fire, damage);
}
}
}
}
示例3: onDamage
import org.bukkit.entity.Snowball; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST)
public void onDamage(EntityDamageByEntityEvent event) {
// 处理实体受伤是实体所为事件
Entity entity = event.getEntity();
Entity damager = event.getDamager();
if(damager instanceof Snowball) {
Snowball snowball = (Snowball) damager;
if(snowball.getShooter() instanceof Player) {
event.setDamage(10d);
}
}
}
示例4: onProjectileThrownEvent
import org.bukkit.entity.Snowball; //导入方法依赖的package包/类
@EventHandler
public void onProjectileThrownEvent(ProjectileLaunchEvent e) {
if((e.getEntity() instanceof Snowball)){
Snowball snowball = (Snowball) e.getEntity();
if(!(snowball.getShooter() instanceof Player)) return;
snowballs.get(snowball.getShooter()).addSnowball(snowball);
}
else if (e.getEntity() instanceof Arrow) {
Arrow a = (Arrow) e.getEntity();
if(!(a.getShooter() instanceof Player)) return;
arrows.add(a);
}
return;
}
示例5: onTP
import org.bukkit.entity.Snowball; //导入方法依赖的package包/类
@EventHandler
public void onTP(ProjectileHitEvent e){
Projectile proj = e.getEntity();
if(this.getConfig().getBoolean("teleporting-snowballs") == true){
if(proj instanceof Snowball){
Snowball sb = (Snowball) proj;
if(sb.getShooter() instanceof Player){
LivingEntity p = (Player) sb.getShooter();
p.teleport(sb);
}
}
}
}
示例6: onSnowballHit
import org.bukkit.entity.Snowball; //导入方法依赖的package包/类
@EventHandler(priority=EventPriority.LOW)
public void onSnowballHit(EntityDamageByEntityEvent event) {
if (event.getDamager() instanceof org.bukkit.entity.Snowball && event.getEntity() instanceof Player) {
Snowball ball = (Snowball) event.getDamager();
if (ball.getShooter() instanceof Player) {
Player player = (Player) ball.getShooter();
if (isFiring.contains(player.getName()))
event.setDamage(RodsTwo.getInstance().rodConfig.getInt(getPath("options.damage_per_shot")));
}
}
}
示例7: onEntityDamage
import org.bukkit.entity.Snowball; //导入方法依赖的package包/类
@EventHandler
public void onEntityDamage(EntityDamageByEntityEvent e) {
if (e.getEntity() instanceof Player && e.getDamager() instanceof Snowball) {
Player p = (Player) e.getEntity();
Snowball s = (Snowball) e.getDamager();
if (!(s.getShooter() instanceof Player)) return;
Player shooter = (Player) s.getShooter();
if (ArenaManager.getInstance().getArena(p) == null && ArenaManager.getInstance().getArena(shooter) == null) return;
Arena a = ArenaManager.getInstance().getArena(p);
if (a.getTeam(p) == a.getTeam(shooter)) return;
p.damage(5.0);
}
}
示例8: onEntityDamage
import org.bukkit.entity.Snowball; //导入方法依赖的package包/类
@EventHandler
public void onEntityDamage(EntityDamageByEntityEvent e) {
if (e.getEntity() instanceof Player && e.getDamager() instanceof Snowball) {
Player p = (Player) e.getEntity();
Snowball s = (Snowball) e.getDamager();
if (!(s.getShooter() instanceof Player)) return;
Player shooter = (Player) s.getShooter();
if (ArenaManager.getInstance().getArena(p) == null && ArenaManager.getInstance().getArena(shooter) == null) return;
Arena a = ArenaManager.getInstance().getArena(p);
if (a.getTeam(p) == a.getTeam(shooter)) return;
p.damage(5.0);
}
}
示例9: onSnowballHit
import org.bukkit.entity.Snowball; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@EventHandler
public void onSnowballHit(ProjectileHitEvent e) {
// If it's a snowball...
if (e.getEntity() instanceof Snowball) {
Snowball snowball = (Snowball) e.getEntity();
// ...if a player threw it...
if (snowball.getShooter() instanceof Player) {
// Make a Player from the Entity
Player shooter = (Player) snowball.getShooter();
// ...if the player is in a game...
if (shooter.hasMetadata("team")) {
// Loop through the games
for (Entry<String, PaintWarGame> e1 : games.entrySet()) {
// Make a game
PaintWarGame game = e1.getValue();
// If the Player is in this game...
if (game.IsInGame(shooter)) {
// Make a WE selection
CuboidSelection s = new CuboidSelection(game.GetWorld(), game.GetMinLocationLoc(),
game.GetMaxLocationLoc());
// This is used to find the right block
BlockIterator iterator = new BlockIterator(e.getEntity().getWorld(),
e.getEntity().getLocation().toVector(), e.getEntity().getVelocity().normalize(),
0.0D, 4);
// Make a block
Block hitBlock = null;
// Loop through possible blocks
while (iterator.hasNext()) {
// Set the hitBlock to the current block we're
// checking
hitBlock = iterator.next();
// If it's not air, STOP!
if (!hitBlock.getType().equals(Material.AIR)) {
break;
}
}
// If the block is on the ground of the WE
// selection...
if (s.contains(hitBlock.getLocation())
&& hitBlock.getLocation().getY() == s.getMinimumPoint().getY()) {
// Set it to stained clay
hitBlock.setType(Material.STAINED_CLAY);
// red = 14, blue = 11 (data values)
// Change block to team color
if (shooter.getMetadata("team").get(0).asString().equalsIgnoreCase("red")) {
// Red
hitBlock.setData((byte) 14);
game.AddScore("red", hitBlock.getLocation());
} else if (shooter.getMetadata("team").get(0).asString().equalsIgnoreCase("blue")) {
// Blue
hitBlock.setData((byte) 11);
game.AddScore("blue", hitBlock.getLocation());
}
}
}
}
}
}
}
}
示例10: onSnowballHit
import org.bukkit.entity.Snowball; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@EventHandler
public void onSnowballHit(EntityDamageByEntityEvent e){
if(snowballDamage <= 0){
return;
}
if(e.getDamager().getType() == EntityType.SNOWBALL){
Snowball s = (Snowball) e.getDamager();
if(s.getShooter() instanceof Player){
if(e.getEntity() instanceof LivingEntity){
LivingEntity victim = (LivingEntity) e.getEntity();
victim.damage(snowballDamage , s.getShooter());
e.setDamage(0);
e.setCancelled(true);
}
}
}
}