Mineplex2018-withcommit/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Kit.java

167 lines
3.6 KiB
Java
Raw Normal View History

2013-08-27 17:14:08 +02:00
package nautilus.game.arcade.kit;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
import nautilus.game.arcade.ArcadeFormat;
import nautilus.game.arcade.ArcadeManager;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
2013-08-27 17:14:08 +02:00
import org.bukkit.entity.EntityType;
2013-08-31 05:15:16 +02:00
import org.bukkit.entity.LivingEntity;
2013-08-27 17:14:08 +02:00
import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Skeleton.SkeletonType;
2013-08-27 17:14:08 +02:00
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
public abstract class Kit implements Listener
{
public ArcadeManager Manager;
private String _kitName;
private String[] _kitDesc;
private KitAvailability _kitAvailability;
private Perk[] _kitPerks;
protected EntityType _entityType;
protected ItemStack _itemInHand;
public Kit(ArcadeManager manager, String name, KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand)
{
Manager = manager;
_kitName = name;
_kitDesc = kitDesc;
_kitPerks = kitPerks;
for (Perk perk : _kitPerks)
perk.SetHost(this);
_kitAvailability = kitAvailability;
_entityType = entityType;
_itemInHand = itemInHand;
}
public String GetFormattedName()
{
return GetAvailability().GetColor() + "<EFBFBD>l" + _kitName;
}
public String GetName()
{
return _kitName;
}
public ItemStack GetItemInHand()
{
return _itemInHand;
}
public KitAvailability GetAvailability()
{
return _kitAvailability;
}
public String[] GetDesc()
{
return _kitDesc;
}
public Perk[] GetPerks()
{
return _kitPerks;
}
public boolean HasKit(Player player)
{
if (Manager.GetGame() == null)
return false;
return Manager.GetGame().HasKit(player, this);
}
public void ApplyKit(Player player)
{
UtilInv.Clear(player);
for (Perk perk : _kitPerks)
perk.Apply(player);
GiveItems(player);
}
public abstract void GiveItems(Player player);
public Entity SpawnEntity(Location loc)
2013-08-27 17:14:08 +02:00
{
EntityType type = _entityType;
if (type == EntityType.PLAYER)
type = EntityType.ZOMBIE;
LivingEntity entity = (LivingEntity) Manager.GetCreature().SpawnEntity(loc, type);
Merge commit '13110356aabbcc69d83ce29d8f9e5bec27812009' Conflicts: Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/deathtag/kits/KitArcher.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/dragons/kits/KitCoward.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/dragons/kits/KitMarksman.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/dragons/kits/KitPyrotechnic.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/horsecharge/kits/KitDefenceArcher.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/horsecharge/kits/KitHorseKnight.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/quiver/kits/KitBrawler.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/quiver/kits/KitElementalist.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/quiver/kits/KitLeaper.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/turfforts/kits/KitInfiltrator.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/turfforts/kits/KitMarksman.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/turfforts/kits/KitShredder.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/castlesiege/kits/KitHumanElementalist.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/castlesiege/kits/KitHumanKnight.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/castlesiege/kits/KitHumanMarksman.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/castlesiege/kits/KitHumanPeasant.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/zombiesurvival/kits/KitSurvivorArcher.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/zombiesurvival/kits/KitSurvivorKnight.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/zombiesurvival/kits/KitSurvivorRogue.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/zombiesurvival/kits/KitUndeadAlpha.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Kit.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java
2013-08-31 05:41:58 +02:00
entity.setRemoveWhenFarAway(false);
entity.setCustomName(GetAvailability().GetColor() + GetName() + " Kit" + (GetAvailability() == KitAvailability.Blue ? ChatColor.GRAY + " (" + ChatColor.WHITE + "Ultra" + ChatColor.GRAY + ")" : ""));
entity.setCustomNameVisible(true);
entity.getEquipment().setItemInHand(_itemInHand);
if (type == EntityType.SKELETON && GetName().contains("Wither"))
{
Skeleton skel = (Skeleton)entity;
skel.setSkeletonType(SkeletonType.WITHER);
}
UtilEnt.Vegetate(entity);
Merge commit '13110356aabbcc69d83ce29d8f9e5bec27812009' Conflicts: Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/deathtag/kits/KitArcher.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/dragons/kits/KitCoward.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/dragons/kits/KitMarksman.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/dragons/kits/KitPyrotechnic.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/horsecharge/kits/KitDefenceArcher.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/horsecharge/kits/KitHorseKnight.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/quiver/kits/KitBrawler.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/quiver/kits/KitElementalist.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/quiver/kits/KitLeaper.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/turfforts/kits/KitInfiltrator.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/turfforts/kits/KitMarksman.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/turfforts/kits/KitShredder.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/castlesiege/kits/KitHumanElementalist.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/castlesiege/kits/KitHumanKnight.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/castlesiege/kits/KitHumanMarksman.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/castlesiege/kits/KitHumanPeasant.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/zombiesurvival/kits/KitSurvivorArcher.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/zombiesurvival/kits/KitSurvivorKnight.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/zombiesurvival/kits/KitSurvivorRogue.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/zombiesurvival/kits/KitUndeadAlpha.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Kit.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java
2013-08-31 05:41:58 +02:00
SpawnCustom(entity);
2013-08-27 17:14:08 +02:00
return entity;
2013-08-27 17:14:08 +02:00
}
2013-08-31 05:15:16 +02:00
public void SpawnCustom(LivingEntity ent) { }
2013-08-27 17:14:08 +02:00
public void DisplayDesc(Player player)
{
for (int i=0 ; i<3 ; i++)
UtilPlayer.message(player, "");
UtilPlayer.message(player, ArcadeFormat.Line);
UtilPlayer.message(player, "<EFBFBD>aKit - <20>f<EFBFBD>l" + GetName());
//Desc
for (String line : GetDesc())
{
UtilPlayer.message(player, C.cGray + " " + line);
}
//Perk Descs
for (Perk perk : GetPerks())
{
if (!perk.IsVisible())
continue;
UtilPlayer.message(player, "");
UtilPlayer.message(player, C.cWhite + C.Bold + perk.GetName());
for (String line : perk.GetDesc())
{
UtilPlayer.message(player, C.cGray + " " + line);
}
}
UtilPlayer.message(player, ArcadeFormat.Line);
}
public int GetCost()
{
return 2000;
}
}