Java Code Examples for org.bukkit.entity.Entity#sendMessage()
The following examples show how to use
org.bukkit.entity.Entity#sendMessage() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HealEffect.java From Civs with GNU General Public License v3.0 | 6 votes |
public boolean meetsRequirement() { Object target = getTarget(); Entity origin = getOrigin(); if (!(target instanceof LivingEntity)) { if (!this.silent && origin instanceof Player) { ((Player) origin).sendMessage(ChatColor.RED + Civs.getPrefix() + " target cant't be healed."); } return false; } LivingEntity livingEntity = (LivingEntity) target; if (livingEntity.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue() - livingEntity.getHealth() < this.heal) { if (!this.silent && origin instanceof Player) { origin.sendMessage(ChatColor.RED + Civs.getPrefix() + " already has enough health."); } return false; } return true; }
Example 2
Source File: SafeSpotTeleport.java From askyblock with GNU General Public License v2.0 | 6 votes |
private void tidyUp(Entity entity, String failureMessage) { // Nothing left to check and still not canceled task.cancel(); // Check portal if (portal && bestSpot != null) { // No portals found, teleport to the best spot we found teleportEntity(bestSpot); } else if (entity instanceof Player && !failureMessage.isEmpty()) { // Failed, no safe spot entity.sendMessage(failureMessage); } if (entity instanceof Player && (plugin.getServer().getVersion().contains("1.7") || ((Player)entity).getGameMode().equals(GameMode.SPECTATOR))) { ((Player)entity).setGameMode(GameMode.SURVIVAL); } if (entity instanceof Player) { plugin.getPlayers().setInTeleport(entity.getUniqueId(), false); } }
Example 3
Source File: Shuffle.java From ce with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void effect(Event e, ItemStack item, final int level) { if(e instanceof EntityDamageByEntityEvent) { EntityDamageByEntityEvent event = (EntityDamageByEntityEvent) e; Entity target = event.getEntity(); Player p = (Player) ((Projectile) event.getDamager()).getShooter(); if(target.getEntityId() == p.getEntityId()) return; Location pLoc = p.getLocation(); Location tLoc = target.getLocation(); target.teleport(pLoc); p.teleport(tLoc); EffectManager.playSound(tLoc, "ENTITY_ENDERMAN_TELEPORT", 0.4f, 2f); EffectManager.playSound(pLoc, "ENTITY_ENDERMAN_TELEPORT", 0.4f, 2f); for(int i = 10; i>0; i--) { p.getWorld().playEffect(tLoc, Effect.ENDER_SIGNAL, 10); p.getWorld().playEffect(pLoc, Effect.ENDER_SIGNAL, 10); } if(target instanceof Player) { p.sendMessage(ChatColor.DARK_PURPLE + "You have switched positions with " + target.getName() + "!"); target.sendMessage(ChatColor.DARK_PURPLE + "You have switched positions with " + p.getName() + "!"); } } }