Teleport players "correctly" to their lanes

This commit is contained in:
Sam 2017-05-16 12:16:50 +01:00
parent 73ac34ec3d
commit 4148af9214
3 changed files with 37 additions and 9 deletions

View File

@ -30,6 +30,7 @@ import nautilus.game.arcade.game.games.moba.kit.hattori.HeroHattori;
import nautilus.game.arcade.game.games.moba.recall.Recall;
import nautilus.game.arcade.game.games.moba.shop.MobaShop;
import nautilus.game.arcade.game.games.moba.structure.point.CapturePoint;
import nautilus.game.arcade.game.games.moba.structure.tower.Tower;
import nautilus.game.arcade.game.games.moba.structure.tower.TowerManager;
import nautilus.game.arcade.game.modules.CustomScoreboardModule;
import nautilus.game.arcade.game.modules.compass.CompassModule;
@ -74,6 +75,7 @@ public class Moba extends TeamGame
private final MobaShop _shop;
private final GoldManager _goldManager;
private final BossManager _boss;
private final TowerManager _tower;
public Moba(ArcadeManager manager)
{
@ -117,7 +119,8 @@ public class Moba extends TeamGame
_boss = boss;
_listeners.add(boss);
Listener tower = new TowerManager(this);
TowerManager tower = new TowerManager(this);
_tower = tower;
_listeners.add(tower);
new CompassModule()
@ -340,8 +343,20 @@ public class Moba extends TeamGame
// Teleport players to their respective spawns
GameTeam team = GetTeam(player);
Location toTeleport = WorldData.GetCustomLocs("SPAWN " + team.GetName().toUpperCase() + " " + mobaPlayer.Role.getLane().toString()).get(0);
toTeleport.setYaw(UtilAlg.GetYaw(UtilAlg.getTrajectory(toTeleport, GetSpectatorLocation())));
MobaLane lane = mobaPlayer.Role.getLane();
Location toTeleport = WorldData.GetCustomLocs("SPAWN " + team.GetName().toUpperCase() + " " + lane.toString()).get(0);
// Face the location toward the first tower of that lane
Tower tower = _tower.getFirsrtTower(lane);
if (tower != null)
{
toTeleport.setYaw(UtilAlg.GetYaw(UtilAlg.getTrajectory(player.getLocation(), tower.getLocation())));
}
else
{
toTeleport.setYaw(UtilAlg.GetYaw(UtilAlg.getTrajectory(player.getLocation(), GetSpectatorLocation())));
}
player.teleport(toTeleport);
}
}

View File

@ -1,6 +1,5 @@
package nautilus.game.arcade.game.games.moba;
import mineplex.core.common.util.C;
import org.bukkit.ChatColor;
import org.bukkit.Color;
@ -13,14 +12,15 @@ public enum MobaRole
WARRIOR("Warrior", MobaLane.C, Color.YELLOW, ChatColor.GOLD),
;
private String _name;
private MobaLane _lane;
private Color _color;
private ChatColor _chatColor;
private final String _name;
private final MobaLane _lane;
private final Color _color;
private final ChatColor _chatColor;
MobaRole(String name, MobaLane lane, Color color, ChatColor chatColor)
{
_name = name;
_lane = lane;
_color = color;
_chatColor = chatColor;
}

View File

@ -181,7 +181,7 @@ public class TowerManager implements Listener
event.setCancelled(true);
tower.damage(event.getDamage());
if (Recharge.Instance.use(player, "Tower Sound", 1500, false, false))
if (Recharge.Instance.use(player, "Tower Sound", 500, false, false))
{
player.playSound(tower.getCrystal().getLocation(), Sound.BLAZE_HIT, 1, 0.8F);
}
@ -189,6 +189,19 @@ public class TowerManager implements Listener
}
}
public Tower getFirsrtTower(MobaLane lane)
{
for (Tower tower : _towers)
{
if (tower.isFirstTower() && tower.getLane() == lane)
{
return tower;
}
}
return null;
}
// /*
// Hacky work arounds!!!!
// */