예제 #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 + "\".");
    }
  }
예제 #2
0
  @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);
      }
    }
  }
예제 #3
0
  @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);
    }
  }
예제 #4
0
 private List<Spawn> getSpawnLocations(Player player) {
   if (Arcade.getMatches().getStatus() == ArcadeMatchStatus.RUNNING) {
     return player.getTeam().getSpawns();
   } else {
     return Arcade.getTeams().getObservers().getSpawns();
   }
 }
예제 #5
0
파일: Rate.java 프로젝트: ShootGame/Arcade
 public Rate(Player player, int rate) {
   super(
       UUID.randomUUID(),
       Arcade.getMaps().getCurrentMap(),
       player.getUUID(),
       rate,
       Servers.getOnline().getID(),
       System.currentTimeMillis());
   this.player = player;
 }
예제 #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;
 }