Kit system
This commit is contained in:
parent
24dd8a7d2d
commit
23d924f137
@ -20,7 +20,7 @@ public class ParticleCoalFumes extends ParticleGadget
|
||||
public ParticleCoalFumes(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Coal Fumes",
|
||||
UtilText.splitLineToArray(C.cGray + "Being on the Naughty List does have some perks... if you love coal, that is...", LineFormat.LORE),
|
||||
UtilText.splitLineToArray(C.cGray + "Being on the Naughty List does have some hattori... if you love coal, that is...", LineFormat.LORE),
|
||||
-1, Material.COAL, (byte) 0);
|
||||
}
|
||||
|
||||
|
@ -674,7 +674,7 @@ public class HubManager extends MiniPlugin implements IChatMessageFormatter
|
||||
_lastPlayerCount = playerCount;
|
||||
Bukkit.getOnlinePlayers().stream().filter(player -> _clientManager.Get(player).GetRank() == Rank.ALL).forEach(player ->
|
||||
{
|
||||
UtilTextBottom.display(C.cGray + "Visit " + F.elem("http://www.mineplex.com/shop") + " for exclusive perks!", player);
|
||||
UtilTextBottom.display(C.cGray + "Visit " + F.elem("http://www.mineplex.com/shop") + " for exclusive hattori!", player);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -295,6 +295,7 @@ public abstract class Game extends ListenerComponent implements Lifetimed
|
||||
public boolean Prepare = true;
|
||||
public long PrepareTime = 9000;
|
||||
public boolean PrepareFreeze = true;
|
||||
public boolean PrepareAutoAnnounce = true;
|
||||
public boolean PlaySoundGameStart = true;
|
||||
|
||||
public double XpMult = 1;
|
||||
|
@ -1,27 +1,39 @@
|
||||
package nautilus.game.arcade.game.games.moba;
|
||||
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.entity.ClientArmorStand;
|
||||
import mineplex.core.common.util.*;
|
||||
import mineplex.core.explosion.ExplosionEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.combat.DeathMessageType;
|
||||
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GamePrepareCountdownCommence;
|
||||
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.kit.*;
|
||||
import nautilus.game.arcade.game.games.moba.kit.devon.HeroDevon;
|
||||
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.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 nautilus.game.arcade.kit.Perk;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class Moba extends TeamGame
|
||||
{
|
||||
@ -29,11 +41,14 @@ public class Moba extends TeamGame
|
||||
private static final String[] DESCRIPTION = {
|
||||
"MORE CAPTURE POINTS"
|
||||
};
|
||||
private static final long PREPARE_TIME = TimeUnit.MINUTES.toMillis(1);
|
||||
|
||||
private final HeroKit[] _kits;
|
||||
|
||||
private final List<CapturePoint> _capturePoints = new ArrayList<>(3);
|
||||
private final List<Tower> _towers = new ArrayList<>(12);
|
||||
|
||||
private final Map<Player, MobaRole> _roles = new HashMap<>();
|
||||
private final Set<MobaPlayer> _playerData = new HashSet<>();
|
||||
|
||||
private final Set<Listener> _listeners = new HashSet<>();
|
||||
|
||||
@ -41,20 +56,28 @@ public class Moba extends TeamGame
|
||||
{
|
||||
super(manager, GameType.MOBA, new Kit[] { new KitPlayer(manager) }, DESCRIPTION);
|
||||
|
||||
//Prepare = false;
|
||||
_kits = new HeroKit[] {
|
||||
new HeroHattori(Manager),
|
||||
new HeroDevon(Manager)
|
||||
};
|
||||
|
||||
PrepareAutoAnnounce = false;
|
||||
PrepareFreeze = false;
|
||||
PrepareTime = PREPARE_TIME;
|
||||
DeathOut = false;
|
||||
DeathSpectateSecs = 10;
|
||||
HungerSet = 20;
|
||||
DontAllowOverfill = false;
|
||||
|
||||
DamageFall = false;
|
||||
|
||||
new CompassModule()
|
||||
.setGiveCompass(true)
|
||||
.setGiveCompassToSpecs(true)
|
||||
.setGiveCompassToAlive(false)
|
||||
.register(this);
|
||||
|
||||
Listener preGameSelection = new PregameSelection(this, null);
|
||||
Listener preGameSelection = new PregameSelection(this);
|
||||
_listeners.add(preGameSelection);
|
||||
|
||||
Listener recall = new Recall(this);
|
||||
@ -105,14 +128,14 @@ public class Moba extends TeamGame
|
||||
|
||||
try
|
||||
{
|
||||
firstTower = Integer.parseInt(components[3]) == 1;
|
||||
firstTower = components[3].equalsIgnoreCase("1");
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
int health = 1000;
|
||||
int health = firstTower ? 250 : 500;
|
||||
GameTeam gameTeam = getTeam(team);
|
||||
|
||||
if (gameTeam == null)
|
||||
@ -157,7 +180,27 @@ public class Moba extends TeamGame
|
||||
|
||||
private void writePrepare()
|
||||
{
|
||||
Scoreboard.writeNewLine();
|
||||
|
||||
Scoreboard.write(C.cYellowB + "Hero Selection");
|
||||
Scoreboard.write(UtilTime.MakeStr(GetStateTime() + PREPARE_TIME - System.currentTimeMillis()));
|
||||
|
||||
Scoreboard.writeNewLine();
|
||||
|
||||
Scoreboard.write(C.cYellowB + "Players");
|
||||
int kits = 0;
|
||||
|
||||
for (MobaPlayer player : _playerData)
|
||||
{
|
||||
if (player.Kit != null)
|
||||
{
|
||||
kits++;
|
||||
}
|
||||
}
|
||||
|
||||
Scoreboard.write(kits + "/" + GetPlayers(true).size());
|
||||
|
||||
Scoreboard.writeNewLine();
|
||||
}
|
||||
|
||||
private void writeLive()
|
||||
@ -178,10 +221,21 @@ public class Moba extends TeamGame
|
||||
return;
|
||||
}
|
||||
|
||||
// Override those kits!
|
||||
setKits(_kits);
|
||||
|
||||
// Store player data
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
_playerData.add(new MobaPlayer(player));
|
||||
}
|
||||
|
||||
CreatureAllowOverride = true;
|
||||
for (Tower tower : _towers)
|
||||
{
|
||||
tower.setup();
|
||||
}
|
||||
CreatureAllowOverride = false;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -191,6 +245,19 @@ public class Moba extends TeamGame
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UtilTextBottom.display(C.cRedB + "!!! Battle !!!", UtilServer.getPlayers());
|
||||
|
||||
for (MobaPlayer mobaPlayer : _playerData)
|
||||
{
|
||||
HeroKit kit = mobaPlayer.Kit;
|
||||
Perk perk = kit.GetPerks()[kit.GetPerks().length - 1];
|
||||
|
||||
if (perk instanceof HeroSkill)
|
||||
{
|
||||
((HeroSkill) perk).useSkill(mobaPlayer.Player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -215,6 +282,118 @@ public class Moba extends TeamGame
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updatePrepare(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC || GetState() != GameState.Prepare)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!UtilTime.elapsed(GetStateTime(), PREPARE_TIME))
|
||||
{
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
Kit kit = GetKit(player);
|
||||
|
||||
if (!(kit instanceof HeroKit))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AnnounceGame();
|
||||
StartPrepareCountdown();
|
||||
|
||||
//Event
|
||||
GamePrepareCountdownCommence countdownEvent = new GamePrepareCountdownCommence(this);
|
||||
UtilServer.CallEvent(countdownEvent);
|
||||
|
||||
// If players took too long, just give them a random free role and kit.
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
Kit kit = GetKit(player);
|
||||
|
||||
if (kit instanceof HeroKit)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
HeroKit heroKit = getRandomKit(player);
|
||||
MobaPlayer mobaPlayer = getData(player);
|
||||
|
||||
mobaPlayer.Role = heroKit.getRole();
|
||||
mobaPlayer.Kit = heroKit;
|
||||
|
||||
SetKit(player, heroKit, true);
|
||||
}
|
||||
|
||||
PrepareTime = 0;
|
||||
Manager.GetChat().Silence(0, false);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void roleSelect(RoleSelectEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
MobaRole role = event.getRole();
|
||||
ClientArmorStand stand = event.getStand();
|
||||
|
||||
if (stand.hasMetadata("owned"))
|
||||
{
|
||||
player.sendMessage(F.main("Game", "Another player has already chosen this role."));
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
// Store inside the stand that it is claimed by a player
|
||||
stand.setMetadata("owned", new FixedMetadataValue(Manager.getPlugin(), true));
|
||||
|
||||
// Show that the kit is claimed.
|
||||
stand.setCustomName(C.cGreenB + role.getName() + C.cGray + " - " + player.getName());
|
||||
|
||||
// Store the role of the player
|
||||
getData(player).Role = role;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void SetKit(Player player, Kit kit, boolean announce)
|
||||
{
|
||||
super.SetKit(player, kit, announce);
|
||||
|
||||
if (kit instanceof HeroKit)
|
||||
{
|
||||
getData(player).Kit = (HeroKit) kit;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void RespawnPlayer(Player player)
|
||||
{
|
||||
MobaPlayer mobaPlayer = getData(player);
|
||||
|
||||
player.eject();
|
||||
Manager.Clear(player);
|
||||
GetTeam(player).SpawnTeleport(player);
|
||||
SetKit(player, mobaPlayer.Kit, false);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void combatDeath(CombatDeathEvent event)
|
||||
{
|
||||
event.SetBroadcastType(DeathMessageType.Detailed);
|
||||
}
|
||||
|
||||
// Clear up memory
|
||||
@EventHandler
|
||||
public void playerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
_playerData.removeIf(mobaPlayer -> mobaPlayer.Player.equals(player));
|
||||
}
|
||||
|
||||
private Map<String, Location> getLocationStartsWith(String s)
|
||||
{
|
||||
Map<String, Location> map = new HashMap<>();
|
||||
@ -234,7 +413,7 @@ public class Moba extends TeamGame
|
||||
{
|
||||
for (GameTeam team : GetTeamList())
|
||||
{
|
||||
if (team.GetName().equals(name))
|
||||
if (team.GetName().equalsIgnoreCase(name))
|
||||
{
|
||||
return team;
|
||||
}
|
||||
@ -242,4 +421,102 @@ public class Moba extends TeamGame
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public HeroKit[] getKits()
|
||||
{
|
||||
return _kits;
|
||||
}
|
||||
|
||||
public List<HeroKit> getKits(MobaRole role)
|
||||
{
|
||||
List<HeroKit> kits = new ArrayList<>();
|
||||
|
||||
for (HeroKit kit : _kits)
|
||||
{
|
||||
if (kit.getRole() == role)
|
||||
{
|
||||
kits.add(kit);
|
||||
}
|
||||
}
|
||||
|
||||
return kits;
|
||||
}
|
||||
|
||||
public MobaPlayer getData(Player player)
|
||||
{
|
||||
for (MobaPlayer mobaPlayer : _playerData)
|
||||
{
|
||||
if (mobaPlayer.Player.equals(player))
|
||||
{
|
||||
return mobaPlayer;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private HeroKit getRandomKit(Player player)
|
||||
{
|
||||
MobaPlayer mobaPlayer = getData(player);
|
||||
|
||||
if (mobaPlayer.Role == null)
|
||||
{
|
||||
MobaRole role = getRandomRole(player);
|
||||
|
||||
return getRandomKit(role);
|
||||
}
|
||||
else if (mobaPlayer.Kit == null)
|
||||
{
|
||||
return getRandomKit(mobaPlayer.Role);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private HeroKit getRandomKit(MobaRole role)
|
||||
{
|
||||
for (HeroKit kit : _kits)
|
||||
{
|
||||
if (kit.getRole() == role)
|
||||
{
|
||||
return kit;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private MobaRole getRandomRole(Player player)
|
||||
{
|
||||
List<MobaRole> roles = new ArrayList<>();
|
||||
|
||||
for (MobaPlayer mobaPlayer : getTeamData(GetTeam(player)))
|
||||
{
|
||||
MobaRole role = mobaPlayer.Role;
|
||||
|
||||
if (role != null)
|
||||
{
|
||||
roles.add(role);
|
||||
}
|
||||
}
|
||||
|
||||
return UtilAlg.Random(Arrays.asList(MobaRole.values()), roles);
|
||||
}
|
||||
|
||||
public List<MobaPlayer> getTeamData(GameTeam team)
|
||||
{
|
||||
List<MobaPlayer> players = new ArrayList<>();
|
||||
|
||||
for (MobaPlayer mobaPlayer : _playerData)
|
||||
{
|
||||
GameTeam otherTeam = GetTeam(mobaPlayer.Player);
|
||||
|
||||
if (team.equals(otherTeam))
|
||||
{
|
||||
players.add(mobaPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
return players;
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package nautilus.game.arcade.game.games.moba;
|
||||
|
||||
import nautilus.game.arcade.game.games.moba.kit.HeroKit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class MobaPlayer
|
||||
{
|
||||
|
||||
public final Player Player;
|
||||
public MobaRole Role;
|
||||
public HeroKit Kit;
|
||||
|
||||
public MobaPlayer(Player player)
|
||||
{
|
||||
Player = player;
|
||||
}
|
||||
}
|
@ -1,26 +1,26 @@
|
||||
package nautilus.game.arcade.game.games.moba;
|
||||
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Color;
|
||||
|
||||
public enum MobaRole
|
||||
{
|
||||
|
||||
ASSASSIN("Assassin", Color.BLUE, null),
|
||||
HUNTER("Hunter", Color.LIME, null),
|
||||
MAGE("Mage", Color.RED, null),
|
||||
WARRIOR("Warrior", Color.YELLOW, null),
|
||||
ASSASSIN("Assassin", Color.BLUE, ChatColor.AQUA),
|
||||
HUNTER("Hunter", Color.LIME, ChatColor.GREEN),
|
||||
MAGE("Mage", Color.RED, ChatColor.RED),
|
||||
WARRIOR("Warrior", Color.YELLOW, ChatColor.GOLD),
|
||||
;
|
||||
|
||||
private String _name;
|
||||
private Color _color;
|
||||
private Kit[] _kits;
|
||||
private ChatColor _chatColor;
|
||||
|
||||
MobaRole(String name, Color color, Kit[] kits)
|
||||
MobaRole(String name, Color color, ChatColor chatColor)
|
||||
{
|
||||
_name = name;
|
||||
_color = color;
|
||||
_kits = kits;
|
||||
_chatColor = chatColor;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
@ -33,8 +33,8 @@ public enum MobaRole
|
||||
return _color;
|
||||
}
|
||||
|
||||
public Kit[] getKits()
|
||||
public ChatColor getChatColor()
|
||||
{
|
||||
return _kits;
|
||||
return _chatColor;
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.moba.kit;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
@ -11,6 +12,7 @@ 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.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -29,8 +31,8 @@ public class HeroKit extends Kit
|
||||
|
||||
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.")
|
||||
.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();
|
||||
|
||||
public HeroKit(ArcadeManager manager, String name, String[] kitDesc, Perk[] kitPerks, ItemStack itemInHand, MobaRole role)
|
||||
@ -38,6 +40,7 @@ public class HeroKit extends Kit
|
||||
super(manager, name, KitAvailability.Free, kitDesc, kitPerks, null, itemInHand);
|
||||
|
||||
_role = role;
|
||||
_maxAmmo = 64;
|
||||
}
|
||||
|
||||
public MobaRole getRole()
|
||||
@ -73,14 +76,14 @@ public class HeroKit extends Kit
|
||||
@EventHandler
|
||||
public void giveAmmo(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK || Manager.GetGame() == null || !Manager.GetGame().IsLive())
|
||||
if (event.getType() != UpdateType.FASTEST || Manager.GetGame() == null || !Manager.GetGame().IsLive() || _ammo == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (Player player : Manager.GetGame().GetPlayers(true))
|
||||
{
|
||||
if (!HasKit(player))
|
||||
if (!HasKit(player) || UtilPlayer.isSpectator(player))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -99,7 +102,6 @@ public class HeroKit extends Kit
|
||||
{
|
||||
itemStack = _ammo;
|
||||
player.getInventory().setItem(AMMO_SLOT, itemStack);
|
||||
player.updateInventory();
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -109,7 +111,6 @@ public class HeroKit extends Kit
|
||||
}
|
||||
|
||||
itemStack.setAmount(itemStack.getAmount() + 1);
|
||||
player.updateInventory();
|
||||
}
|
||||
}
|
||||
|
||||
@ -120,5 +121,24 @@ public class HeroKit extends Kit
|
||||
|
||||
inventory.setItem(AMMO_SLOT, _ammo);
|
||||
inventory.setItem(RECALL_SLOT, RECALL_ITEM);
|
||||
|
||||
Bukkit.broadcastMessage("");
|
||||
Bukkit.broadcastMessage(player.getName());
|
||||
|
||||
for (Perk perk : GetPerks())
|
||||
{
|
||||
if (!(perk instanceof HeroSkill))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
HeroSkill skill = (HeroSkill) perk;
|
||||
|
||||
if (skill.getItemStack() != null)
|
||||
{
|
||||
Bukkit.broadcastMessage("Giving kit " + GetName() + ", perk " + skill.GetName() + ", item " + skill.getItemStack().getItemMeta().getDisplayName());
|
||||
inventory.setItem(skill.getSlot(), skill.isOnCooldown(player) ? skill.getCooldownItemStack() : skill.getItemStack());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,227 @@
|
||||
package nautilus.game.arcade.game.games.moba.kit;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.events.PlayerKitGiveEvent;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public class HeroSkill extends Perk
|
||||
{
|
||||
|
||||
private ItemStack _item;
|
||||
private ItemStack _cooldownItem;
|
||||
private final int _slot;
|
||||
private final ActionType _actionType;
|
||||
private final boolean _sneakActivate;
|
||||
|
||||
private long _cooldown;
|
||||
|
||||
private final Map<UUID, Long> _lastSkill = new HashMap<>();
|
||||
|
||||
public HeroSkill(String name, String[] perkDesc)
|
||||
{
|
||||
this(name, perkDesc, null, -1, null);
|
||||
}
|
||||
|
||||
public HeroSkill(String name, String[] perkDesc, ItemStack itemStack, int slot, ActionType actionType)
|
||||
{
|
||||
this(name, perkDesc, itemStack, slot, actionType, false);
|
||||
}
|
||||
|
||||
public HeroSkill(String name, String[] perkDesc, ItemStack itemStack, int slot, ActionType actionType, boolean sneakActivate)
|
||||
{
|
||||
super(name, perkDesc);
|
||||
|
||||
_item = itemStack;
|
||||
_slot = slot;
|
||||
_actionType = actionType;
|
||||
_sneakActivate = sneakActivate;
|
||||
|
||||
prettifyItem();
|
||||
}
|
||||
|
||||
protected void setCooldown(long cooldown)
|
||||
{
|
||||
_cooldown = cooldown;
|
||||
}
|
||||
|
||||
private void prettifyItem()
|
||||
{
|
||||
String action = "Click";
|
||||
|
||||
if (_actionType == ActionType.L)
|
||||
{
|
||||
action = "Left Click";
|
||||
}
|
||||
else if (_actionType == ActionType.R)
|
||||
{
|
||||
action = "Right Click";
|
||||
}
|
||||
|
||||
if (_sneakActivate)
|
||||
{
|
||||
action += "/Sneak";
|
||||
}
|
||||
|
||||
_item = new ItemBuilder(_item)
|
||||
.setTitle(C.cYellowB + action + C.cGray + " - " + C.cGreenB + GetName())
|
||||
.addLore(GetDesc())
|
||||
.build();
|
||||
_cooldownItem = new ItemBuilder(Material.INK_SACK, (byte) 8)
|
||||
.setTitle(C.cRed + GetName())
|
||||
.addLore(GetDesc())
|
||||
.build();
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void SetHost(Kit kit)
|
||||
// {
|
||||
// super.SetHost(kit);
|
||||
//
|
||||
// _kit = (HeroKit) kit;
|
||||
// }
|
||||
|
||||
@EventHandler
|
||||
public void giveItem(PlayerKitGiveEvent event)
|
||||
{
|
||||
event.getPlayer().getInventory().setItem(_slot, isOnCooldown(event.getPlayer()) ? _cooldownItem : _item);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void clearCooldowns(PlayerQuitEvent event)
|
||||
{
|
||||
UUID key = event.getPlayer().getUniqueId();
|
||||
|
||||
_lastSkill.remove(key);
|
||||
}
|
||||
|
||||
protected boolean isSkillItem(PlayerInteractEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!UtilEvent.isAction(event, _actionType))
|
||||
{
|
||||
if (_actionType != null || event.getAction() == Action.PHYSICAL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
ItemStack itemStack = event.getItem();
|
||||
|
||||
if (!hasPerk(player) || UtilPlayer.isSpectator(player) || itemStack == null || !itemStack.isSimilar(_item))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean isSkillSneak(PlayerToggleSneakEvent event)
|
||||
{
|
||||
if (event.isCancelled() || !event.isSneaking())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!hasPerk(player) || UtilPlayer.isSpectator(player) || !player.getInventory().getItem(_slot).isSimilar(_item))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void useSkill(Player player)
|
||||
{
|
||||
_lastSkill.put(player.getUniqueId(), System.currentTimeMillis());
|
||||
if (_cooldown > 0 && !UtilPlayer.isSpectator(player))
|
||||
{
|
||||
player.getInventory().setItem(_slot, _cooldownItem);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateCooldowns(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FASTEST || _item == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
long current = System.currentTimeMillis();
|
||||
|
||||
for (Player player : Manager.GetGame().GetPlayers(true))
|
||||
{
|
||||
if (!hasPerk(player) || UtilPlayer.isSpectator(player) || !_lastSkill.containsKey(player.getUniqueId()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ItemStack itemStack = player.getInventory().getItem(_slot);
|
||||
long start = _lastSkill.get(player.getUniqueId());
|
||||
long cooldown = _cooldown;
|
||||
|
||||
//TODO Shop cooldown reduction
|
||||
|
||||
boolean done = UtilTime.elapsed(start, cooldown);
|
||||
|
||||
if (done)
|
||||
{
|
||||
_lastSkill.remove(player.getUniqueId());
|
||||
player.getInventory().setItem(_slot, _item);
|
||||
}
|
||||
else
|
||||
{
|
||||
long timeDiff = current - start;
|
||||
double amount = (int) (cooldown / 1000) - Math.ceil((double) timeDiff / 1000);
|
||||
|
||||
itemStack.setAmount((int) amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack getItemStack()
|
||||
{
|
||||
return _item;
|
||||
}
|
||||
|
||||
public ItemStack getCooldownItemStack()
|
||||
{
|
||||
return _cooldownItem;
|
||||
}
|
||||
|
||||
public int getSlot()
|
||||
{
|
||||
return _slot;
|
||||
}
|
||||
|
||||
public boolean isOnCooldown(Player player)
|
||||
{
|
||||
return _lastSkill.containsKey(player.getUniqueId());
|
||||
}
|
||||
}
|
@ -1,25 +1,22 @@
|
||||
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.common.util.*;
|
||||
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.events.PlayerKitApplyEvent;
|
||||
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.MobaPlayer;
|
||||
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.*;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -36,13 +33,12 @@ public class PregameSelection implements Listener, IPacketHandler
|
||||
{
|
||||
|
||||
private final Moba _host;
|
||||
private final Kit[] _kits;
|
||||
private final Map<ClientArmorStand, MobaRole> _roleStands = new HashMap<>();
|
||||
private final Map<ClientArmorStand, HeroKit> _kitStands = new HashMap<>();
|
||||
|
||||
public PregameSelection(Moba host, Kit[] kits)
|
||||
public PregameSelection(Moba host)
|
||||
{
|
||||
_host = host;
|
||||
_kits = kits;
|
||||
|
||||
_host.getArcadeManager().getPacketHandler().addPacketHandler(this, ListenerPriority.NORMAL, true, PacketPlayInUseEntity.class);
|
||||
}
|
||||
@ -80,6 +76,11 @@ public class PregameSelection implements Listener, IPacketHandler
|
||||
|
||||
UtilServer.runSyncLater(() ->
|
||||
{
|
||||
for (Player player : _host.GetPlayers(true))
|
||||
{
|
||||
displayRoleInformation(player);
|
||||
}
|
||||
|
||||
for (Location location : spawns)
|
||||
{
|
||||
location.setYaw(UtilAlg.GetYaw(UtilAlg.getTrajectory(location, average)));
|
||||
@ -100,6 +101,48 @@ public class PregameSelection implements Listener, IPacketHandler
|
||||
}, 5);
|
||||
}
|
||||
|
||||
private void spawnKitUI(Player player, String dataKey)
|
||||
{
|
||||
AtomicInteger i = new AtomicInteger();
|
||||
GameTeam team = _host.GetTeam(player);
|
||||
List<Location> spawns = _host.WorldData.GetDataLocs(dataKey);
|
||||
Location average = UtilAlg.getAverageLocation(team.GetSpawns());
|
||||
|
||||
MobaPlayer mobaPlayer = _host.getData(player);
|
||||
|
||||
List<HeroKit> heroKits = _host.getKits(mobaPlayer.Role);
|
||||
|
||||
ItemStack head = new ItemBuilder(Material.SKULL_ITEM, (byte) 2).build();
|
||||
|
||||
UtilServer.runSyncLater(() ->
|
||||
{
|
||||
for (Location location : spawns)
|
||||
{
|
||||
location.setYaw(UtilAlg.GetYaw(UtilAlg.getTrajectory(location, average)));
|
||||
|
||||
HeroKit kit = heroKits.get(i.getAndIncrement());
|
||||
ClientArmorStand stand = ClientArmorStand.spawn(location.clone().add(0, 1, 0), player);
|
||||
|
||||
stand.setCustomNameVisible(true);
|
||||
stand.setCustomName(C.cGreenB + kit.GetName());
|
||||
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));
|
||||
FireworkEffect effect = FireworkEffect.builder().with(Type.BURST).withColor(Color.LIME).withFade(Color.WHITE).withFlicker().build();
|
||||
UtilFirework.playFirework(stand.getLocation(), effect);
|
||||
|
||||
_kitStands.put(stand, kit);
|
||||
|
||||
if (i.get() == heroKits.size())
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}, 20);
|
||||
}
|
||||
|
||||
private Location prepareLocation(Location location)
|
||||
{
|
||||
Block block = location.getBlock();
|
||||
@ -115,6 +158,12 @@ public class PregameSelection implements Listener, IPacketHandler
|
||||
return new ItemBuilder(material).setColor(role.getColor()).build();
|
||||
}
|
||||
|
||||
private void removePodiums()
|
||||
{
|
||||
_host.WorldData.GetDataLocs("PINK").forEach(location -> location.getBlock().setType(Material.AIR));
|
||||
_host.WorldData.GetDataLocs("PURPLE").forEach(location -> location.getBlock().setType(Material.AIR));
|
||||
}
|
||||
|
||||
// Listen for those packety clicks
|
||||
@Override
|
||||
public void handle(PacketInfo packetInfo)
|
||||
@ -130,8 +179,6 @@ public class PregameSelection implements Listener, IPacketHandler
|
||||
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);
|
||||
@ -147,7 +194,54 @@ public class PregameSelection implements Listener, IPacketHandler
|
||||
{
|
||||
stand2.remove(player);
|
||||
}
|
||||
|
||||
GameTeam team = _host.GetTeam(player);
|
||||
|
||||
if (team == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (team.GetColor() == ChatColor.RED)
|
||||
{
|
||||
spawnKitUI(player, "PINK");
|
||||
}
|
||||
else
|
||||
{
|
||||
spawnKitUI(player, "PURPLE");
|
||||
}
|
||||
|
||||
displayKitInformation(player, role);
|
||||
}
|
||||
|
||||
for (ClientArmorStand stand : _kitStands.keySet())
|
||||
{
|
||||
if (stand.getEntityId() != entityId)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
packetInfo.setCancelled(true);
|
||||
|
||||
HeroKit kit = _kitStands.get(stand);
|
||||
|
||||
for (ClientArmorStand stand2 : _kitStands.keySet())
|
||||
{
|
||||
stand2.remove(player);
|
||||
}
|
||||
|
||||
_host.SetKit(player, kit, true);
|
||||
}
|
||||
}
|
||||
|
||||
private void displayRoleInformation(Player player)
|
||||
{
|
||||
UtilTextMiddle.display(C.cYellowB + "Role", "Select the role you would like to play", 10, 40, 10, player);
|
||||
}
|
||||
|
||||
private void displayKitInformation(Player player, MobaRole role)
|
||||
{
|
||||
UtilTextMiddle.display(role.getChatColor() + role.getName(), "Select your " + role.getChatColor() + "Hero", 10, 40, 10, player);
|
||||
}
|
||||
|
||||
// Unregister
|
||||
@ -159,6 +253,17 @@ public class PregameSelection implements Listener, IPacketHandler
|
||||
return;
|
||||
}
|
||||
|
||||
for (ClientArmorStand stand : _roleStands.keySet())
|
||||
{
|
||||
stand.remove();
|
||||
}
|
||||
|
||||
for (ClientArmorStand stand : _kitStands.keySet())
|
||||
{
|
||||
stand.remove();
|
||||
}
|
||||
|
||||
removePodiums();
|
||||
_host.getArcadeManager().getPacketHandler().removePacketHandler(this);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,59 @@
|
||||
package nautilus.game.arcade.game.games.moba.kit.devon;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
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.game.games.moba.kit.hattori.SkillDash;
|
||||
import nautilus.game.arcade.game.games.moba.kit.hattori.SkillNinjaBlade;
|
||||
import nautilus.game.arcade.game.games.moba.kit.hattori.SkillSnowball;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.PerkFletcher;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
|
||||
public class HeroDevon extends HeroKit
|
||||
{
|
||||
|
||||
private static final String[] DESCRIPTION = {
|
||||
"Something something"
|
||||
};
|
||||
|
||||
private static final Perk[] PERKS = {
|
||||
new SkillTNTArrows(1),
|
||||
new SkillBoost(2),
|
||||
new SkillInfinity(3)
|
||||
};
|
||||
|
||||
private static final ItemStack IN_HAND = new ItemStack(Material.BOW);
|
||||
|
||||
private static final ItemStack BOW = new ItemBuilder(Material.BOW)
|
||||
.setTitle(C.cGreenB + "Bow")
|
||||
.setUnbreakable(true)
|
||||
.build();
|
||||
|
||||
private static final ItemStack AMMO = new ItemBuilder(Material.ARROW)
|
||||
.setTitle(C.cYellowB + "Hunting Arrow")
|
||||
.build();
|
||||
|
||||
public HeroDevon(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Devon", DESCRIPTION, PERKS, IN_HAND, MobaRole.HUNTER);
|
||||
|
||||
setAmmo(AMMO, 3000);
|
||||
setMaxAmmo(3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
// TODO remove this when shop is implemented
|
||||
PlayerInventory inventory = player.getInventory();
|
||||
inventory.setItem(0, BOW);
|
||||
|
||||
super.GiveItems(player);
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package nautilus.game.arcade.game.games.moba.kit.devon;
|
||||
|
||||
import mineplex.minecraft.game.core.condition.ConditionFactory;
|
||||
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class SkillBoost extends HeroSkill
|
||||
{
|
||||
|
||||
private static final String[] DESCRIPTION = {
|
||||
"Gain Speed II and Jump Boost I for 3 seconds.",
|
||||
};
|
||||
private static final ItemStack SKILL_ITEM = new ItemStack(Material.FEATHER);
|
||||
|
||||
public SkillBoost(int slot)
|
||||
{
|
||||
super("Hunters Boost", DESCRIPTION, SKILL_ITEM, slot, null, true);
|
||||
|
||||
setCooldown(10000);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void interact(PlayerInteractEvent event)
|
||||
{
|
||||
if (!isSkillItem(event))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
useSkill(player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void toggleSneak(PlayerToggleSneakEvent event)
|
||||
{
|
||||
if (!isSkillSneak(event))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
useSkill(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void useSkill(Player player)
|
||||
{
|
||||
super.useSkill(player);
|
||||
|
||||
ConditionFactory factory = Manager.GetCondition().Factory();
|
||||
int time = 3;
|
||||
|
||||
factory.Speed(GetName(), player, null, time, 1, true, true, false);
|
||||
factory.Jump(GetName(), player, null, time, 0, true, true, false);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,114 @@
|
||||
package nautilus.game.arcade.game.games.moba.kit.devon;
|
||||
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class SkillInfinity extends HeroSkill
|
||||
{
|
||||
|
||||
private static final String[] DESCRIPTION = {
|
||||
"For 7 seconds, your arrow shots don't consume arrows.",
|
||||
"They also become heat-seeking and inflict wither onto players."
|
||||
};
|
||||
private static final ItemStack SKILL_ITEM = new ItemStack(Material.NETHER_STAR);
|
||||
|
||||
private final Map<Entity, Player> _arrows = new HashMap<>();
|
||||
|
||||
public SkillInfinity(int slot)
|
||||
{
|
||||
super("Infinity", DESCRIPTION, SKILL_ITEM, slot, null);
|
||||
|
||||
setCooldown(60000);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void interact(PlayerInteractEvent event)
|
||||
{
|
||||
if (!isSkillItem(event))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
ItemStack bow = player.getInventory().getItem(0);
|
||||
|
||||
if (bow == null || bow.getType() != Material.BOW)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bow.addEnchantment(Enchantment.ARROW_INFINITE, 0);
|
||||
Recharge.Instance.useForce(player, GetName(), 7000, false);
|
||||
|
||||
Manager.runSyncLater(() -> bow.removeEnchantment(Enchantment.ARROW_INFINITE), 7 * 20);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void shootArrow(EntityShootBowEvent event)
|
||||
{
|
||||
if (!(event.getEntity() instanceof Player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = (Player) event.getEntity();
|
||||
|
||||
_arrows.put(event.getProjectile(), player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateArrowTarget(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FASTEST || !Manager.isGameInProgress())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (Entry<Entity, Player> entry : _arrows.entrySet())
|
||||
{
|
||||
Entity entity = entry.getKey();
|
||||
Player player = entry.getValue();
|
||||
GameTeam team = Manager.GetGame().GetTeam(player);
|
||||
|
||||
for (LivingEntity nearby : UtilEnt.getInRadius(entity.getLocation(), 3).keySet())
|
||||
{
|
||||
if (nearby instanceof Player)
|
||||
{
|
||||
// If the target is on the same team
|
||||
if (team.equals(Manager.GetGame().GetTeam((Player) nearby)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
entity.setVelocity(UtilAlg.getTrajectory(entity.getLocation(), nearby.getLocation()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void projectileHit(ProjectileHitEvent event)
|
||||
{
|
||||
_arrows.remove(event.getEntity());
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,104 @@
|
||||
package nautilus.game.arcade.game.games.moba.kit.devon;
|
||||
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.projectile.IThrown;
|
||||
import mineplex.core.projectile.ProjectileUser;
|
||||
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
|
||||
import nautilus.game.arcade.game.games.moba.kit.hattori.SkillSnowball;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public class SkillTNTArrows extends HeroSkill implements IThrown
|
||||
{
|
||||
|
||||
private static final String[] DESCRIPTION = {
|
||||
"Your next 3 arrows are infused with TNT.",
|
||||
"They explode on contact dealing damage and knockback."
|
||||
};
|
||||
private static final ItemStack SKILL_ITEM = new ItemStack(Material.TNT);
|
||||
|
||||
private final Map<UUID, Integer> _arrows = new HashMap<>();
|
||||
|
||||
public SkillTNTArrows(int slot)
|
||||
{
|
||||
super("TNT Infusion", DESCRIPTION, SKILL_ITEM, slot, null);
|
||||
|
||||
setCooldown(17000);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void interact(PlayerInteractEvent event)
|
||||
{
|
||||
if (!isSkillItem(event))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
_arrows.put(player.getUniqueId(), 3);
|
||||
player.getItemInHand().addEnchantment(UtilInv.getDullEnchantment(), 1);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void shootArrow(EntityShootBowEvent event)
|
||||
{
|
||||
if (!(event.getEntity() instanceof Player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = (Player) event.getEntity();
|
||||
|
||||
if (!hasPerk(player) || !_arrows.containsKey(player.getUniqueId()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int arrows = _arrows.get(player.getUniqueId());
|
||||
|
||||
if (arrows == 1)
|
||||
{
|
||||
_arrows.remove(player.getUniqueId());
|
||||
useSkill(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
_arrows.put(player.getUniqueId(), arrows - 1);
|
||||
}
|
||||
|
||||
Manager.GetProjectile().AddThrow(event.getProjectile(), player, this, -1, true, true, true, false, 0.5F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Collide(LivingEntity target, Block block, ProjectileUser data)
|
||||
{
|
||||
Location location = data.getThrown().getLocation();
|
||||
location.getWorld().createExplosion(location.getX(), location.getY(), location.getZ(), 4, false, false);
|
||||
data.getThrown().remove();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Idle(ProjectileUser data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Expire(ProjectileUser data)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,54 @@
|
||||
package nautilus.game.arcade.game.games.moba.kit.hattori;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
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.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
|
||||
public class HeroHattori extends HeroKit
|
||||
{
|
||||
|
||||
private static final String[] DESCRIPTION = {
|
||||
"Something something"
|
||||
};
|
||||
|
||||
private static final Perk[] PERKS = {
|
||||
new PerkDoubleJump("Double Jump", 1, 1, true),
|
||||
new SkillSnowball(0),
|
||||
new SkillDash(2),
|
||||
new SkillNinjaBlade(3)
|
||||
};
|
||||
|
||||
private static final ItemStack IN_HAND = new ItemStack(Material.NETHER_STAR);
|
||||
|
||||
private static final ItemStack SWORD = new ItemBuilder(Material.WOOD_SWORD)
|
||||
.setTitle(C.cGreenB + "Sword")
|
||||
.setUnbreakable(true)
|
||||
.build();
|
||||
|
||||
public HeroHattori(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Hattori", DESCRIPTION, PERKS, IN_HAND, MobaRole.ASSASSIN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
Bukkit.broadcastMessage("Hello " + player.getName());
|
||||
|
||||
// TODO remove this when shop is implemented
|
||||
PlayerInventory inventory = player.getInventory();
|
||||
inventory.setItem(1, SWORD);
|
||||
|
||||
Bukkit.broadcastMessage("Now call the super for " + player.getName());
|
||||
super.GiveItems(player);
|
||||
}
|
||||
}
|
@ -0,0 +1,105 @@
|
||||
package nautilus.game.arcade.game.games.moba.kit.hattori;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.particles.effects.LineParticle;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
|
||||
import org.bukkit.FireworkEffect;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public class SkillDash extends HeroSkill
|
||||
{
|
||||
|
||||
private static final String[] DESCRIPTION = {
|
||||
"Dash forward dealing damage to any enemy",
|
||||
"you collide with."
|
||||
};
|
||||
|
||||
private static final ItemStack SKILL_ITEM = new ItemStack(Material.FEATHER);
|
||||
|
||||
public SkillDash(int slot)
|
||||
{
|
||||
super("Dash", DESCRIPTION, SKILL_ITEM, slot, null, true);
|
||||
|
||||
setCooldown(7000);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void interact(PlayerInteractEvent event)
|
||||
{
|
||||
if (!isSkillItem(event))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
useSkill(player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void toggleSneak(PlayerToggleSneakEvent event)
|
||||
{
|
||||
if (!isSkillSneak(event))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
useSkill(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void useSkill(Player player)
|
||||
{
|
||||
super.useSkill(player);
|
||||
|
||||
LineParticle lineParticle = new LineParticle(player.getEyeLocation(), player.getLocation().getDirection(), 0.8, 10, null, ParticleType.FIREWORKS_SPARK,
|
||||
UtilServer.getPlayers());
|
||||
Set<UUID> hitPlayers = new HashSet<>();
|
||||
Game game = Manager.GetGame();
|
||||
GameTeam team = game.GetTeam(player);
|
||||
|
||||
while (!lineParticle.update())
|
||||
{
|
||||
for (Player other : UtilPlayer.getNearby(lineParticle.getLastLocation(), 2))
|
||||
{
|
||||
if (hitPlayers.contains(other.getUniqueId()) || player.equals(other) || team.equals(game.GetTeam(other)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
hitPlayers.add(other.getUniqueId());
|
||||
Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, 8, true, true, false, player.getName(), GetName());
|
||||
player.sendMessage(F.main("Game", "You hit " + F.elem(other.getName()) + " with " + F.skill(GetName()) + "."));
|
||||
}
|
||||
}
|
||||
|
||||
Location location = lineParticle.getDestination();
|
||||
FireworkEffect effect = FireworkEffect.builder().with(Type.BALL).withColor(team.GetColorBase()).withFlicker().build();
|
||||
|
||||
UtilFirework.playFirework(player.getLocation(), effect);
|
||||
player.teleport(location.add(0, 0.5, 0));
|
||||
UtilFirework.playFirework(player.getLocation(), effect);
|
||||
|
||||
player.sendMessage(F.main("Game", "You used " + F.skill(GetName()) + "."));
|
||||
}
|
||||
}
|
@ -0,0 +1,94 @@
|
||||
package nautilus.game.arcade.game.games.moba.kit.hattori;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public class SkillNinjaBlade extends HeroSkill
|
||||
{
|
||||
|
||||
private static final String[] DESCRIPTION = {
|
||||
"Turns into a Diamond Sword that deals extreme",
|
||||
"damage to any player hit by it."
|
||||
};
|
||||
private static final ItemStack SKILL_ITEM = new ItemStack(Material.NETHER_STAR);
|
||||
private static final ItemStack ACTIVE_ITEM = new ItemBuilder(Material.DIAMOND_SWORD)
|
||||
.setTitle(C.cGreenB + "NINJA BLADE")
|
||||
.build();
|
||||
|
||||
private Set<UUID> _active = new HashSet<>();
|
||||
|
||||
public SkillNinjaBlade(int slot)
|
||||
{
|
||||
super("Ninja Blade", DESCRIPTION, SKILL_ITEM, slot, null);
|
||||
|
||||
setCooldown(60000);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void interact(PlayerInteractEvent event)
|
||||
{
|
||||
if (!isSkillItem(event))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
player.getInventory().setItem(getSlot(), ACTIVE_ITEM);
|
||||
_active.add(player.getUniqueId());
|
||||
Recharge.Instance.useForce(player, GetName(), 7000, true);
|
||||
|
||||
Manager.runSyncLater(() ->
|
||||
{
|
||||
|
||||
_active.remove(player.getUniqueId());
|
||||
useSkill(player);
|
||||
|
||||
}, 7 * 20);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void damage(CustomDamageEvent event)
|
||||
{
|
||||
Entity entity = event.GetDamageeEntity();
|
||||
Player player = event.GetDamagerPlayer(false);
|
||||
Player damageePlayer = event.GetDamageePlayer();
|
||||
|
||||
if (player != null && damageePlayer != null)
|
||||
{
|
||||
Game game = Manager.GetGame();
|
||||
if (game.GetTeam(player).equals(game.GetTeam(damageePlayer)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (player == null || !_active.contains(player.getUniqueId()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UtilParticle.PlayParticleToAll(ParticleType.HAPPY_VILLAGER, entity.getLocation().add(0, 1, 0), 1F, 1F, 1F, 0.1F, 50, ViewDist.LONG);
|
||||
entity.getWorld().playSound(entity.getLocation(), Sound.EXPLODE, 2, 0.5F);
|
||||
event.AddMod(GetName(), 4);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,91 @@
|
||||
package nautilus.game.arcade.game.games.moba.kit.hattori;
|
||||
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.projectile.IThrown;
|
||||
import mineplex.core.projectile.ProjectileUser;
|
||||
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.entity.Snowball;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class SkillSnowball extends HeroSkill implements IThrown
|
||||
{
|
||||
|
||||
private static final String[] DESCRIPTION = {
|
||||
"Fires 3 snowballs, one after another.",
|
||||
"Each snowball deals 3 damage to any enemy it hits."
|
||||
};
|
||||
private static final ItemStack SKILL_ITEM = new ItemStack(Material.SNOW_BALL);
|
||||
|
||||
public SkillSnowball(int slot)
|
||||
{
|
||||
super("Snowball", DESCRIPTION, SKILL_ITEM, slot, null);
|
||||
|
||||
setCooldown(1000);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void interact(PlayerInteractEvent event)
|
||||
{
|
||||
if (!isSkillItem(event))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
useSkill(player);
|
||||
|
||||
Manager.runSyncTimer(new BukkitRunnable()
|
||||
{
|
||||
int balls = 0;
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
Snowball snowball = player.launchProjectile(Snowball.class);
|
||||
|
||||
Manager.GetProjectile().AddThrow(snowball, player, SkillSnowball.this, -1, true, true, true, false, 0.5F);
|
||||
|
||||
if (++balls == 3)
|
||||
{
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
}, 0, 4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Collide(LivingEntity target, Block block, ProjectileUser data)
|
||||
{
|
||||
Player thrower = (Player) data.getThrower();
|
||||
|
||||
if (target != null)
|
||||
{
|
||||
thrower.playSound(thrower.getLocation(), Sound.LAVA_POP, 1, 1.3F);
|
||||
Manager.GetDamage().NewDamageEvent(target, thrower, (Projectile) data.getThrown(), DamageCause.PROJECTILE, 3, true, true, false, UtilEnt.getName(thrower), GetName());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Idle(ProjectileUser data)
|
||||
{
|
||||
data.getThrown().remove();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Expire(ProjectileUser data)
|
||||
{
|
||||
data.getThrown().remove();
|
||||
}
|
||||
}
|
||||
|
@ -1,32 +0,0 @@
|
||||
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);
|
||||
}
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
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;
|
||||
@ -10,6 +9,7 @@ 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;
|
||||
@ -17,16 +17,16 @@ 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.*;
|
||||
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 = 2.5;
|
||||
private static final double PARTICLE_RADIUS = 1.5;
|
||||
|
||||
private final Moba _host;
|
||||
|
||||
@ -55,13 +55,16 @@ public class Recall implements Listener
|
||||
Player player = event.getPlayer();
|
||||
ItemStack itemStack = player.getItemInHand();
|
||||
|
||||
if (itemStack == null || itemStack.getType() != Material.BED)
|
||||
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)
|
||||
@ -75,29 +78,33 @@ public class Recall implements Listener
|
||||
|
||||
for (Player player : _host.GetPlayers(true))
|
||||
{
|
||||
if (!_lastRecallStart.containsKey(player.getUniqueId()))
|
||||
RecallSession session = getSession(player);
|
||||
|
||||
if (session == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
long start = _lastRecallStart.get(player.getUniqueId());
|
||||
|
||||
if (UtilTime.elapsed(start, RECALL_TIME))
|
||||
if (UtilTime.elapsed(session.Start, RECALL_TIME))
|
||||
{
|
||||
_host.GetTeam(player).SpawnTeleport(player);
|
||||
_lastRecallStart.remove(player.getUniqueId());
|
||||
removeSession(player, null);
|
||||
}
|
||||
else if (UtilMath.offsetSquared(player.getLocation(), session.Location) > 4)
|
||||
{
|
||||
removeSession(player, "You moved!");
|
||||
}
|
||||
else
|
||||
{
|
||||
Location location = player.getLocation().add(0, 0.25, 0);
|
||||
double height = (now - start) / RECALL_TIME;
|
||||
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 (int y = 0; y < height * PARTICLE_HEIGHT; y += 0.5)
|
||||
for (double y = 0; y < height * PARTICLE_HEIGHT; y += 0.5)
|
||||
{
|
||||
location.add(x, y, z);
|
||||
|
||||
@ -118,10 +125,20 @@ public class Recall implements Listener
|
||||
return;
|
||||
}
|
||||
|
||||
RecallSession session =
|
||||
removeSession(event.GetDamageePlayer(), "You took damage!");
|
||||
}
|
||||
|
||||
public RecallSession getSession(Player player)
|
||||
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)
|
||||
{
|
||||
|
@ -1,11 +1,8 @@
|
||||
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.*;
|
||||
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;
|
||||
@ -39,15 +36,19 @@ public class Tower
|
||||
|
||||
public void setup()
|
||||
{
|
||||
if (_firstTower)
|
||||
{
|
||||
// if (_firstTower)
|
||||
// {
|
||||
_guardian = _location.getWorld().spawn(_location, Guardian.class);
|
||||
}
|
||||
else
|
||||
{
|
||||
_guardian = UtilVariant.spawnElderGuardian(_location);
|
||||
}
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// _guardian = UtilVariant.spawnElderGuardian(_location);
|
||||
// }
|
||||
|
||||
UtilEnt.vegetate(_guardian);
|
||||
UtilEnt.setFakeHead(_guardian, true);
|
||||
UtilEnt.silence(_guardian, true);
|
||||
_guardian.setRemoveWhenFarAway(false);
|
||||
_guardian.setCustomNameVisible(true);
|
||||
updateDisplay();
|
||||
}
|
||||
|
@ -673,6 +673,8 @@ public class GameManager implements Listener
|
||||
}, i * game.TickPerTeleport);
|
||||
}
|
||||
|
||||
if (game.PrepareAutoAnnounce)
|
||||
{
|
||||
//Announce Game after every player is TP'd in
|
||||
UtilServer.getServer().getScheduler().runTaskLater(Manager.getPlugin(), new Runnable()
|
||||
{
|
||||
@ -686,6 +688,7 @@ public class GameManager implements Listener
|
||||
UtilServer.getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
}, players.size() * game.TickPerTeleport);
|
||||
}
|
||||
|
||||
//Spectators Move
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
|
Loading…
Reference in New Issue
Block a user