From a32ae91996d49168283736d1da0f668da32a63a2 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 5 May 2017 22:30:37 +0100 Subject: [PATCH] Gotta go fast! --- .../core/common/entity/ClientArmorStand.java | 1038 +++++++++++++++++ .../src/nautilus/game/arcade/game/Game.java | 3 +- .../game/arcade/game/games/moba/Moba.java | 124 +- .../game/arcade/game/games/moba/MobaRole.java | 18 +- .../arcade/game/games/moba/kit/HeroKit.java | 124 ++ .../game/games/moba/kit/KitSelection.java | 30 - .../game/games/moba/kit/PregameSelection.java | 164 +++ .../game/games/moba/kit/RoleSelectEvent.java | 61 + .../games/moba/kit/heroes/HeroHattori.java | 32 + .../arcade/game/games/moba/recall/Recall.java | 136 +++ .../game/games/moba/recall/RecallSession.java | 19 + .../arcade/game/games/moba/shop/MobaShop.java | 16 + .../moba/structure/point/CapturePoint.java | 2 - .../games/moba/structure/tower/Tower.java | 95 ++ .../structure/tower/TowerDestroyEvent.java | 34 + .../game/arcade/game/games/uhc/UHC.java | 2 + .../game/arcade/managers/GameHostManager.java | 2 +- .../game/arcade/managers/GameManager.java | 2 +- .../serverreset/ServerResetCommand.java | 2 +- 19 files changed, 1862 insertions(+), 42 deletions(-) create mode 100644 Plugins/Mineplex.Core.Common/src/mineplex/core/common/entity/ClientArmorStand.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/HeroKit.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/KitSelection.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/PregameSelection.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/RoleSelectEvent.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/heroes/HeroHattori.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/recall/Recall.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/recall/RecallSession.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/shop/MobaShop.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/structure/tower/Tower.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/structure/tower/TowerDestroyEvent.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/entity/ClientArmorStand.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/entity/ClientArmorStand.java new file mode 100644 index 000000000..239f0af5c --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/entity/ClientArmorStand.java @@ -0,0 +1,1038 @@ +package mineplex.core.common.entity; + +import mineplex.core.common.util.UtilPlayer; +import net.minecraft.server.v1_8_R3.*; +import org.bukkit.EntityEffect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Server; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; +import org.bukkit.entity.*; +import org.bukkit.entity.Entity; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; +import org.bukkit.inventory.EntityEquipment; +import org.bukkit.inventory.ItemStack; +import org.bukkit.metadata.MetadataValue; +import org.bukkit.permissions.Permission; +import org.bukkit.permissions.PermissionAttachment; +import org.bukkit.permissions.PermissionAttachmentInfo; +import org.bukkit.plugin.Plugin; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.util.EulerAngle; +import org.bukkit.util.Vector; + +import java.util.*; + +public class ClientArmorStand implements ArmorStand +{ + + private static final int HAND = 0; + private static final int HELMET = 4; + private static final int CHESTPLATE = 3; + private static final int LEGGINGS = 2; + private static final int BOOTS = 1; + + public static ClientArmorStand spawn(Location location) + { + EntityArmorStand entityArmorStand = new EntityArmorStand(((CraftWorld) location.getWorld()).getHandle()); + entityArmorStand.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); + ClientArmorStand clientArmorStand = new ClientArmorStand(entityArmorStand); + + for (Player other : clientArmorStand.getObservers()) + { + UtilPlayer.sendPacket(other, new PacketPlayOutSpawnEntityLiving(entityArmorStand)); + } + + return clientArmorStand; + } + + public static ClientArmorStand spawn(Location loc, Player... players) + { + EntityArmorStand entityArmorStand = new EntityArmorStand(((CraftWorld) loc.getWorld()).getHandle()); + entityArmorStand.setPositionRotation(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch()); + ClientArmorStand clientArmorStand = new ClientArmorStand(entityArmorStand, players); + Packet packet = new PacketPlayOutSpawnEntityLiving(entityArmorStand); + + for (Player observer : players) + { + UtilPlayer.sendPacket(observer, packet); + } + + return clientArmorStand; + } + + private final EntityArmorStand _armorStand; + private ItemStack _itemInHand, _helmet, _chestplate, _leggings, _boots; + private boolean _visible; + private final DataWatcher _dataWatcher; + + private Player[] _observers; + + private ClientArmorStand(EntityArmorStand armorStand, Player... players) + { + _armorStand = armorStand; + _dataWatcher = armorStand.getDataWatcher(); + _observers = players; + } + + public EntityArmorStand getHandle() + { + return _armorStand; + } + + @Override + public ItemStack getItemInHand() + { + return _itemInHand; + } + + @Override + public void setItemInHand(ItemStack itemStack) + { + _itemInHand = itemStack; + sendPacket(new PacketPlayOutEntityEquipment(getEntityId(), HAND, CraftItemStack.asNMSCopy(itemStack))); + } + + @Override + public ItemStack getHelmet() + { + return _helmet; + } + + @Override + public void setHelmet(ItemStack itemStack) + { + _helmet = itemStack; + sendPacket(new PacketPlayOutEntityEquipment(getEntityId(), HELMET, CraftItemStack.asNMSCopy(itemStack))); + } + + @Override + public ItemStack getChestplate() + { + return _chestplate; + } + + @Override + public void setChestplate(ItemStack itemStack) + { + _chestplate = itemStack; + sendPacket(new PacketPlayOutEntityEquipment(getEntityId(), CHESTPLATE, CraftItemStack.asNMSCopy(itemStack))); + } + + @Override + public ItemStack getLeggings() + { + return _leggings; + } + + @Override + public void setLeggings(ItemStack itemStack) + { + _leggings = itemStack; + sendPacket(new PacketPlayOutEntityEquipment(getEntityId(), LEGGINGS, CraftItemStack.asNMSCopy(itemStack))); + } + + @Override + public ItemStack getBoots() + { + return _boots; + } + + @Override + public void setBoots(ItemStack itemStack) + { + _boots = itemStack; + sendPacket(new PacketPlayOutEntityEquipment(getEntityId(), BOOTS, CraftItemStack.asNMSCopy(itemStack))); + } + + @Override + public Location getEyeLocation() + { + return getLocation().add(0, getEyeHeight(), 0); + } + + @Override + public double getEyeHeight() + { + return 1.62; + } + + @Override + public double getEyeHeight(boolean sneaking) + { + return getEyeHeight(); + } + + @Override + public String getCustomName() + { + return _armorStand.getCustomName(); + } + + @Override + public Location getLocation() + { + return new Location(getWorld(), _armorStand.locX, _armorStand.locY, _armorStand.locZ); + } + + @Override + public boolean isVisible() + { + return _visible; + } + + @Override + public void setVisible(boolean visible) + { + _visible = visible; + _armorStand.setInvisible(!visible); + sendMetaPacket(); + } + + private void sendMetaPacket() + { + sendPacket(new PacketPlayOutEntityMetadata(getEntityId(), _dataWatcher, true), _observers); + } + + @Override + public Entity getPassenger() + { + return null; + } + + @Override + public Entity getVehicle() + { + return null; + } + + @Override + public org.bukkit.World getWorld() + { + return _armorStand.getWorld().getWorld(); + } + + @Override + public void remove() + { + sendPacket(new PacketPlayOutEntityDestroy(new int[]{_armorStand.getId()})); + } + + public void remove(Player... player) + { + sendPacket(new PacketPlayOutEntityDestroy(new int[]{_armorStand.getId()}), player); + } + + @Override + public void setCustomName(String arg0) + { + _armorStand.setCustomName(arg0); + sendMetaPacket(); + } + + @Override + public boolean setPassenger(Entity arg0) + { + return false; + } + + @Override + public boolean teleport(Location loc) + { + _armorStand.setPositionRotation(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch()); + sendPacket(new PacketPlayOutEntityTeleport(_armorStand)); + return false; + } + + @Override + public EulerAngle getBodyPose() + { + return null; + } + + @Override + public EulerAngle getHeadPose() + { + return fromNMS(_armorStand.headPose); + } + + @Override + public void setHeadPose(EulerAngle pose) + { + _armorStand.setHeadPose(toNMS(pose)); + sendMetaPacket(); + } + + @Override + public EulerAngle getLeftArmPose() + { + return null; + } + + @Override + public EulerAngle getLeftLegPose() + { + return null; + } + + @Override + public EulerAngle getRightArmPose() + { + return null; + } + + @Override + public EulerAngle getRightLegPose() + { + return null; + } + + @Override + public boolean hasArms() + { + return false; + } + + @Override + public boolean hasBasePlate() + { + return false; + } + + @Override + public boolean hasGravity() + { + return false; + } + + @Override + public boolean isMarker() + { + return false; + } + + @Override + public boolean isSmall() + { + return false; + } + + @Override + public void setArms(boolean arg0) + { + _armorStand.setArms(arg0); + sendMetaPacket(); + } + + @Override + public void setBasePlate(boolean arg0) + { + _armorStand.setBasePlate(arg0); + sendMetaPacket(); + } + + @Override + public void setBodyPose(EulerAngle arg0) + { + } + + @Override + public void setLeftArmPose(EulerAngle arg0) + { + } + + @Override + public void setLeftLegPose(EulerAngle arg0) + { + } + + @Override + public void setRightArmPose(EulerAngle arg0) + { + } + + @Override + public void setRightLegPose(EulerAngle arg0) + { + } + + @Override + public void setSmall(boolean arg0) + { + _armorStand.setSmall(arg0); + sendMetaPacket(); + } + + @Override + public int getEntityId() + { + return _armorStand.getId(); + } + + public Player[] getObservers() + { + return _observers; + } + + public void sendPacket(Packet packet) + { + sendPacket(packet, getObservers()); + } + + public void sendPacket(Packet packet, Collection observers) + { + for (Player player : observers) + { + UtilPlayer.sendPacket(player, packet); + } + } + + public void sendPacket(Packet packet, Player... observers) + { + for (Player player : observers) + { + UtilPlayer.sendPacket(player, packet); + } + } + + // Not needed + + @Override + public void setGravity(boolean b) + { + + } + + @Override + public void setMarker(boolean b) + { + + } + + @Override + public List getLineOfSight(HashSet hashSet, int i) + { + return null; + } + + @Override + public List getLineOfSight(Set set, int i) + { + return null; + } + + @Override + public Block getTargetBlock(HashSet hashSet, int i) + { + return null; + } + + @Override + public Block getTargetBlock(Set set, int i) + { + return null; + } + + @Override + public List getLastTwoTargetBlocks(HashSet hashSet, int i) + { + return null; + } + + @Override + public List getLastTwoTargetBlocks(Set set, int i) + { + return null; + } + + @Override + public Egg throwEgg() + { + return null; + } + + @Override + public Snowball throwSnowball() + { + return null; + } + + @Override + public Arrow shootArrow() + { + return null; + } + + @Override + public int getRemainingAir() + { + return 0; + } + + @Override + public void setRemainingAir(int i) + { + + } + + @Override + public int getMaximumAir() + { + return 0; + } + + @Override + public void setMaximumAir(int i) + { + + } + + @Override + public int getMaximumNoDamageTicks() + { + return 0; + } + + @Override + public void setMaximumNoDamageTicks(int i) + { + + } + + @Override + public double getLastDamage() + { + return 0; + } + + @Override + public void setLastDamage(double v) + { + + } + + @Override + public int getNoDamageTicks() + { + return 0; + } + + @Override + public void setNoDamageTicks(int i) + { + + } + + @Override + public Player getKiller() + { + return null; + } + + @Override + public boolean addPotionEffect(PotionEffect potionEffect) + { + return false; + } + + @Override + public boolean addPotionEffect(PotionEffect potionEffect, boolean b) + { + return false; + } + + @Override + public boolean addPotionEffects(Collection collection) + { + return false; + } + + @Override + public boolean hasPotionEffect(PotionEffectType potionEffectType) + { + return false; + } + + @Override + public void removePotionEffect(PotionEffectType potionEffectType) + { + + } + + @Override + public Collection getActivePotionEffects() + { + return null; + } + + @Override + public boolean hasLineOfSight(org.bukkit.entity.Entity entity) + { + return false; + } + + @Override + public boolean getRemoveWhenFarAway() + { + return false; + } + + @Override + public void setRemoveWhenFarAway(boolean b) + { + + } + + @Override + public EntityEquipment getEquipment() + { + return null; + } + + @Override + public void setCanPickupItems(boolean b) + { + + } + + @Override + public boolean getCanPickupItems() + { + return false; + } + + @Override + public boolean isLeashed() + { + return false; + } + + @Override + public org.bukkit.entity.Entity getLeashHolder() throws IllegalStateException + { + return null; + } + + @Override + public boolean setLeashHolder(org.bukkit.entity.Entity entity) + { + return false; + } + + @Override + public boolean shouldBreakLeash() + { + return false; + } + + @Override + public void setShouldBreakLeash(boolean b) + { + + } + + @Override + public boolean shouldPullWhileLeashed() + { + return false; + } + + @Override + public void setPullWhileLeashed(boolean b) + { + + } + + @Override + public boolean isVegetated() + { + return false; + } + + @Override + public void setVegetated(boolean b) + { + + } + + @Override + public boolean isGhost() + { + return false; + } + + @Override + public void setGhost(boolean b) + { + + } + + @Override + public void damage(double v) + { + + } + + @Override + public void damage(double v, org.bukkit.entity.Entity entity) + { + + } + + @Override + public double getHealth() + { + return 0; + } + + @Override + public void setHealth(double v) + { + + } + + @Override + public double getMaxHealth() + { + return 0; + } + + @Override + public void setMaxHealth(double v) + { + + } + + @Override + public void resetMaxHealth() + { + + } + + @Override + public Location getLocation(Location location) + { + return null; + } + + @Override + public void setVelocity(Vector vector) + { + + } + + @Override + public Vector getVelocity() + { + return null; + } + + @Override + public boolean isOnGround() + { + return false; + } + + @Override + public boolean teleport(Location location, TeleportCause teleportCause) + { + return false; + } + + @Override + public boolean teleport(org.bukkit.entity.Entity entity) + { + return false; + } + + @Override + public boolean teleport(org.bukkit.entity.Entity entity, TeleportCause teleportCause) + { + return false; + } + + @Override + public List getNearbyEntities(double v, double v1, double v2) + { + return null; + } + + @Override + public int getFireTicks() + { + return 0; + } + + @Override + public int getMaxFireTicks() + { + return 0; + } + + @Override + public void setFireTicks(int i) + { + + } + + @Override + public boolean isDead() + { + return false; + } + + @Override + public boolean isValid() + { + return false; + } + + @Override + public Server getServer() + { + return null; + } + + @Override + public boolean isEmpty() + { + return false; + } + + @Override + public boolean eject() + { + return false; + } + + @Override + public float getFallDistance() + { + return 0; + } + + @Override + public void setFallDistance(float v) + { + + } + + @Override + public void setLastDamageCause(EntityDamageEvent entityDamageEvent) + { + + } + + @Override + public EntityDamageEvent getLastDamageCause() + { + return null; + } + + @Override + public UUID getUniqueId() + { + return null; + } + + @Override + public int getTicksLived() + { + return 0; + } + + @Override + public void setTicksLived(int i) + { + + } + + @Override + public void playEffect(EntityEffect entityEffect) + { + + } + + @Override + public EntityType getType() + { + return null; + } + + @Override + public boolean isInsideVehicle() + { + return false; + } + + @Override + public boolean leaveVehicle() + { + return false; + } + + @Override + public void setCustomNameVisible(boolean b) + { + _armorStand.setCustomNameVisible(b); + } + + @Override + public boolean isCustomNameVisible() + { + return false; + } + + @Override + public Spigot spigot() + { + return null; + } + + @Override + public void sendMessage(String s) + { + + } + + @Override + public void sendMessage(String[] strings) + { + + } + + @Override + public String getName() + { + return null; + } + + @Override + public void setMetadata(String s, MetadataValue metadataValue) + { + + } + + @Override + public List getMetadata(String s) + { + return null; + } + + @Override + public boolean hasMetadata(String s) + { + return false; + } + + @Override + public void removeMetadata(String s, Plugin plugin) + { + + } + + @Override + public boolean isPermissionSet(String s) + { + return false; + } + + @Override + public boolean isPermissionSet(Permission permission) + { + return false; + } + + @Override + public boolean hasPermission(String s) + { + return false; + } + + @Override + public boolean hasPermission(Permission permission) + { + return false; + } + + @Override + public PermissionAttachment addAttachment(Plugin plugin, String s, boolean b) + { + return null; + } + + @Override + public PermissionAttachment addAttachment(Plugin plugin) + { + return null; + } + + @Override + public PermissionAttachment addAttachment(Plugin plugin, String s, boolean b, int i) + { + return null; + } + + @Override + public PermissionAttachment addAttachment(Plugin plugin, int i) + { + return null; + } + + @Override + public void removeAttachment(PermissionAttachment permissionAttachment) + { + + } + + @Override + public void recalculatePermissions() + { + + } + + @Override + public Set getEffectivePermissions() + { + return null; + } + + @Override + public boolean isOp() + { + return false; + } + + @Override + public void setOp(boolean b) + { + + } + + @Override + public T launchProjectile(Class aClass) + { + return null; + } + + @Override + public T launchProjectile(Class aClass, Vector vector) + { + return null; + } + + private static EulerAngle fromNMS(Vector3f old) + { + return new EulerAngle(Math.toRadians(old.getX()), Math.toRadians(old.getY()), Math.toRadians(old.getZ())); + } + + private static Vector3f toNMS(EulerAngle old) + { + return new Vector3f((float) Math.toDegrees(old.getX()), (float) Math.toDegrees(old.getY()), (float) Math.toDegrees(old.getZ())); + } + +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index 89fe831d5..9a1006b42 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -257,7 +257,6 @@ public abstract class Game extends ListenerComponent implements Lifetimed public int HealthSet = -1; public boolean SpawnTeleport = true; - public boolean PrepareFreeze = true; private double _itemMergeRadius = 0; @@ -293,7 +292,9 @@ public abstract class Game extends ListenerComponent implements Lifetimed public boolean AllowParticles = true; + public boolean Prepare = true; public long PrepareTime = 9000; + public boolean PrepareFreeze = true; public boolean PlaySoundGameStart = true; public double XpMult = 1; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/Moba.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/Moba.java index ce6d35041..c7c79dd48 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/Moba.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/Moba.java @@ -1,18 +1,27 @@ package nautilus.game.arcade.game.games.moba; +import mineplex.core.common.util.UtilServer; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.games.moba.kit.KitPlayer; +import nautilus.game.arcade.game.games.moba.kit.PregameSelection; +import nautilus.game.arcade.game.games.moba.recall.Recall; 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.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import org.bukkit.Location; +import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; import java.util.*; +import java.util.Map.Entry; public class Moba extends TeamGame { @@ -22,13 +31,20 @@ public class Moba extends TeamGame }; private final List _capturePoints = new ArrayList<>(3); + private final List _towers = new ArrayList<>(12); + + private final Map _roles = new HashMap<>(); + + private final Set _listeners = new HashSet<>(); public Moba(ArcadeManager manager) { super(manager, GameType.MOBA, new Kit[] { new KitPlayer(manager) }, DESCRIPTION); + //Prepare = false; + PrepareFreeze = false; DeathOut = false; - DeathSpectateSecs = 8; + DeathSpectateSecs = 10; HungerSet = 20; DontAllowOverfill = false; @@ -37,6 +53,12 @@ public class Moba extends TeamGame .setGiveCompassToSpecs(true) .setGiveCompassToAlive(false) .register(this); + + Listener preGameSelection = new PregameSelection(this, null); + _listeners.add(preGameSelection); + + Listener recall = new Recall(this); + _listeners.add(recall); } @Override @@ -48,6 +70,60 @@ public class Moba extends TeamGame { _capturePoints.add(new CapturePoint(this, location)); } + + Map towers = getLocationStartsWith("TOWER"); + + for (Entry entry : towers.entrySet()) + { + String key = entry.getKey(); + Location location = entry.getValue(); + String[] components = key.split(" "); + + if (components.length < 4) + { + continue; + } + + String team = components[1]; + String lane = components[2]; + int laneInt = 0; + + switch (lane) + { + case "A": + laneInt = 0; + break; + case "B": + laneInt = 1; + break; + case "C": + laneInt = 2; + break; + } + + boolean firstTower; + + try + { + firstTower = Integer.parseInt(components[3]) == 1; + } + catch (NumberFormatException e) + { + continue; + } + + int health = 1000; + GameTeam gameTeam = getTeam(team); + + if (gameTeam == null) + { + continue; + } + + _towers.add(new Tower(this, location, gameTeam, laneInt, health, firstTower)); + } + + _listeners.forEach(UtilServer::RegisterEvents); } @Override @@ -72,6 +148,8 @@ public class Moba extends TeamGame case End: writeEnd(); break; + default: + return; } Scoreboard.draw(); @@ -92,6 +170,37 @@ public class Moba extends TeamGame } + @EventHandler + public void prepare(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Prepare) + { + return; + } + + for (Tower tower : _towers) + { + tower.setup(); + } + } + + @EventHandler + public void live(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Live) + { + return; + } + } + + @Override + public void disable() + { + super.disable(); + _listeners.forEach(UtilServer::Unregister); + _listeners.clear(); + } + @EventHandler public void update(UpdateEvent event) { @@ -120,4 +229,17 @@ public class Moba extends TeamGame return map; } + + private GameTeam getTeam(String name) + { + for (GameTeam team : GetTeamList()) + { + if (team.GetName().equals(name)) + { + return team; + } + } + + return null; + } } \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/MobaRole.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/MobaRole.java index 91f0fa6e5..8bcb73016 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/MobaRole.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/MobaRole.java @@ -1,22 +1,25 @@ package nautilus.game.arcade.game.games.moba; import nautilus.game.arcade.kit.Kit; +import org.bukkit.Color; public enum MobaRole { - ASSASSIN("Assassin", null), - HUNTER("Hunter", null), - MAGE("Mage", null), - WARRIOR("Warrior", null), + ASSASSIN("Assassin", Color.BLUE, null), + HUNTER("Hunter", Color.LIME, null), + MAGE("Mage", Color.RED, null), + WARRIOR("Warrior", Color.YELLOW, null), ; private String _name; + private Color _color; private Kit[] _kits; - MobaRole(String name, Kit[] kits) + MobaRole(String name, Color color, Kit[] kits) { _name = name; + _color = color; _kits = kits; } @@ -25,6 +28,11 @@ public enum MobaRole return _name; } + public Color getColor() + { + return _color; + } + public Kit[] getKits() { return _kits; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/HeroKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/HeroKit.java new file mode 100644 index 000000000..a29eaf563 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/HeroKit.java @@ -0,0 +1,124 @@ +package nautilus.game.arcade.game.games.moba.kit; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.moba.MobaRole; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.PlayerInventory; + +public class HeroKit extends Kit +{ + + private final MobaRole _role; + + private static final int AMMO_SLOT = 7; + private ItemStack _ammo; + private long _giveTime; + private int _maxAmmo; + + private static final int RECALL_SLOT = 8; + private static final ItemStack RECALL_ITEM = new ItemBuilder(Material.BED) + .setTitle(C.cGreenB + "Recall to you Base") + .addLore("Clicking this item will teleport you back to your", "base after " + F.time("5") + " seconds.", "Taking damage or moving will cancel your teleport.") + .build(); + + public HeroKit(ArcadeManager manager, String name, String[] kitDesc, Perk[] kitPerks, ItemStack itemInHand, MobaRole role) + { + super(manager, name, KitAvailability.Free, kitDesc, kitPerks, null, itemInHand); + + _role = role; + } + + public MobaRole getRole() + { + return _role; + } + + public void setAmmo(ItemStack ammo, long giveTime) + { + _ammo = ammo; + _giveTime = giveTime; + } + + public void setMaxAmmo(int max) + { + _maxAmmo = max; + } + + protected boolean useAmmo(Player player, int amount) + { + ItemStack itemStack = player.getInventory().getItem(AMMO_SLOT); + + if (itemStack == null || itemStack.getAmount() < amount) + { + return false; + } + + itemStack.setAmount(itemStack.getAmount() - amount); + player.updateInventory(); + return true; + } + + @EventHandler + public void giveAmmo(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK || Manager.GetGame() == null || !Manager.GetGame().IsLive()) + { + return; + } + + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (!HasKit(player)) + { + continue; + } + + ItemStack itemStack = player.getInventory().getItem(AMMO_SLOT); + long giveTime = _giveTime; + + //TODO shop cooldown reduction + + if (!Recharge.Instance.use(player, "Ammo", giveTime, false, false)) + { + continue; + } + + if (itemStack == null) + { + itemStack = _ammo; + player.getInventory().setItem(AMMO_SLOT, itemStack); + player.updateInventory(); + continue; + } + + if (itemStack.getAmount() >= _maxAmmo) + { + continue; + } + + itemStack.setAmount(itemStack.getAmount() + 1); + player.updateInventory(); + } + } + + @Override + public void GiveItems(Player player) + { + PlayerInventory inventory = player.getInventory(); + + inventory.setItem(AMMO_SLOT, _ammo); + inventory.setItem(RECALL_SLOT, RECALL_ITEM); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/KitSelection.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/KitSelection.java deleted file mode 100644 index 1fcea1335..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/KitSelection.java +++ /dev/null @@ -1,30 +0,0 @@ -package nautilus.game.arcade.game.games.moba.kit; - -import mineplex.core.common.util.UtilServer; -import nautilus.game.arcade.events.GameStateChangeEvent; -import nautilus.game.arcade.game.Game.GameState; -import nautilus.game.arcade.game.games.moba.Moba; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; - -public class KitSelection implements Listener -{ - - private final - - public KitSelection(Moba moba) - { - UtilServer.RegisterEvents(this); - } - - @EventHandler - public void live(GameStateChangeEvent event) - { - if (event.GetState() != GameState.Live) - { - return; - } - - UtilServer.Unregister(this); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/PregameSelection.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/PregameSelection.java new file mode 100644 index 000000000..ae14c6523 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/PregameSelection.java @@ -0,0 +1,164 @@ +package nautilus.game.arcade.game.games.moba.kit; + +import mineplex.core.common.entity.ClientArmorStand; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilSkull; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.packethandler.IPacketHandler; +import mineplex.core.packethandler.PacketHandler.ListenerPriority; +import mineplex.core.packethandler.PacketInfo; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.games.moba.Moba; +import nautilus.game.arcade.game.games.moba.MobaRole; +import nautilus.game.arcade.kit.Kit; +import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.inventory.ItemStack; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicInteger; + +public class PregameSelection implements Listener, IPacketHandler +{ + + private final Moba _host; + private final Kit[] _kits; + private final Map _roleStands = new HashMap<>(); + + public PregameSelection(Moba host, Kit[] kits) + { + _host = host; + _kits = kits; + + _host.getArcadeManager().getPacketHandler().addPacketHandler(this, ListenerPriority.NORMAL, true, PacketPlayInUseEntity.class); + } + + // Setup + @EventHandler(priority = EventPriority.HIGHEST) + public void prepare(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Prepare) + { + return; + } + + for (GameTeam team : _host.GetTeamList()) + { + if (team.GetColor() == ChatColor.RED) + { + spawnRoleUI(team, "PINK"); + } + else + { + spawnRoleUI(team, "PURPLE"); + } + } + } + + private void spawnRoleUI(GameTeam team, String dataKey) + { + AtomicInteger i = new AtomicInteger(); + List spawns = _host.WorldData.GetDataLocs(dataKey); + Location average = UtilAlg.getAverageLocation(team.GetSpawns()); + Player[] players = team.GetPlayers(true).toArray(new Player[0]); + + ItemStack head = new ItemBuilder(Material.SKULL_ITEM, (byte) 3).build(); + + UtilServer.runSyncLater(() -> + { + for (Location location : spawns) + { + location.setYaw(UtilAlg.GetYaw(UtilAlg.getTrajectory(location, average))); + + MobaRole role = MobaRole.values()[i.getAndIncrement()]; + ClientArmorStand stand = ClientArmorStand.spawn(prepareLocation(location), players); + + stand.setCustomNameVisible(true); + stand.setCustomName(C.cGreenB + role.getName() + C.cGray + " - " + C.cGreenB + "AVAILABLE"); + stand.setArms(true); + stand.setHelmet(head); + stand.setChestplate(buildColouredStack(Material.LEATHER_CHESTPLATE, role)); + stand.setLeggings(buildColouredStack(Material.LEATHER_LEGGINGS, role)); + stand.setBoots(buildColouredStack(Material.LEATHER_BOOTS, role)); + + _roleStands.put(stand, role); + } + }, 5); + } + + private Location prepareLocation(Location location) + { + Block block = location.getBlock(); + + block.setType(Material.SMOOTH_BRICK); + block.setData((byte) 3); + + return location.clone().add(0, 1, 0); + } + + private ItemStack buildColouredStack(Material material, MobaRole role) + { + return new ItemBuilder(material).setColor(role.getColor()).build(); + } + + // Listen for those packety clicks + @Override + public void handle(PacketInfo packetInfo) + { + PacketPlayInUseEntity packet = (PacketPlayInUseEntity) packetInfo.getPacket(); + Player player = packetInfo.getPlayer(); + int entityId = packet.a; + + for (ClientArmorStand stand : _roleStands.keySet()) + { + if (stand.getEntityId() != entityId) + { + continue; + } + + Bukkit.broadcastMessage("Beep beep I'm an amourstand, I said beep beep I have an id of " + entityId); + + packetInfo.setCancelled(true); + + MobaRole role = _roleStands.get(stand); + RoleSelectEvent event = new RoleSelectEvent(player, stand, role); + UtilServer.CallEvent(event); + + if (event.isCancelled()) + { + return; + } + + for (ClientArmorStand stand2 : _roleStands.keySet()) + { + stand2.remove(player); + } + } + } + + // Unregister + @EventHandler + public void live(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Live) + { + return; + } + + _host.getArcadeManager().getPacketHandler().removePacketHandler(this); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/RoleSelectEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/RoleSelectEvent.java new file mode 100644 index 000000000..d4c170c40 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/RoleSelectEvent.java @@ -0,0 +1,61 @@ +package nautilus.game.arcade.game.games.moba.kit; + +import mineplex.core.common.entity.ClientArmorStand; +import nautilus.game.arcade.game.games.moba.MobaRole; +import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; +import org.bukkit.event.HandlerList; +import org.bukkit.event.player.PlayerEvent; + +public class RoleSelectEvent extends PlayerEvent implements Cancellable +{ + + private static final HandlerList _handlers = new HandlerList(); + + private final ClientArmorStand _stand; + private final MobaRole _role; + + private boolean _cancel; + + public RoleSelectEvent(Player who, ClientArmorStand stand, MobaRole role) + { + super(who); + + _stand = stand; + _role = role; + } + + public ClientArmorStand getStand() + { + return _stand; + } + + public MobaRole getRole() + { + return _role; + } + + @Override + public boolean isCancelled() + { + return _cancel; + } + + @Override + public void setCancelled(boolean b) + { + _cancel = b; + } + + public static HandlerList getHandlerList() + { + return _handlers; + } + + @Override + public HandlerList getHandlers() + { + return getHandlerList(); + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/heroes/HeroHattori.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/heroes/HeroHattori.java new file mode 100644 index 000000000..ffda5fba2 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/heroes/HeroHattori.java @@ -0,0 +1,32 @@ +package nautilus.game.arcade.game.games.moba.kit.heroes; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.moba.MobaRole; +import nautilus.game.arcade.game.games.moba.kit.HeroKit; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; +import org.bukkit.Material; +import org.bukkit.inventory.ItemStack; + +public class HeroHattori extends HeroKit +{ + + private static final String[] DESCRIPTION = { + "Something something" + }; + + private static final Perk[] PERKS = { + new PerkDoubleJump("Double Jump", 1, 1, true) + }; + + private static final ItemStack[] PLAYER_ITEMS = { + new ItemStack(Material.WOOD_SWORD), + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.NETHER_STAR); + + public HeroHattori(ArcadeManager manager) + { + super(manager, "Hattori", DESCRIPTION, PERKS, IN_HAND, MobaRole.ASSASSIN); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/recall/Recall.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/recall/Recall.java new file mode 100644 index 000000000..136dd7d1f --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/recall/Recall.java @@ -0,0 +1,136 @@ +package nautilus.game.arcade.game.games.moba.recall; + +import com.sun.org.apache.regexp.internal.RE; +import mineplex.core.common.util.*; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.moba.Moba; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; +import org.jooq.util.derby.sys.Sys; + +import java.util.*; + +public class Recall implements Listener +{ + + private static final int RECALL_TIME = 5000; + private static final double PARTICLE_HEIGHT = 2.5; + private static final double PARTICLE_RADIUS = 2.5; + + private final Moba _host; + + private final Set _sessions; + + public Recall(Moba host) + { + _host = host; + + _sessions = new HashSet<>(); + } + + @EventHandler + public void interactBed(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + Player player = event.getPlayer(); + ItemStack itemStack = player.getItemInHand(); + + if (itemStack == null || itemStack.getType() != Material.BED) + { + return; + } + + _sessions.add(new RecallSession(player)); + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTER) + { + return; + } + + long now = System.currentTimeMillis(); + + for (Player player : _host.GetPlayers(true)) + { + if (!_lastRecallStart.containsKey(player.getUniqueId())) + { + continue; + } + + long start = _lastRecallStart.get(player.getUniqueId()); + + if (UtilTime.elapsed(start, RECALL_TIME)) + { + _host.GetTeam(player).SpawnTeleport(player); + _lastRecallStart.remove(player.getUniqueId()); + } + else + { + Location location = player.getLocation().add(0, 0.25, 0); + double height = (now - start) / RECALL_TIME; + + for (double theta = 0; theta < 2 * Math.PI; theta += Math.PI / 10) + { + double x = PARTICLE_RADIUS * Math.sin(theta); + double z = PARTICLE_RADIUS * Math.cos(theta); + + for (int y = 0; y < height * PARTICLE_HEIGHT; y += 0.5) + { + location.add(x, y, z); + + UtilParticle.PlayParticleToAll(ParticleType.HAPPY_VILLAGER, location, 0, 0, 0, 0.1F, 1, ViewDist.LONG); + + location.subtract(x, y, z); + } + } + } + } + } + + @EventHandler + public void damage(CustomDamageEvent event) + { + if (event.GetDamageePlayer() == null) + { + return; + } + + RecallSession session = + } + + public RecallSession getSession(Player player) + { + for (RecallSession session : _sessions) + { + if (session.Player.equals(player)) + { + return session; + } + } + + return null; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/recall/RecallSession.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/recall/RecallSession.java new file mode 100644 index 000000000..0abca7401 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/recall/RecallSession.java @@ -0,0 +1,19 @@ +package nautilus.game.arcade.game.games.moba.recall; + +import org.bukkit.Location; +import org.bukkit.entity.Player; + +class RecallSession +{ + + public Player Player; + public long Start; + public Location Location; + + public RecallSession(Player player) + { + Player = player; + Start = System.currentTimeMillis(); + Location = player.getLocation(); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/shop/MobaShop.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/shop/MobaShop.java new file mode 100644 index 000000000..95da9011c --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/shop/MobaShop.java @@ -0,0 +1,16 @@ +package nautilus.game.arcade.game.games.moba.shop; + +import nautilus.game.arcade.game.games.moba.Moba; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; + +public class MobaShop implements Listener +{ + + private final Moba _host; + + public MobaShop(Moba host) + { + _host = host; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/structure/point/CapturePoint.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/structure/point/CapturePoint.java index 95cbc8edc..3c5167baa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/structure/point/CapturePoint.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/structure/point/CapturePoint.java @@ -178,8 +178,6 @@ public class CapturePoint private void display(GameTeam team, boolean forward) { - Bukkit.broadcastMessage("progress=" + _progress + " forward=" + forward); - double toChange = Math.ceil(_wool.size() / MAX_PROGRESS) + 1; int changed = 0; for (Block block : _wool) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/structure/tower/Tower.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/structure/tower/Tower.java new file mode 100644 index 000000000..c5d448938 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/structure/tower/Tower.java @@ -0,0 +1,95 @@ +package nautilus.game.arcade.game.games.moba.structure.tower; + +import mineplex.core.common.util.UtilBlock; +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.utils.UtilVariant; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.games.moba.Moba; +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.entity.Guardian; + +public class Tower +{ + + private final Moba _host; + private final Location _location; + private final GameTeam _team; + private int _lane; + private double _health; + private int _maxHealth; + private boolean _firstTower; + private Guardian _guardian; + private boolean _dead; + + public Tower(Moba host, Location location, GameTeam team, int lane, int health, boolean firstTower) + { + _host = host; + _location = location; + _team = team; + _lane = lane; + _health = health; + _maxHealth = health; + _firstTower = firstTower; + } + + public void setup() + { + if (_firstTower) + { + _guardian = _location.getWorld().spawn(_location, Guardian.class); + } + else + { + _guardian = UtilVariant.spawnElderGuardian(_location); + } + + _guardian.setCustomNameVisible(true); + updateDisplay(); + } + + public void updateTarget() + { + + } + + public void damage(double damage) + { + _health -= damage; + + if (_health <= 0) + { + UtilServer.CallEvent(new TowerDestroyEvent(this)); + _dead = true; + _guardian.remove(); + explode(); + } + else + { + updateDisplay(); + } + } + + private void updateDisplay() + { + float percentage = (float) _health / (float) _maxHealth; + + _guardian.setCustomName(UtilTextMiddle.progress(percentage)); + } + + private void explode() + { + _host.getArcadeManager().GetExplosion().BlockExplosion(UtilBlock.getBlocksInRadius(_location.clone().subtract(0, 4, 0), 4), _location, false); + _location.getWorld().playSound(_location, Sound.EXPLODE, 2, 0.6F); + UtilParticle.PlayParticleToAll(ParticleType.HUGE_EXPLOSION, _location, 0, 0, 0, 0.1F, 1, ViewDist.LONG); + } + + public boolean isDead() + { + return _dead; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/structure/tower/TowerDestroyEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/structure/tower/TowerDestroyEvent.java new file mode 100644 index 000000000..a7107a423 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/structure/tower/TowerDestroyEvent.java @@ -0,0 +1,34 @@ +package nautilus.game.arcade.game.games.moba.structure.tower; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class TowerDestroyEvent extends Event +{ + + private static final HandlerList _handlers = new HandlerList(); + + private Tower _tower; + + public TowerDestroyEvent(Tower tower) + { + _tower = tower; + } + + public Tower getTower() + { + return _tower; + } + + public static HandlerList getHandlerList() + { + return _handlers; + } + + @Override + public HandlerList getHandlers() + { + return getHandlerList(); + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java index ce027ddac..1af689550 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java @@ -211,6 +211,8 @@ public abstract class UHC extends Game _state = UHCState.SAFE; + Prepare = false; + HideTeamSheep = true; StrictAntiHack = true; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameHostManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameHostManager.java index 126bb399b..f046626b4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameHostManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameHostManager.java @@ -104,7 +104,7 @@ public class GameHostManager implements Listener ultraGames.add(GameType.MonsterMaze); ultraGames.add(GameType.Gladiators); - //Hero Games + //HeroKit Games heroGames.add(GameType.ChampionsDominate); heroGames.add(GameType.ChampionsTDM); heroGames.add(GameType.ChampionsCTF); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java index 6d3c8e18b..fd1dc5e82 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java @@ -636,7 +636,7 @@ public class GameManager implements Listener return; // Sir, I'll handle this. - if (game instanceof UHC) + if (!game.Prepare) return; final ArrayList players = game.GetPlayers(true); diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/serverreset/ServerResetCommand.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/serverreset/ServerResetCommand.java index 8356e8fd6..d716ee669 100644 --- a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/serverreset/ServerResetCommand.java +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/serverreset/ServerResetCommand.java @@ -44,7 +44,7 @@ public class ServerResetCommand extends CommandBase clientEvent.GetClient().Game().SetEconomyBalance(0); } - File economyDir = new File("economy/"); + File economyDir = new File("shop/"); FilenameFilter statsFilter = new FilenameFilter() {