- Everything except maps [probably should've committed sooner]

This commit is contained in:
AlexTheCoder 2015-12-06 03:47:07 -05:00
parent fc0cae8e0f
commit 430de10008
8 changed files with 907 additions and 1 deletions

View File

@ -68,6 +68,8 @@ public enum GameDisplay
Lobbers("Bomb Lobbers", Material.FIREBALL, (byte) 0, GameCategory.ARCADE, 54),
ChampionsCTF("Champions CTF", "Champions", Material.BANNER, DyeColor.RED.getDyeData(), GameCategory.CHAMPIONS, 56),
Minecraft_League("Minecraft League", Material.DIAMOND_SWORD, (byte)0, GameCategory.SURVIVAL, 57),
Event("Mineplex Event", Material.CAKE, (byte)0, GameCategory.EVENT, 999);

View File

@ -243,6 +243,11 @@ public class Arcade extends JavaPlugin
return config;
}
public ArcadeManager getArcadeManager()
{
return _gameManager;
}
private void DeleteFolders()
{

View File

@ -33,6 +33,7 @@ import nautilus.game.arcade.game.games.horsecharge.Horse;
import nautilus.game.arcade.game.games.lobbers.BombLobbers;
import nautilus.game.arcade.game.games.micro.Micro;
import nautilus.game.arcade.game.games.milkcow.MilkCow;
import nautilus.game.arcade.game.games.minecraftleague.MinecraftLeague;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
import nautilus.game.arcade.game.games.mineware.MineWare;
import nautilus.game.arcade.game.games.monstermaze.MonsterMaze;
@ -92,6 +93,7 @@ public enum GameType
Lobbers(BombLobbers.class, GameDisplay.Lobbers),
Micro(Micro.class, GameDisplay.Micro),
MilkCow(MilkCow.class, GameDisplay.MilkCow),
MinecraftLeague(MinecraftLeague.class, GameDisplay.Minecraft_League),
MineStrike(MineStrike.class, GameDisplay.MineStrike, "http://chivebox.com/mineplex/ResMinestrike.zip", true),
MineWare(MineWare.class, GameDisplay.MineWare),
OldMineWare(OldMineWare.class, GameDisplay.OldMineWare),

View File

@ -855,7 +855,7 @@ public abstract class Game implements Listener
public void RespawnPlayer(final Player player)
{
player.eject();
player.teleport(GetTeam(player).GetSpawn());
RespawnPlayerTeleport(player);
Manager.Clear(player);
@ -872,6 +872,11 @@ public abstract class Game implements Listener
}
}, 0);
}
public void RespawnPlayerTeleport(Player player)
{
player.teleport(GetTeam(player).GetSpawn());
}
public boolean IsPlaying(Player player)
{

View File

@ -0,0 +1,561 @@
package nautilus.game.arcade.game.games.minecraftleague;
import java.util.concurrent.ConcurrentHashMap;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
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.events.PlayerGameRespawnEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.games.minecraftleague.data.PlayerRespawnPoint;
import nautilus.game.arcade.game.games.minecraftleague.data.TeamCrystal;
import nautilus.game.arcade.game.games.minecraftleague.kit.KitPlayer;
import nautilus.game.arcade.kit.Kit;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockIgniteEvent;
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.util.Vector;
public class MinecraftLeague extends TeamGame
{
private ConcurrentHashMap<GameTeam, TeamCrystal> _crystals = new ConcurrentHashMap<GameTeam, TeamCrystal>();
private ConcurrentHashMap<Player, PlayerRespawnPoint> _customRespawns = new ConcurrentHashMap<Player, PlayerRespawnPoint>();
private long _liveTime = 0;
public MinecraftLeague(ArcadeManager manager)
{
super(manager, GameType.MinecraftLeague,
new Kit[]
{
new KitPlayer(manager)
},
new String[]
{
C.cWhite + "Gather resources for battle.",
C.cWhite + "Destroy the enemy's Crystal to",
C.cWhite + "Prevent them from respawning",
" ",
C.cWhite + "Last team standing wins",
});
this.DeathOut = false;
this.DamageSelf = false;
this.DeathSpectateSecs = 0;
this.WorldBoundaryKill = false;
this.DeathDropItems = true;
this.CreatureAllow = true;
this.BlockBreak = true;
this.BlockPlace = true;
this.ItemPickup = true;
this.ItemDrop = true;
this.InventoryClick = true;
this.InventoryOpenBlock = true;
this.InventoryOpenChest = true;
this.WorldWeatherEnabled = true;
this.WorldBlockBurn = true;
this.WorldBlockGrow = true;
this.WorldBoneMeal = true;
this.WorldFireSpread = true;
this.WorldLeavesDecay = true;
this.WorldSoilTrample = true;
this.StrictAntiHack = true;
this.AllowParticles = false;
this.SoupEnabled = false;
Manager.GetCreature().SetForce(true);
_help = new String[]
{
"Team Crystals have 500 health! Hit them with tnt to deal 1.5 damage.",
"The better the sword you have, the more damage you deal to Team Crystals!",
"Right-click a bed in order to change your personal spawn location."
};
registerStatTrackers(
);
Manager.GetDamage().disable();
}
private enum DamageAmount
{
NONE(1),
WOOD(4),
STONE(5),
GOLD(4),
IRON(6),
DIAMOND(7);
private double _amount;
private DamageAmount(int amount)
{
_amount = amount;
}
public double getDamage(int sharpnessLevel, DamageType type)
{
if (type.getDamageReduction() == null)
return 1;
return _amount + (sharpnessLevel / 2) - type.getDamageReduction();
}
public static DamageAmount getDamageAmount(Material material)
{
for (DamageAmount da : DamageAmount.values())
{
if (da == DamageAmount.NONE)
continue;
if (material.toString().contains(da.toString() + "_"))
return da;
}
return DamageAmount.NONE;
}
}
private enum DamageType
{
NONE(null),
PICKAXE(2),
AXE(1),
SWORD(0),
SPADE(3);
private Integer _reduction;
private DamageType(Integer reduction)
{
_reduction = reduction;
}
public Integer getDamageReduction()
{
return _reduction;
}
public static DamageType getDamageType(Material material)
{
for (DamageType dt : DamageType.values())
{
if (dt == DamageType.NONE)
continue;
if (material.toString().contains("_" + dt.toString()))
return dt;
}
return DamageType.NONE;
}
}
@Override
public void ParseData()
{
Location redLoc = WorldData.GetDataLocs("RED").get(0);
Location blueLoc = WorldData.GetDataLocs("BLUE").get(0);
_crystals.put(GetTeam(ChatColor.RED), new TeamCrystal(this, GetTeam(ChatColor.RED), redLoc));
_crystals.put(GetTeam(ChatColor.AQUA), new TeamCrystal(this, GetTeam(ChatColor.AQUA), blueLoc));
}
@Override
@EventHandler
public void ScoreboardUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
scoreboardWrite();
}
private void scoreboardWrite()
{
if (!InProgress())
return;
GameTeam red = GetTeam(ChatColor.RED);
GameTeam blue = GetTeam(ChatColor.AQUA);
TeamCrystal redc = _crystals.get(red);
TeamCrystal bluec = _crystals.get(blue);
if (IsLive())
_liveTime = Math.max(System.currentTimeMillis() - GetStateTime(), 0);
Scoreboard.Reset();
Scoreboard.WriteBlank();
Scoreboard.Write(C.cYellowB + "Time Elapsed");
Scoreboard.Write(UtilTime.MakeStr(_liveTime));
Scoreboard.WriteBlank();
Scoreboard.Write(C.cRedB + "Red Team");
Scoreboard.Write("Crystal: " + redc.formatHealth(redc.getHealth()));
Scoreboard.Write("Players Alive: " + red.GetPlayers(true).size());
Scoreboard.WriteBlank();
Scoreboard.Write(C.cAquaB + "Blue Team");
Scoreboard.Write("Crystal: " + bluec.formatHealth(bluec.getHealth()));
Scoreboard.Write("Players Alive: " + blue.GetPlayers(true).size());
Scoreboard.Draw();
}
@Override
public void RespawnPlayerTeleport(Player player)
{
if (_customRespawns.containsKey(player))
{
PlayerRespawnPoint point = _customRespawns.get(player);
if (point.respawnPlayer())
return;
_customRespawns.remove(player);
}
player.teleport(GetTeam(player).GetSpawn());
}
@EventHandler
public void onEnd(GameStateChangeEvent event)
{
if (event.GetGame() != this)
return;
if (event.GetState() == GameState.End)
Manager.GetDamage().enable();
}
@EventHandler
public void onUpdate(UpdateEvent event)
{
if (!IsLive())
return;
if (event.getType() == UpdateType.FASTEST)
{
for (TeamCrystal crystal : _crystals.values())
{
crystal.update();
}
}
}
@EventHandler
public void crystalDmg(EntityDamageEvent event)
{
if (!InProgress())
return;
if (event.getEntity().getType() != EntityType.ENDER_CRYSTAL)
return;
for (TeamCrystal cryst : _crystals.values())
{
if (cryst.isEntity(event.getEntity()))
event.setCancelled(true);
}
}
@EventHandler
public void crystalDmg(EntityDamageByEntityEvent event)
{
if (!IsLive())
return;
if (event.getEntity().getType() != EntityType.ENDER_CRYSTAL)
return;
TeamCrystal crystal = null;
for (TeamCrystal cryst : _crystals.values())
{
if (cryst.isEntity(event.getEntity()))
crystal = cryst;
}
if (crystal == null)
return;
event.setCancelled(true);
Player player;
if (event.getDamager() instanceof Projectile)
{
if (((Projectile)event.getDamager()).getShooter() instanceof Player)
{
if (event.getDamager() instanceof Arrow)
{
player = (Player) ((Projectile)event.getDamager()).getShooter();
if (!crystal.canDamage(player))
return;
if (!crystal.damage(event.getDamage(), player))
player.playSound(crystal.getLocation(), Sound.ORB_PICKUP, 100, 0);
}
}
}
if (event.getDamager() instanceof Player)
{
player = (Player)event.getDamager();
if (!crystal.canDamage(player))
return;
if (player.getItemInHand() == null || player.getItemInHand().getType() == Material.AIR)
{
if (!crystal.damage(1, player))
player.playSound(crystal.getLocation(), Sound.ZOMBIE_WOODBREAK, 1, 0);
return;
}
Material type = player.getItemInHand().getType();
int level = player.getItemInHand().getEnchantmentLevel(Enchantment.DAMAGE_ALL);
double damage = DamageAmount.getDamageAmount(type).getDamage(level, DamageType.getDamageType(type));
if (!crystal.damage(damage, player))
player.playSound(crystal.getLocation(), Sound.ZOMBIE_WOODBREAK, 1, 0);
}
}
@EventHandler
public void placeBed(PlayerInteractEvent event)
{
if (!IsLive())
return;
if (event.getClickedBlock() == null)
return;
if (event.getAction() != Action.RIGHT_CLICK_BLOCK)
return;
if (event.getClickedBlock().getType() != Material.BED_BLOCK)
return;
event.setCancelled(true);
Player player = event.getPlayer();
if (_customRespawns.containsKey(player))
_customRespawns.get(player).overWrite(event.getClickedBlock().getLocation());
else
_customRespawns.put(player, new PlayerRespawnPoint(player, event.getClickedBlock().getLocation()));
}
@EventHandler
public void breakBed(BlockBreakEvent event)
{
if (!IsLive())
return;
if (event.getBlock().getType() != Material.BED_BLOCK)
return;
for (Player player : _customRespawns.keySet())
{
PlayerRespawnPoint point = _customRespawns.get(player);
if (point.breakBed(event.getBlock()))
_customRespawns.remove(player);
}
}
@EventHandler
public void onRespawn(PlayerGameRespawnEvent event)
{
if (event.GetGame() != this)
return;
Player player = event.GetPlayer();
if (!_crystals.get(GetTeam(player)).Alive)
{
SetPlayerState(player, PlayerState.OUT);
Manager.GetCondition().Factory().Blind("PermDead", player, player, 1.5, 0, false, false, false);
Manager.GetCondition().Factory().Cloak("PermDead", player, player, 9999, false, false);
player.setAllowFlight(true);
player.setFlying(true);
((CraftPlayer)player).getHandle().spectating = true;
((CraftPlayer)player).getHandle().k = false;
UtilAction.velocity(player, new Vector(0,1.2,0));
}
}
@EventHandler
public void onTNT(BlockIgniteEvent event)
{
if (event.getBlock().getType() == Material.TNT)
{
if (event.getCause() != IgniteCause.FLINT_AND_STEEL)
return;
if (event.getPlayer() == null)
return;
final Location loc = event.getBlock().getLocation();
final Player player = event.getPlayer();
Bukkit.getScheduler().runTaskLater(Manager.getPlugin(), new Runnable()
{
public void run()
{
for (Entity e : UtilEnt.getAllInRadius(loc, 2).keySet())
{
if (e instanceof TNTPrimed)
{
e.setCustomName(player.getName());
e.setCustomNameVisible(false);
}
}
}
}, 5);
}
}
@EventHandler
public void onDebug(PlayerCommandPreprocessEvent event)
{
Player player = event.getPlayer();
String message = event.getMessage().replaceFirst("/", "");
String[] rawArgs = message.split(" ");
String cmd = rawArgs[0];
message = message.replaceFirst(cmd + " ", "");
String[] args = message.split(" ");
if (!cmd.equalsIgnoreCase("vanilla"))
return;
if (Manager.GetClients().Get(player).GetRank().has(Rank.JNR_DEV))
{
event.setCancelled(true);
if (args.length == 0)
{
UtilPlayer.message(player, C.cGray + "Usage: /vanilla <kill/spawn/damage/status> [team] [damage]");
return;
}
String sub = args[0];
if (sub.equalsIgnoreCase("kill"))
{
if (args.length < 2)
{
UtilPlayer.message(player, C.cGray + "Usage: /vanilla kill <red/blue>");
return;
}
String team = args[1];
if (!team.equalsIgnoreCase("red") && !team.equalsIgnoreCase("blue"))
{
UtilPlayer.message(player, C.cGray + "Usage: /vanilla kill <red/blue>");
return;
}
if (team.equalsIgnoreCase("red"))
_crystals.get(GetTeam(ChatColor.RED)).handleDebug(player, null, true);
else if (team.equalsIgnoreCase("blue"))
_crystals.get(GetTeam(ChatColor.AQUA)).handleDebug(player, null, true);
}
else if (sub.equalsIgnoreCase("spawn"))
{
if (args.length < 2)
{
UtilPlayer.message(player, C.cGray + "Usage: /vanilla spawn <red/blue>");
return;
}
String team = args[1];
if (!team.equalsIgnoreCase("red") && !team.equalsIgnoreCase("blue"))
{
UtilPlayer.message(player, C.cGray + "Usage: /vanilla spawn <red/blue>");
return;
}
if (team.equalsIgnoreCase("red"))
_crystals.get(GetTeam(ChatColor.RED)).handleDebug(player, null, false);
else if (team.equalsIgnoreCase("blue"))
_crystals.get(GetTeam(ChatColor.AQUA)).handleDebug(player, null, false);
}
else if (sub.equalsIgnoreCase("damage"))
{
if (args.length < 3)
{
UtilPlayer.message(player, C.cGray + "Usage: /vanilla damage <red/blue> <damage>");
return;
}
String team = args[1];
if (!team.equalsIgnoreCase("red") && !team.equalsIgnoreCase("blue"))
{
UtilPlayer.message(player, C.cGray + "Usage: /vanilla damage <red/blue> <damage>");
return;
}
Double damage;
try
{
damage = Double.parseDouble(args[2]);
}
catch (Exception e)
{
UtilPlayer.message(player, C.cGray + "Usage: /vanilla damage <red/blue> <damage>");
return;
}
if (team.equalsIgnoreCase("red"))
_crystals.get(GetTeam(ChatColor.RED)).handleDebug(player, damage, false);
else if (team.equalsIgnoreCase("blue"))
_crystals.get(GetTeam(ChatColor.AQUA)).handleDebug(player, damage, false);
}
else if (sub.equalsIgnoreCase("status"))
{
for (GameTeam team : _crystals.keySet())
{
Bukkit.broadcastMessage(team.GetName());
TeamCrystal crystal = _crystals.get(team);
Bukkit.broadcastMessage(crystal.getHealth() + "");
Bukkit.broadcastMessage(crystal.Alive + "");
}
}
else
UtilPlayer.message(player, C.cGray + "Usage: /vanilla <kill/spawn/damage/status> [team] [damage]");
}
}
}

View File

@ -0,0 +1,107 @@
package nautilus.game.arcade.game.games.minecraftleague.data;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
public class PlayerRespawnPoint
{
private Player _owner;
private Location _loc;
public PlayerRespawnPoint(Player owner, Location loc)
{
_owner = owner;
_loc = loc;
UtilPlayer.message(owner, F.main("Game", "You have set your bed respawn point. The next time you die you will respawn here!"));
}
@SuppressWarnings("deprecation")
private boolean isBedType(Block bedBlock, boolean foot)
{
boolean head = (bedBlock.getData() & 0x8) != 0;
if (foot)
return !head;
else
return head;
}
private Block getOtherBedBlock(Block b1)
{
if (b1.getType() != Material.BED_BLOCK)
return null;
boolean lookingForFoot = isBedType(b1, false);
for (int x = -1; x <= 1; x++)
{
for (int z = -1; z <= 1; z++)
{
Block b2 = b1.getRelative(x, 0, z);
if (!(b1.getLocation().equals(b2.getLocation())))
{
if (b2.getType().equals(Material.BED_BLOCK))
{
if (lookingForFoot && isBedType(b2, true))
return b2;
if (!lookingForFoot && isBedType(b2, false))
return b2;
}
}
}
}
return null;
}
public boolean respawnPlayer()
{
if (_loc.getBlock().getType() != Material.BED_BLOCK)
{
UtilPlayer.message(_owner, F.main("Game", "Your bed has been destroyed, and your respawn point has been reset!"));
return false;
}
_owner.teleport(_loc.clone().add(0.5, 1.5, 0.5));
UtilPlayer.message(_owner, F.main("Game", "You have been respawned at your bed location!"));
return true;
}
public boolean breakBed(Block block)
{
boolean isOther = false;
if (getOtherBedBlock(_loc.getBlock()) != null)
if (getOtherBedBlock(_loc.getBlock()).equals(block))
isOther = true;
if (block.getLocation().equals(_loc) || isOther)
{
UtilPlayer.message(_owner, F.main("Game", "Your bed respawn point has been broken!"));
return true;
}
return false;
}
public void overWrite(Location newLocation)
{
if (newLocation.distance(_loc) <= .2)
return;
if (getOtherBedBlock(_loc.getBlock()) != null)
if (getOtherBedBlock(_loc.getBlock()).getLocation().distance(newLocation) <= .2)
return;
UtilPlayer.message(_owner, F.main("Game", "You have set your bed respawn point. The next time you die you will respawn here!"));
if (_loc.getBlock().getType() == Material.BED_BLOCK)
_loc.getBlock().breakNaturally();
_loc = newLocation;
}
}

View File

@ -0,0 +1,182 @@
package nautilus.game.arcade.game.games.minecraftleague.data;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilMath;
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.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.hologram.Hologram;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.minecraftleague.MinecraftLeague;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.entity.EnderCrystal;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
public class TeamCrystal
{
private MinecraftLeague _host;
private Location _spawn;
private GameTeam _team;
private Double _health;
private EnderCrystal _entity;
private Hologram _name, _healthTag;
public boolean Alive;
public TeamCrystal(MinecraftLeague host, GameTeam team, Location spawn)
{
_host = host;
_spawn = spawn.clone().add(0.5, 1.5, 0.5);
_team = team;
_health = 500D;
_name = new Hologram(_host.getArcadeManager().getHologramManager(), _spawn.clone().add(0, 3, 0), team.GetColor() + team.getDisplayName() + "'s Respawn Crystal");
_healthTag = new Hologram(_host.getArcadeManager().getHologramManager(), _spawn.clone().add(0, 2, 0), formatHealth(_health));
spawn();
}
private void spawn()
{
_name.start();
_healthTag.start();
_entity = (EnderCrystal) _host.getArcadeManager().GetCreature().SpawnEntity(_spawn, EntityType.ENDER_CRYSTAL);
_health = 500D;
Alive = true;
}
private void kill(Player player)
{
String message = "";
if (player != null)
message = C.cRedB + player.getName() + " has destroyed " + _team.getDisplayName() + "'s " + C.cDPurpleB + "Crystal" + C.cRedB + "!";
else
message = C.cRedB + _team.getDisplayName() + "'s " + C.cDPurpleB + "Respawn Crystal" + C.cRedB + " has been destroyed!";
Bukkit.broadcastMessage(message);
for (Player inform : _team.GetPlayers(true))
UtilTextMiddle.display(C.cRedB + "Team Crystal Destroyed", C.cRed + "You will no longer respawn!", inform);
Alive = false;
_entity.remove();
_healthTag.stop();
_name.stop();
playDeathAnimation(_spawn);
}
private void playDeathAnimation(Location loc)
{
_spawn.getWorld().playSound(loc, Sound.EXPLODE, 10, 0);
//GFX subject to change
Location loc1 = loc.clone().add(-2, 3, -2);
Location loc2 = loc.clone().add(2, 0, 2);
Location loc3 = loc.clone().add(2, 3, 2);
Location loc4 = loc.clone().add(-2, 0, -2);
Location particle1 = loc2.clone();
Location particle2 = loc4.clone();
while (UtilMath.offset(loc1, loc) >= UtilMath.offset(particle1, loc))
{
Vector v = UtilAlg.getTrajectory(particle1, loc1);
//UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, particle, v, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers());
UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, particle1, v, 0, 5, ViewDist.MAX, UtilServer.getPlayers());
particle1.add(v);
}
while (UtilMath.offset(loc3, loc) >= UtilMath.offset(particle2, loc))
{
Vector v = UtilAlg.getTrajectory(particle2, loc3);
UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, particle2, v, 0, 5, ViewDist.MAX, UtilServer.getPlayers());
particle2.add(v);
}
}
public boolean isEntity(Entity e)
{
return e.getEntityId() == _entity.getEntityId();
}
public boolean canDamage(Player player)
{
if (UtilPlayer.isSpectator(player))
return false;
if (_host.GetTeam(player) == _team)
return false;
if (!_host.IsPlaying(player))
return false;
return true;
}
public Double getHealth()
{
if (!Alive)
return 0D;
return _health;
}
public String formatHealth(Double healthNumber)
{
String tag = healthNumber.toString();
if (healthNumber > 450)
tag = C.cGreen + tag;
else if (healthNumber < 225)
tag = C.cRed + tag;
else
tag = C.cYellow + tag;
return tag;
}
public boolean damage(double damage, Player player)
{
Double newHealth = Math.max(_health - damage, 0);
if (newHealth == 0)
{
kill(player);
return true;
}
_health = newHealth;
return false;
}
public Location getLocation()
{
return _spawn;
}
public void update()
{
_healthTag.setText(formatHealth(_health));
}
public void handleDebug(Player dev, Double damage, boolean kill)
{
if (damage != null)
{
damage(damage, dev);
return;
}
if (kill)
kill(dev);
else
{
spawn();
dev.sendMessage(C.cGray + "Spawned!");
}
}
}

View File

@ -0,0 +1,42 @@
package nautilus.game.arcade.game.games.minecraftleague.kit;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
public class KitPlayer extends Kit
{
public KitPlayer(ArcadeManager manager)
{
super(manager, "Player", KitAvailability.Free,
new String[]
{
"",
"Entirely vanilla combat!",
""
},
new Perk[]
{
}, EntityType.ZOMBIE, null);
}
@Override
public void GiveItems(Player player)
{
}
@Override
public void SpawnCustom(LivingEntity ent)
{
}
}