Вопрос как телепортнуть игрока (betterrtp) читайте внутри?

Версия Minecraft
1.16.X

1Krokko3213

Пользователь
Сообщения
13
Java:
        if (player1.isOnline() && player2.isOnline()) {
            if (config.getBoolean("sounds.joined.enable"))
                player1.playSound(player1.getLocation(), Sound.valueOf(config.getString("sounds.joined.name")), (float)config.getDouble("sounds.joined.volume"), (float)config.getDouble("sounds.joined.pitch"));
            Antirelog plug = (Antirelog) Bukkit.getPluginManager().getPlugin("Antirelog");
            assert plug != null;
            RTP rtp = new RTP();
            rtp.getRandomLocation(new Location(Bukkit.getWorld("world"), 0.0D, 90.0D, 0.0D), 300.0D, 1500.0D).thenAccept(location -> {
                double distance = 10.0D;
                double angle = Math.toRadians(player1.getLocation().getYaw());
                double xOffset = distance * Math.sin(angle);
                double zOffset = -distance * Math.cos(angle);
                Location newLocation = location.clone().add(xOffset, 0.0D, zOffset);
                Location player = location.clone();
                player.setYaw(0.0F);
                Block locs = newLocation.getWorld().getBlockAt(newLocation.getBlockX(), newLocation.getWorld().getHighestBlockYAt(newLocation.getBlockX(), newLocation.getBlockZ()), newLocation.getBlockZ());
                player1.teleport(player.getWorld().getHighestBlockAt(location).getLocation().add(0.0D, 2.0D, 0.0D));
                player1.setFallDistance(0.0F);
                player1.sendTitle(ChatColor.translateAlternateColorCodes('&', "&4), ChatColor.translateAlternateColorCodes('&', "&f), 20, 20, 20);
                Location loc2 = locs.getLocation().getWorld().getHighestBlockAt(location).getLocation().add(10.0D, 2.0D, 0.0D);
                loc2.setYaw(90.0F);
                player2.teleport(loc2);
                player2.setFallDistance(0.0F);
                player2.sendTitle(ChatColor.translateAlternateColorCodes('&', "&4), ChatColor.translateAlternateColorCodes('&', "&f), 20, 20, 20);
                Antirelog plugin = (Antirelog)Antirelog.getPlugin(Antirelog.class);
                PvPManager pvpManager = plugin.getPvpManager();
                pvpManager.playerDamagedByPlayer(player1, player2);
                Main.getInstance().addDuelLocations(player1, player);
                Main.getInstance().addDuelLocations(player2, player);
                Main.getInstance().getBattlePairs().put(player1, player2);
                Main.getInstance().getBattlePairs().put(player2, player1);
            });
        }
я "переписываю" sixpvpfinder под беттер ртп но не понять как реализовать такой же ртп как и в ориге. там к слову ессентиалс
Java:
    FileConfiguration config = Main.getInstance().getConfig();
    if (player1.isOnline() && player2.isOnline()) {
      if (config.getBoolean("sounds.joined.enable"))
        player1.playSound(player1.getLocation(), Sound.valueOf(config.getString("sounds.joined.name")), (float)config.getDouble("sounds.joined.volume"), (float)config.getDouble("sounds.joined.pitch"));
      Essentials essentials = (Essentials)Bukkit.getPluginManager().getPlugin("Essentials");
      RandomTeleport randomTeleport = essentials.getRandomTeleport();
      randomTeleport.getRandomLocation(new Location(Bukkit.getWorld("world"), 0.0D, 90.0D, 0.0D), 300.0D, 1500.0D).thenAccept(location -> {
            double distance = 10.0D;
            double angle = Math.toRadians(player1.getLocation().getYaw());
            double xOffset = distance * Math.sin(angle);
            double zOffset = -distance * Math.cos(angle);
            Location newLocation = location.clone().add(xOffset, 0.0D, zOffset);
            Location player = location.clone();
            player.setYaw(0.0F);
            Block locs = newLocation.getWorld().getBlockAt(newLocation.getBlockX(), newLocation.getWorld().getHighestBlockYAt(newLocation.getBlockX(), newLocation.getBlockZ()), newLocation.getBlockZ());
            player1.teleport(player.getWorld().getHighestBlockAt(location).getLocation().add(0.0D, 2.0D, 0.0D));
            player1.setFallDistance(0.0F);
            player1.sendTitle(ChatColor.translateAlternateColorCodes('&', "&4), ChatColor.translateAlternateColorCodes('&', "&f), 20, 20, 20);
            Location loc2 = locs.getLocation().getWorld().getHighestBlockAt(location).getLocation().add(10.0D, 2.0D, 0.0D);
            loc2.setYaw(90.0F);
            player2.teleport(loc2);
            player2.setFallDistance(0.0F);
            player2.sendTitle(ChatColor.translateAlternateColorCodes('&', "&4), ChatColor.translateAlternateColorCodes('&', "&f), 20, 20, 20);
            Antirelog plugin = (Antirelog)Antirelog.getPlugin(Antirelog.class);
            PvPManager pvpManager = plugin.getPvpManager();
            pvpManager.playerDamagedByPlayer(player1, player2);
            Main.getInstance().addDuelLocations(player1, player);
            Main.getInstance().addDuelLocations(player2, player);
            Main.getInstance().getBattlePairs().put(player1, player2);
            Main.getInstance().getBattlePairs().put(player2, player1);
          });
 
Если вопрос связан с этим плагином
То ответ у них на вики:
Java:
HelperRTP.tp(player, sendi, world, biomes, RTP_TYPE.ADDON);
 
Если вопрос связан с этим плагином
То ответ у них на вики:
Java:
HelperRTP.tp(player, sendi, world, biomes, RTP_TYPE.ADDON);
Java:
0.0D, 90.0D, 0.0D), 300.0D, 1500.0D).thenAccept(location -> {
            double distance = 10.0D;
            double angle = Math.toRadians(player1.getLocation().getYaw());
            double xOffset = distance * Math.sin(angle);
            double zOffset = -distance * Math.cos(angle);
            Location newLocation = location.clone().add(xOffset, 0.0D, zOffset);
            Location player = location.clone();
            player.setYaw(0.0F);
            Block locs = newLocation.getWorld().getBlockAt(newLocation.getBlockX(), newLocation.getWorld().getHighestBlockYAt(newLocation.getBlockX(), newLocation.getBlockZ()), newLocation.getBlockZ());
            player1.teleport(player.getWorld().getHighestBlockAt(location).getLocation().add(0.0D, 2.0D, 0.0D));
            player1.setFallDistance(0.0F);
            player1.sendTitle(ChatColor.translateAlternateColorCodes('&', "&4), ChatColor.translateAlternateColorCodes('&', "&f), 20, 20, 20);
            Location loc2 = locs.getLocation().getWorld().getHighestBlockAt(location).getLocation().add(10.0D, 2.0D, 0.0D);
            loc2.setYaw(90.0F);
            player2.teleport(loc2);
            player2.setFallDistance(0.0F);
            player2.sendTitle(ChatColor.translateAlternateColorCodes('&', "&4), ChatColor.translateAlternateColorCodes('&', "&f), 20, 20, 20);
            Antirelog plugin = (Antirelog)Antirelog.getPlugin(Antirelog.class);
            PvPManager pvpManager = plugin.getPvpManager();
            pvpManager.playerDamagedByPlayer(player1, player2);
            Main.getInstance().addDuelLocations(player1, player);
            Main.getInstance().addDuelLocations(player2, player);
            Main.getInstance().getBattlePairs().put(player1, player2);
нужно чтобы это оставалось, а не просто тп одного игрока, мне нужно чтобы обоих тепало на расстояние определенное
 
Тогда воспользуйтесь методом getRandomLocation из того же класса HelperRTP
Как он работает и как его вызывать можно найти здесь:
 
Тогда воспользуйтесь методом getRandomLocation из того же класса HelperRTP
Как он работает и как его вызывать можно найти здесь:
Cannot resolve method 'tp(Player, World)'
Java:
            HelperRTP.tp(player1 , Bukkit.getWorld("world"));
             getRandomLocation(new Location(Bukkit.getWorld("world"), 0.0D, 90.0D, 0.0D), 300.0D, 1500.0D).thenAccept(location -> {
                double distance = 10.0D;
                double angle = Math.toRadians(player1.getLocation().getYaw());
                double xOffset = distance * Math.sin(angle);
                double zOffset = -distance * Math.cos(angle);
                Location newLocation = location.clone().add(xOffset, 0.0D, zOffset);
                Location player = location.clone();
                player.setYaw(0.0F);
                Block locs = newLocation.getWorld().getBlockAt(newLocation.getBlockX(), newLocation.getWorld().getHighestBlockYAt(newLocation.getBlockX(), newLocation.getBlockZ()), newLocation.getBlockZ());
                player1.teleport(player.getWorld().getHighestBlockAt(location).getLocation().add(0.0D, 2.0D, 0.0D));
                player1.setFallDistance(0.0F);
                player1.sendTitle(ChatColor.translateAlternateColorCodes('&', "&4), ChatColor.translateAlternateColorCodes('&', "&f), 20, 20, 20);
                Location loc2 = locs.getLocation().getWorld().getHighestBlockAt(location).getLocation().add(10.0D, 2.0D, 0.0D);
                loc2.setYaw(90.0F);
                player2.teleport(loc2);
                player2.setFallDistance(0.0F);
                player2.sendTitle(ChatColor.translateAlternateColorCodes('&', "&4), ChatColor.translateAlternateColorCodes('&', "&f), 20, 20, 20);
                Antirelog plugin = (Antirelog)Antirelog.getPlugin(Antirelog.class);
                PvPManager pvpManager = plugin.getPvpManager();
                pvpManager.playerDamagedByPlayer(player1, player2);
                Main.getInstance().addDuelLocations(player1, player);
                Main.getInstance().addDuelLocations(player2, player);
                Main.getInstance().getBattlePairs().put(player1, player2);
                Main.getInstance().getBattlePairs().put(player2, player1);
            });
что тут не так?
 
Назад
Сверху Снизу