Add a go back button on kit selection

This commit is contained in:
Sam 2017-06-28 00:21:47 +01:00
parent a79c79bc99
commit b9a72312a8
7 changed files with 65 additions and 12 deletions

View File

@ -79,6 +79,12 @@ public class ClientArmorStand implements ArmorStand
_observers = players;
}
public void sendSpawnPacket(Player player)
{
Packet<?> packet = new PacketPlayOutSpawnEntityLiving(_armorStand);
UtilPlayer.sendPacket(player, packet);
}
public EntityArmorStand getHandle()
{
return _armorStand;

View File

@ -253,4 +253,9 @@ public class WitherBoss extends MobaBoss
{
return _team;
}
public void setDamageable(boolean damageable)
{
_damageable = damageable;
}
}

View File

@ -43,6 +43,6 @@ public class WitherBossOvertimeAI extends MobaAI
_target = _path.get(_targetIndex);
}
_aiMethod.updateMovement(_entity, _target, 3);
_aiMethod.updateMovement(_entity, _target, 2);
}
}

View File

@ -323,6 +323,16 @@ public class HeroSkill extends Perk
Recharge.Instance.useForce(player, GetName(), time, true);
Recharge.Instance.setDisplayForce(player, GetName(), true);
Manager.runSyncTimer(new BukkitRunnable()
{
@Override
public void run()
{
double percentage =
}
}, 0, 1);
Manager.runSyncTimer(new BukkitRunnable()
{
int iterations = 0;

View File

@ -7,6 +7,8 @@ import mineplex.core.common.util.UtilTime;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.boss.MobaBoss;
import nautilus.game.arcade.game.games.moba.boss.wither.WitherBoss;
import org.bukkit.Bukkit;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
@ -47,6 +49,14 @@ public class OvertimeManager implements Listener
UtilTextMiddle.display(C.cRedB + "OVERTIME", "Victory or Death, Withers are moving to the center!");
_host.Announce(F.main("Game", "Victory or Death, Withers are moving to the center!"), false);
for (MobaBoss boss : _host.getBossManager().getBosses())
{
if (boss instanceof WitherBoss)
{
((WitherBoss) boss).setDamageable(true);
}
}
for (Player player : Bukkit.getOnlinePlayers())
{
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1, 1.2F);

View File

@ -1,9 +1,14 @@
package nautilus.game.arcade.game.games.moba.prepare;
import mineplex.core.common.entity.ClientArmorStand;
import mineplex.core.common.util.*;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.packethandler.IPacketHandler;
import mineplex.core.packethandler.PacketHandler.ListenerPriority;
@ -18,6 +23,7 @@ import nautilus.game.arcade.game.games.moba.kit.HeroKit;
import nautilus.game.arcade.game.games.moba.kit.RoleSelectEvent;
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
@ -40,6 +46,7 @@ public class PrepareSelection implements Listener, IPacketHandler
private final Moba _host;
private final Map<ClientArmorStand, MobaRole> _roleStands = new HashMap<>();
private final Map<ClientArmorStand, HeroKit> _kitStands = new HashMap<>();
private final Map<Player, ClientArmorStand> _goBackStands = new HashMap<>();
public PrepareSelection(Moba host)
{
@ -109,9 +116,21 @@ public class PrepareSelection implements Listener, IPacketHandler
Location average = UtilAlg.getAverageLocation(team.GetSpawns());
MobaPlayer mobaPlayer = _host.getMobaData(player);
List<HeroKit> heroKits = _host.getKits(mobaPlayer.getRole());
Location goBack = spawns.remove("KIT " + team.GetName().toUpperCase() + " GO_BACK");
ClientArmorStand goBackStand = ClientArmorStand.spawn(goBack.clone().add(0, 1, 0), player);
goBackStand.setCustomNameVisible(true);
goBackStand.setCustomName(C.cGreenB + "Go Back");
goBackStand.setArms(true);
goBackStand.setHelmet(new ItemStack(Material.SKULL_ITEM, (byte) 2));
goBackStand.setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(Color.MAROON).build());
goBackStand.setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).setColor(Color.MAROON).build());
goBackStand.setBoots(new ItemBuilder(Material.LEATHER_BOOTS).setColor(Color.MAROON).build());
_goBackStands.put(player, goBackStand);
UtilServer.runSyncLater(() ->
{
for (Location location : spawns.values())
@ -169,6 +188,16 @@ public class PrepareSelection implements Listener, IPacketHandler
Player player = packetInfo.getPlayer();
int entityId = packet.a;
ClientArmorStand goBackStand = _goBackStands.get(player);
if (goBackStand != null)
{
packetInfo.setCancelled(true);
_host.getMobaData(player).setRole(null);
_goBackStands.remove(player).remove();
return;
}
for (ClientArmorStand stand : _roleStands.keySet())
{
if (stand.getEntityId() != entityId)
@ -199,15 +228,7 @@ public class PrepareSelection implements Listener, IPacketHandler
return;
}
if (team.GetColor() == ChatColor.RED)
{
spawnKitUI(player);
}
else
{
spawnKitUI(player);
}
spawnKitUI(player);
displayKitInformation(player, role);
}

View File

@ -128,6 +128,7 @@ public class MobaTraining extends Moba
// Prevent the wither from being damaged as well as to not spawn the pumpkin king
_boss.setDummyBosses(true);
_overtimeManager.disableOvertime();
// Disable minions
_minion.disableMinions();