Remove recalling as it is unused
This commit is contained in:
parent
04fafea3ed
commit
9c5565ac3b
|
@ -46,7 +46,6 @@ import nautilus.game.arcade.game.games.moba.kit.rowena.HeroRowena;
|
|||
import nautilus.game.arcade.game.games.moba.minion.MinionManager;
|
||||
import nautilus.game.arcade.game.games.moba.prepare.PrepareManager;
|
||||
import nautilus.game.arcade.game.games.moba.prepare.PrepareSelection;
|
||||
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.CapturePointManager;
|
||||
import nautilus.game.arcade.game.games.moba.structure.tower.TowerManager;
|
||||
|
@ -138,7 +137,6 @@ public class Moba extends TeamGame
|
|||
registerManager(new HPManager(this));
|
||||
registerManager(new MobaDamageManager(this));
|
||||
registerManager(new MobaFountain(this));
|
||||
registerManager(new Recall(this));
|
||||
|
||||
// Pregame managers
|
||||
registerManager(new PrepareManager(this));
|
||||
|
|
|
@ -3,7 +3,6 @@ package nautilus.game.arcade.game.games.moba.kit;
|
|||
import com.mojang.authlib.GameProfile;
|
||||
import mineplex.core.common.skin.SkinData;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilItem;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
|
@ -41,11 +40,7 @@ public class HeroKit extends Kit
|
|||
private int _maxAmmo;
|
||||
private SkinData _skin;
|
||||
|
||||
private static final int RECALL_SLOT = 8;
|
||||
private static final ItemStack RECALL_ITEM = new ItemBuilder(Material.BED)
|
||||
.setTitle(C.cGreenB + "Recall to your 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();
|
||||
private static final int SHOP_SLOT = 8;
|
||||
private static final ItemStack SHOP_ITEM = new ItemBuilder(Material.GOLD_INGOT)
|
||||
.setTitle(C.cGold + "Open Gold Upgrades")
|
||||
.addLore("Click to open the Gold Upgrades", "shop while you are respawning.")
|
||||
|
@ -173,8 +168,7 @@ public class HeroKit extends Kit
|
|||
|
||||
// Give standard items
|
||||
inventory.setItem(AMMO_SLOT, _ammo);
|
||||
//inventory.setItem(RECALL_SLOT, RECALL_ITEM);
|
||||
inventory.setItem(RECALL_SLOT, SHOP_ITEM);
|
||||
inventory.setItem(SHOP_SLOT, SHOP_ITEM);
|
||||
|
||||
Moba game = (Moba) Manager.GetGame();
|
||||
List<MobaItem> items = game.getShop().getOwnedItems(player);
|
||||
|
|
|
@ -1,153 +0,0 @@
|
|||
package nautilus.game.arcade.game.games.moba.recall;
|
||||
|
||||
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.Bukkit;
|
||||
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 java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
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 = 1.5;
|
||||
|
||||
private final Moba _host;
|
||||
|
||||
private final Set<RecallSession> _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 || getSession(player) != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Recharge.Instance.use(player, "Recall", RECALL_TIME, false, true))
|
||||
{
|
||||
_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))
|
||||
{
|
||||
RecallSession session = getSession(player);
|
||||
|
||||
if (session == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (UtilTime.elapsed(session.Start, RECALL_TIME))
|
||||
{
|
||||
_host.GetTeam(player).SpawnTeleport(player);
|
||||
removeSession(player, null);
|
||||
}
|
||||
else if (UtilMath.offsetSquared(player.getLocation(), session.Location) > 4)
|
||||
{
|
||||
removeSession(player, "You moved!");
|
||||
}
|
||||
else
|
||||
{
|
||||
Location location = session.Location.clone();
|
||||
double height = (double) (now - session.Start) / (double) 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 (double y = 0.25; 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;
|
||||
}
|
||||
|
||||
removeSession(event.GetDamageePlayer(), "You took damage!");
|
||||
}
|
||||
|
||||
private void removeSession(Player player, String reason)
|
||||
{
|
||||
boolean had = _sessions.removeIf(session -> session.Player.equals(player));
|
||||
|
||||
if (had && reason != null)
|
||||
{
|
||||
player.sendMessage(F.main("Game", reason + " You recall has been cancelled"));
|
||||
}
|
||||
}
|
||||
|
||||
private RecallSession getSession(Player player)
|
||||
{
|
||||
for (RecallSession session : _sessions)
|
||||
{
|
||||
if (session.Player.equals(player))
|
||||
{
|
||||
return session;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
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();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue