Exemple #1
0
  @Override
  public void execute(Sender sender, String[] args) throws CommandException {
    Player player = (Player) sender;

    if (args[0].equals("-k")) {
      int i = 0;
      Iterator<Entity> it = new ArrayList<>(BukkitLocation.getWorld().getEntities()).iterator();

      while (it.hasNext()) {
        Entity entity = it.next();

        if (entity instanceof ArmorStand
            && this.matchLocation(entity.getLocation(), player.getLocation())) {
          entity.remove();
          i++;
        }
      }

      if (i == 0) {
        player.sendError("Brak hologramów w tej lokalizacji.");
      } else {
        player.sendSuccess("Usunieto " + i + " hologramów.");
      }
    } else {
      String value = Color.translate(StringUtils.join(args, ' ')) + Color.RESET;

      Hologram hologram = Holograms.create((player).getLocation());
      hologram.setHologram(value);
      hologram.update();

      player.sendSuccess("Stworzono hologram \"" + value + Color.GREEN + "\".");
    }
  }
  @EventHandler
  public void onEntityDamageByEntity(EntityDamageByEntityEvent e) {
    if (e.getEntity() instanceof org.bukkit.entity.Player) {
      Player entity = Arcade.getServer().getPlayer(e.getEntity().getUniqueId());
      if (!entity.getTeam().isFrendlyFire()) {
        return;
      }
      Player damager = null;
      Projectile projectile = null;

      if (e.getDamager() instanceof org.bukkit.entity.Player) { // Player vs player direct
        damager = Arcade.getServer().getPlayer(e.getDamager().getUniqueId());
      } else if (e.getDamager() instanceof Projectile
          && ((Projectile) e.getDamager()).getShooter()
              instanceof org.bukkit.entity.Player) { // Arrows, snowballs, etc...
        projectile = (Projectile) e.getDamager();
        damager =
            Arcade.getServer()
                .getPlayer(((org.bukkit.entity.Player) projectile.getShooter()).getUniqueId());
      }

      if (damager != null && entity.getTeam().equals(damager.getTeam())) {
        e.setCancelled(true);
      }
      if (projectile != null) {
        projectile.setBounce(true);
      }
    }
  }
  @EventHandler
  public void onAsyncPlayerChatEvent(AsyncPlayerChatEvent e) {
    e.setCancelled(true);
    String message = e.getMessage();
    Player player = Arcade.getServer().getPlayer(e.getPlayer().getUniqueId());
    ArcadeMatchStatus matchStatus = Arcade.getMatches().getStatus();

    if (matchStatus != ArcadeMatchStatus.RUNNING || Arcade.getTeams().getTeams().size() == 1) {
      Arcade.getTeams().getObservers().getChat().sendMessage(player, message);
    } else {
      player.getTeam().getChat().sendMessage(player, message);
    }
  }
 private List<Spawn> getSpawnLocations(Player player) {
   if (Arcade.getMatches().getStatus() == ArcadeMatchStatus.RUNNING) {
     return player.getTeam().getSpawns();
   } else {
     return Arcade.getTeams().getObservers().getSpawns();
   }
 }
Exemple #5
0
 public Rate(Player player, int rate) {
   super(
       UUID.randomUUID(),
       Arcade.getMaps().getCurrentMap(),
       player.getUUID(),
       rate,
       Servers.getOnline().getID(),
       System.currentTimeMillis());
   this.player = player;
 }
Exemple #6
0
 @Override
 public boolean canInteract(Player player, Material item) {
   if (!player.isTeam(this.getOwner())) {
     if (this.getAllowed().isEmpty()) {
       return false;
     }
     for (Block v : this.getAllowed()) {
       if (v.getMaterial().asString().equals(item.asString())) {
         return false;
       }
     }
   }
   return true;
 }