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);
});
}
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);
});