Хостинг серверов Minecraft playvds.com
  1. Вы находитесь в русском сообществе Bukkit. Мы - администраторы серверов Minecraft, разрабатываем собственные плагины и переводим на русский язык плагины наших собратьев из других стран.
    Dismiss Notice

Помогите Откидывание

Discussion in 'Разработка плагинов для новичков' started by sasha2003, May 10, 2017.

  1. Автор темы
    sasha2003

    sasha2003 Активный участник Пользователь

    Trophy Points:
    76
    Мне нужно, чтобы при вводе команды у меня включилось <<Силовое поле>> и игроки начали откидываться от меня.
    Мне нужно только само откидывание?
     
  2. Хостинг MineCraft
    <
  3. TheZefirrkka

    TheZefirrkka Активный участник Пользователь

    Trophy Points:
    76
    Skype:
    RomaMamkinHasker1337
    Имя в Minecraft:
    TheZefirrkka
    Эм.. У себя спроси.
     
  4. N0Trix

    N0Trix Активный участник Пользователь

    Trophy Points:
    46
    Skype:
    dimasikus.dddss
    Имя в Minecraft:
    N0Trix
    Себя спроси что-ли
     
    Last edited: May 10, 2017
  5. Автор темы
    sasha2003

    sasha2003 Активный участник Пользователь

    Trophy Points:
    76
    Без "?"))
     
  6. iD3LSY

    iD3LSY Активный участник Пользователь

    Trophy Points:
    46
    Имя в Minecraft:
    opy
    Да не, нормально все, тебе просто кажется)
     
  7. DonDays

    DonDays Активный участник Пользователь

    Trophy Points:
    96
    Имя в Minecraft:
    DonDays
    player.setVelcotity(new Vector(x, y, z));
     
  8. Автор темы
    sasha2003

    sasha2003 Активный участник Пользователь

    Trophy Points:
    76
    А как сделать, чтобы откидывало от меня, если игрок в 7 блоках от меня!
     
    Last edited: May 11, 2017
  9. TheZefirrkka

    TheZefirrkka Активный участник Пользователь

    Trophy Points:
    76
    Skype:
    RomaMamkinHasker1337
    Имя в Minecraft:
    TheZefirrkka
    Проверяй игроков рядом, getNearbyEntities
     
  10. Автор темы
    sasha2003

    sasha2003 Активный участник Пользователь

    Trophy Points:
    76
    Code:
    public static boolean isInRadius(Player player, Player target, double radius) {
            if(!target.getLocation().getWorld().equals(player.getLocation().getWorld())) {
                return false;
            }
            return player.getLocation().distanceSquared(target.getLocation()) <= (radius * radius);
        }
    Code:
    Collection<? extends Player> online = Bukkit.getOnlinePlayers();
                   
                    if (isInRadius(p, (Player) online, 7)) {
                       
                    }
    Правильно?
     
  11. xDark

    xDark Активный участник Пользователь

    Trophy Points:
    96
    Skype:
    ailyashevich
    Имя в Minecraft:
    xDark
    Нет
     
  12. Автор темы
    sasha2003

    sasha2003 Активный участник Пользователь

    Trophy Points:
    76
    Я уже понял[DOUBLEPOST=1494527381,1494525427][/DOUBLEPOST]
    Code:
      public void run()
      {
        for (Player player : Bukkit.getServer().getOnlinePlayers()) {
          if (this.m.contains(player)) {
            for (Player player2 : Bukkit.getServer().getOnlinePlayers()) {
              if (!player.equals(player2)) {
                if (a(player2, player) <= this.e)
                {
                  if (player2.getGameMode() == GameMode.SPECTATOR) {
                    return;
                  }
                  if (player2.hasPermission(this.a)) {
                    return;
                  }
                  for (Object vehicle = player2; ((Entity)vehicle).getVehicle() != null; vehicle = ((Entity)vehicle).getVehicle()) {}
                  a((Entity)vehicle, b(player, (Entity)vehicle), 1.6D, true, 0.8D, 0.0D, 10.0D);
                  if (!this.i) {
                    return;
                  }
                  player2.getWorld().playSound(player2.getLocation(), Sound.valueOf(this.j), (float)this.k, (float)this.l);
                }
              }
            }
          }
        }
      }
    
      public double a(Entity entity, Entity entity2)
      {
        return entity.getLocation().toVector().subtract(entity2.getLocation().toVector()).length();
      }
    
      public Vector b(Entity entity, Entity entity2)
      {
        return entity2.getLocation().toVector().subtract(entity.getLocation().toVector()).setY(0).normalize();
      }
    
      public void a(Entity entity, Vector velocity, double n, boolean b, double y, double n2, double y2)
      {
        if ((Double.isNaN(velocity.getX())) || (Double.isNaN(velocity.getY())) || (Double.isNaN(velocity.getZ())) || (velocity.length() == 0.0D)) {
          return;
        }
        if (b) {
          velocity.setY(y);
        }
        velocity.normalize();
        velocity.multiply(n);
        velocity.setY(velocity.getY() + n2);
        if (velocity.getY() > y2) {
          velocity.setY(y2);
        }
        entity.setFallDistance(0.0F);
        entity.setVelocity(velocity);
      }
    
      public void a()
      {
        this.a = getConfig().getString("IgnorePermisison");
        this.b = getConfig().getString("UsePermission");
        this.c = getConfig().getString("ReloadPermission");
        this.d = getConfig().getString("ConfigReloaded");
        this.e = getConfig().getInt("Range");
        this.f = getConfig().getString("NoPermMessage");
        this.g = getConfig().getString("Enabled");
        this.h = getConfig().getString("Disabled");
        this.i = getConfig().getBoolean("EnableSound");
        this.j = getConfig().getString("Sound");
        this.k = getConfig().getInt("Volume");
        this.l = getConfig().getInt("Pitch");
      }
    }
    почему ошибка в 16 строке (a((Entity)vehicle, b(player, (Entity)vehicle), 1.6D, true, 0.8D, 0.0D, 10.0D);)
    Подчёркивает <<vehicle>>
     
  13. DonDays

    DonDays Активный участник Пользователь

    Trophy Points:
    96
    Имя в Minecraft:
    DonDays
    названия переменных збс
     
  14. TheZefirrkka

    TheZefirrkka Активный участник Пользователь

    Trophy Points:
    76
    Skype:
    RomaMamkinHasker1337
    Имя в Minecraft:
    TheZefirrkka
    "Обфускация" :D
     
  15. DonDays

    DonDays Активный участник Пользователь

    Trophy Points:
    96
    Имя в Minecraft:
    DonDays
    школообфа*, или же он просто сп*здил этот кусок кода из плагина с такой же школообфой
     
  16. Автор темы
    sasha2003

    sasha2003 Активный участник Пользователь

    Trophy Points:
    76
  17. DonDays

    DonDays Активный участник Пользователь

    Trophy Points:
    96
    Имя в Minecraft:
    DonDays
  18. xDark

    xDark Активный участник Пользователь

    Trophy Points:
    96
    Skype:
    ailyashevich
    Имя в Minecraft:
    xDark
    от туда код выдернул
     
  19. slavik123123123

    slavik123123123 Старожил Пользователь

    Trophy Points:
    143
    Имя в Minecraft:
    Leymooooooooooo
    Code:
     
        private Set<Player> players = Sets.newConcurrentHashSet();
        public void onEnable() {
            Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
                @Override
                public void run() {
                    for (Player p : players) {
                        for (Entity e : p.getNearbyEntities(4, 4, 4)) {
                            if (e.getType() == EntityType.PLAYER) {
                                Player p2 = (Player) e;
                                if (p != p2) {
                                    p2.setVelocity(p2.getLocation().getDirection().setY(-1.35).multiply(-1.2));
                                }
                            }
                        }
                    }
                }
            }, 5, 5);
        }
    
    В players добавляешь игроков от которых должно отталкивать игроков.
     

Share This Page