Added /spec toggle, to allow players to not partake in games.

Added TeamArmorAddon for games to use, to mark team colors easier.
Minor other changes.
This commit is contained in:
Chiss 2014-05-03 11:23:10 +10:00
parent 1d4d98b910
commit e818662161
22 changed files with 239 additions and 153 deletions

View File

@ -2,6 +2,7 @@ package nautilus.game.arcade;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet;
import nautilus.game.arcade.addons.*; import nautilus.game.arcade.addons.*;
import nautilus.game.arcade.command.*; import nautilus.game.arcade.command.*;
@ -106,6 +107,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation
private MiscManager _miscManager; private MiscManager _miscManager;
//Observers
private HashSet<Player> _specList = new HashSet<Player>();
//Server Games //Server Games
private GameServerConfig _serverConfig; private GameServerConfig _serverConfig;
@ -191,6 +195,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
//Game Addons //Game Addons
new CompassAddon(plugin, this); new CompassAddon(plugin, this);
new SoupAddon(plugin, this); new SoupAddon(plugin, this);
new TeamArmorAddon(plugin, this);
} }
@Override @Override
@ -396,6 +401,12 @@ public class ArcadeManager extends MiniPlugin implements IRelation
@EventHandler @EventHandler
public void MessageMOTD(ServerListPingEvent event) public void MessageMOTD(ServerListPingEvent event)
{ {
if (this.IsTournamentServer())
{
event.setMotd(ChatColor.RED + "Twitch.tv "+ ChatColor.YELLOW + "Charity Event");
return;
}
String extrainformation = "|" + _serverConfig.ServerType + "|" + (_game == null ? "Unknown" : _game.GetName()) + "|" + ((_game == null || _game.WorldData == null) ? "Unknown" : _game.WorldData.MapName); String extrainformation = "|" + _serverConfig.ServerType + "|" + (_game == null ? "Unknown" : _game.GetName()) + "|" + ((_game == null || _game.WorldData == null) ? "Unknown" : _game.WorldData.MapName);
if (_game == null || _game.GetState() == GameState.Recruit) if (_game == null || _game.GetState() == GameState.Recruit)
@ -631,6 +642,54 @@ public class ArcadeManager extends MiniPlugin implements IRelation
} }
} }
@EventHandler
public void Observer(PlayerCommandPreprocessEvent event)
{
if (event.getMessage().equalsIgnoreCase("/spec"))
{
if (!_specList.remove(event.getPlayer()))
{
_specList.add(event.getPlayer());
UtilPlayer.message(event.getPlayer(), F.main("Game", "You are now a Spectator!"));
}
else
{
UtilPlayer.message(event.getPlayer(), F.main("Game", "You are no longer a Spectator!"));
}
//Clean
if (_game != null)
{
//Remove Data
_game.RemoveTeamPreference(event.getPlayer());
_game.GetPlayerKits().remove(event.getPlayer());
_game.GetPlayerGems().remove(event.getPlayer());
//Leave Team
GameTeam team = _game.GetTeam(event.getPlayer());
if (team != null)
{
team.RemovePlayer(event.getPlayer());
}
}
event.setCancelled(true);
}
}
@EventHandler
public void ObserverQuit(PlayerQuitEvent event)
{
_specList.remove(event.getPlayer());
}
public boolean IsObserver(Player player)
{
return _specList.contains(player);
}
public boolean IsTournamentServer() public boolean IsTournamentServer()
{ {
return _serverConfig.Tournament; return _serverConfig.Tournament;

View File

@ -40,6 +40,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.scoreboard.DisplaySlot; import org.bukkit.scoreboard.DisplaySlot;
import org.bukkit.scoreboard.Objective; import org.bukkit.scoreboard.Objective;
import org.bukkit.scoreboard.Score; import org.bukkit.scoreboard.Score;
@ -147,7 +148,7 @@ public abstract class Game implements Listener
public boolean CreatureAllow = false; public boolean CreatureAllow = false;
public boolean CreatureAllowOverride = false; public boolean CreatureAllowOverride = false;
public int WorldTimeSet = -1; public int WorldTimeSet = 12000;
public boolean WorldWeatherEnabled = false; public boolean WorldWeatherEnabled = false;
public int WorldWaterDamage = 0; public int WorldWaterDamage = 0;
public boolean WorldBoundaryKill = true; public boolean WorldBoundaryKill = true;
@ -177,6 +178,8 @@ public abstract class Game implements Listener
//Addons //Addons
public boolean CompassEnabled = false; public boolean CompassEnabled = false;
public boolean SoupEnabled = true; public boolean SoupEnabled = true;
public boolean TeamArmor = false;
public boolean TeamArmorHotbar = false;
public boolean GiveClock = true; public boolean GiveClock = true;

View File

@ -23,6 +23,7 @@ public abstract class TeamGame extends Game
{ {
private NautHashMap<String, Long> _rejoinTime = new NautHashMap<String, Long>(); private NautHashMap<String, Long> _rejoinTime = new NautHashMap<String, Long>();
protected NautHashMap<String, GameTeam> RejoinTeam = new NautHashMap<String, GameTeam>(); protected NautHashMap<String, GameTeam> RejoinTeam = new NautHashMap<String, GameTeam>();
protected NautHashMap<String, Kit> RejoinKit = new NautHashMap<String, Kit>();
public TeamGame(ArcadeManager manager, GameType gameType, Kit[] kits, String[] gameDesc) public TeamGame(ArcadeManager manager, GameType gameType, Kit[] kits, String[] gameDesc)
{ {
@ -53,6 +54,10 @@ public abstract class TeamGame extends Game
//Store //Store
_rejoinTime.put(player.getName(), System.currentTimeMillis()); _rejoinTime.put(player.getName(), System.currentTimeMillis());
RejoinTeam.put(player.getName(), team); RejoinTeam.put(player.getName(), team);
if (GetKit(player) != null)
RejoinKit.put(player.getName(), GetKit(player));
GetLocationStore().put(player.getName(), player.getLocation()); GetLocationStore().put(player.getName(), player.getLocation());
//Announcement //Announcement
@ -72,6 +77,12 @@ public abstract class TeamGame extends Game
{ {
team.AddPlayer(event.getPlayer()); team.AddPlayer(event.getPlayer());
Announce(team.GetColor() + C.Bold + event.getPlayer().getName() + " has reconnected!"); Announce(team.GetColor() + C.Bold + event.getPlayer().getName() + " has reconnected!");
Kit kit = RejoinKit.remove(event.getPlayer().getName());
if (kit != null)
_playerKit.put(event.getPlayer(), kit);
return; return;
} }
@ -107,6 +118,8 @@ public abstract class TeamGame extends Game
GameTeam team = RejoinTeam.remove(name); GameTeam team = RejoinTeam.remove(name);
if (team != null) if (team != null)
Announce(team.GetColor() + C.Bold + name + " did not reconnect in time!"); Announce(team.GetColor() + C.Bold + name + " did not reconnect in time!");
RejoinKit.remove(name);
} }
} }

View File

@ -100,7 +100,7 @@ public class Bridge extends TeamGame implements OreObsfucation
private HashSet<String> _usedLife = new HashSet<String>(); private HashSet<String> _usedLife = new HashSet<String>();
//Tourney Mode //Tourney Mode
private boolean _tournament = false; private boolean _tournament;
private HashMap<GameTeam, Integer> _tournamentKills = new HashMap<GameTeam, Integer>(); private HashMap<GameTeam, Integer> _tournamentKills = new HashMap<GameTeam, Integer>();
//Scoreboard //Scoreboard
@ -152,9 +152,13 @@ public class Bridge extends TeamGame implements OreObsfucation
GemMultiplier = 2.5; GemMultiplier = 2.5;
PrepareFreeze = false;
//Tournament //Tournament
if (Manager.IsTournamentServer()) if (Manager.IsTournamentServer())
QuitOut = false; QuitOut = false;
_tournament = Manager.IsTournamentServer();
} }
@EventHandler @EventHandler
@ -165,13 +169,13 @@ public class Bridge extends TeamGame implements OreObsfucation
Player player = event.GetPlayer(); Player player = event.GetPlayer();
if (Manager.GetClients().Get(player).GetRank().Has(Rank.ULTRA) || Manager.GetDonation().Get(player.getName()).OwnsUnknownPackage(GetName() + " ULTRA")) if (Manager.IsTournamentServer() || Manager.GetClients().Get(player).GetRank().Has(Rank.ULTRA) || Manager.GetDonation().Get(player.getName()).OwnsUnknownPackage(GetName() + " ULTRA"))
{ {
if (!_usedLife.contains(player.getName())) if (!_usedLife.contains(player.getName()))
{ {
_usedLife.add(player.getName()); _usedLife.add(player.getName());
UtilPlayer.message(player, F.main("Game", "You used your " + F.elem(C.cAqua + "Ultra Rank Revive") + ".")); UtilPlayer.message(player, F.main("Game", "You used your " + F.elem(C.cAqua + "Early Game Revive") + "."));
event.setCancelled(true); event.setCancelled(true);
} }

View File

@ -32,6 +32,7 @@ import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType; import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerPrepareTeleportEvent;
import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.SoloGame; import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.TeamGame;
@ -75,6 +76,8 @@ public class DragonEscapeTeams extends TeamGame
this.DamagePvP = false; this.DamagePvP = false;
this.HungerSet = 20; this.HungerSet = 20;
this.TeamArmorHotbar = true;
} }
@Override @Override
@ -145,6 +148,12 @@ public class DragonEscapeTeams extends TeamGame
this.WorldTimeSet = 16000; this.WorldTimeSet = 16000;
} }
@EventHandler
public void PlayerTeleport(PlayerPrepareTeleportEvent event)
{
Manager.GetCondition().Factory().Invisible(GetName(), event.GetPlayer(), event.GetPlayer(), 16, 1, false, false, false);
}
@EventHandler @EventHandler
public void SpawnDragon(GameStateChangeEvent event) public void SpawnDragon(GameStateChangeEvent event)
{ {

View File

@ -68,6 +68,10 @@ public class DragonsTeams extends TeamGame
this.DamagePvP = false; this.DamagePvP = false;
this.HungerSet = 20; this.HungerSet = 20;
this.WorldWaterDamage = 4; this.WorldWaterDamage = 4;
this.PrepareFreeze = false;
this.TeamArmor = true;
this.TeamArmorHotbar = true;
} }
@Override @Override

View File

@ -21,7 +21,7 @@ public class KitPyrotechnic extends Kit
new String[] new String[]
{ {
"Dragons love sparklers, following them!" "Dragons love sparklers!!"
}, },
new Perk[] new Perk[]

View File

@ -60,9 +60,13 @@ public class QuiverTeams extends TeamGame
this.DamageSelf = false; this.DamageSelf = false;
this.DamageTeamSelf = false; this.DamageTeamSelf = false;
this.PrepareFreeze = false; this.PrepareFreeze = false;
this.SpawnDistanceRequirement = 16; this.SpawnDistanceRequirement = 24;
this.BlockBreakAllow.add(102); this.BlockBreakAllow.add(102);
this.BlockBreakAllow.add(20); this.BlockBreakAllow.add(20);
this.BlockBreakAllow.add(18);
this.TeamArmor = true;
this.TeamArmorHotbar = true;
} }
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)

View File

@ -108,6 +108,9 @@ public class SheepGame extends TeamGame
this.HungerSet = 20; this.HungerSet = 20;
this.WorldTimeSet = 2000; this.WorldTimeSet = 2000;
this.TeamArmor = true;
this.TeamArmorHotbar = true;
} }
@Override @Override
@ -447,13 +450,6 @@ public class SheepGame extends TeamGame
DropSheep(player); DropSheep(player);
} }
@EventHandler
public void InventoryClick(InventoryClickEvent event)
{
event.setCancelled(true);
event.getWhoClicked().closeInventory();
}
@EventHandler @EventHandler
public void RespawnInvul(PlayerGameRespawnEvent event) public void RespawnInvul(PlayerGameRespawnEvent event)
{ {

View File

@ -46,32 +46,6 @@ public class KitArcher extends Kit
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOD_SWORD)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOD_SWORD));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.SADDLE)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.SADDLE));
ItemStack helm = new ItemStack(Material.LEATHER_HELMET);
LeatherArmorMeta metaHelm = (LeatherArmorMeta)helm.getItemMeta();
metaHelm.setColor(Manager.GetGame().GetTeam(player).GetColorBase());
helm.setItemMeta(metaHelm);
player.getInventory().setHelmet(helm);
ItemStack armor = new ItemStack(Material.LEATHER_CHESTPLATE);
LeatherArmorMeta meta = (LeatherArmorMeta)armor.getItemMeta();
meta.setColor(Manager.GetGame().GetTeam(player).GetColorBase());
armor.setItemMeta(meta);
player.getInventory().setChestplate(armor);
ItemStack legs = new ItemStack(Material.LEATHER_LEGGINGS);
LeatherArmorMeta metaLegs = (LeatherArmorMeta)armor.getItemMeta();
metaLegs.setColor(Manager.GetGame().GetTeam(player).GetColorBase());
legs.setItemMeta(metaLegs);
player.getInventory().setLeggings(legs);
ItemStack boots = new ItemStack(Material.LEATHER_BOOTS);
LeatherArmorMeta metaBoots = (LeatherArmorMeta)armor.getItemMeta();
metaBoots.setColor(Manager.GetGame().GetTeam(player).GetColorBase());
boots.setItemMeta(metaBoots);
player.getInventory().setBoots(boots);
player.getInventory().setItem(8, armor.clone());
} }
@Override @Override

View File

@ -38,32 +38,6 @@ public class KitBeserker extends Kit
{ {
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.SADDLE)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.SADDLE));
ItemStack helm = new ItemStack(Material.LEATHER_HELMET);
LeatherArmorMeta metaHelm = (LeatherArmorMeta)helm.getItemMeta();
metaHelm.setColor(Manager.GetGame().GetTeam(player).GetColorBase());
helm.setItemMeta(metaHelm);
player.getInventory().setHelmet(helm);
ItemStack armor = new ItemStack(Material.LEATHER_CHESTPLATE);
LeatherArmorMeta meta = (LeatherArmorMeta)armor.getItemMeta();
meta.setColor(Manager.GetGame().GetTeam(player).GetColorBase());
armor.setItemMeta(meta);
player.getInventory().setChestplate(armor);
ItemStack legs = new ItemStack(Material.LEATHER_LEGGINGS);
LeatherArmorMeta metaLegs = (LeatherArmorMeta)armor.getItemMeta();
metaLegs.setColor(Manager.GetGame().GetTeam(player).GetColorBase());
legs.setItemMeta(metaLegs);
player.getInventory().setLeggings(legs);
ItemStack boots = new ItemStack(Material.LEATHER_BOOTS);
LeatherArmorMeta metaBoots = (LeatherArmorMeta)armor.getItemMeta();
metaBoots.setColor(Manager.GetGame().GetTeam(player).GetColorBase());
boots.setItemMeta(metaBoots);
player.getInventory().setBoots(boots);
player.getInventory().setItem(8, armor.clone());
} }
@Override @Override

View File

@ -39,32 +39,6 @@ public class KitBrute extends Kit
{ {
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.SADDLE)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.SADDLE));
ItemStack helm = new ItemStack(Material.LEATHER_HELMET);
LeatherArmorMeta metaHelm = (LeatherArmorMeta)helm.getItemMeta();
metaHelm.setColor(Manager.GetGame().GetTeam(player).GetColorBase());
helm.setItemMeta(metaHelm);
player.getInventory().setHelmet(helm);
ItemStack armor = new ItemStack(Material.LEATHER_CHESTPLATE);
LeatherArmorMeta meta = (LeatherArmorMeta)armor.getItemMeta();
meta.setColor(Manager.GetGame().GetTeam(player).GetColorBase());
armor.setItemMeta(meta);
player.getInventory().setChestplate(armor);
ItemStack legs = new ItemStack(Material.LEATHER_LEGGINGS);
LeatherArmorMeta metaLegs = (LeatherArmorMeta)armor.getItemMeta();
metaLegs.setColor(Manager.GetGame().GetTeam(player).GetColorBase());
legs.setItemMeta(metaLegs);
player.getInventory().setLeggings(legs);
ItemStack boots = new ItemStack(Material.LEATHER_BOOTS);
LeatherArmorMeta metaBoots = (LeatherArmorMeta)armor.getItemMeta();
metaBoots.setColor(Manager.GetGame().GetTeam(player).GetColorBase());
boots.setItemMeta(metaBoots);
player.getInventory().setBoots(boots);
player.getInventory().setItem(8, armor.clone());
} }
@Override @Override

View File

@ -49,24 +49,24 @@ public class SuperSmashTeam extends TeamGame
{ {
new KitSkeleton(manager), new KitSkeleton(manager),
new KitGolem(manager), //new KitGolem(manager),
new KitSpider(manager), //new KitSpider(manager),
new KitSlime(manager), //new KitSlime(manager),
new KitCreeper(manager), new KitCreeper(manager),
new KitEnderman(manager), //new KitEnderman(manager),
new KitSnowman(manager), //new KitSnowman(manager),
new KitWolf(manager), new KitWolf(manager),
new KitBlaze(manager), new KitBlaze(manager),
new KitWitch(manager), new KitWitch(manager),
new KitChicken(manager), //new KitChicken(manager),
new KitSkeletalHorse(manager), new KitSkeletalHorse(manager),
new KitPig(manager), //new KitPig(manager),
new KitSkySquid(manager), new KitSkySquid(manager),
new KitWitherSkeleton(manager), new KitWitherSkeleton(manager),
new KitMagmaCube(manager), //new KitMagmaCube(manager),
}, },
@ -81,13 +81,15 @@ public class SuperSmashTeam extends TeamGame
this.DeathOut = false; this.DeathOut = false;
this.DamageTeamSelf = true; this.DamageTeamSelf = false;
this.CompassEnabled = true; this.CompassEnabled = true;
this.SpawnDistanceRequirement = 16; this.SpawnDistanceRequirement = 16;
this.InventoryOpen = false; this.InventoryOpen = false;
this.TeamArmorHotbar = true;
} }
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
@ -221,9 +223,6 @@ public class SuperSmashTeam extends TeamGame
event.GetDamageeEntity().eject(); event.GetDamageeEntity().eject();
event.GetDamageeEntity().leaveVehicle(); event.GetDamageeEntity().leaveVehicle();
if (event.GetDamageePlayer() != null)
event.GetDamageeEntity().getWorld().strikeLightningEffect(event.GetDamageeEntity().getLocation());
event.AddMod("Smash", "Super Smash Mobs", 5000, false); event.AddMod("Smash", "Super Smash Mobs", 5000, false);
} }
} }

View File

@ -6,6 +6,7 @@ import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton.SkeletonType; import org.bukkit.entity.Skeleton.SkeletonType;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.LeatherArmorMeta;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.disguise.disguises.DisguiseSkeleton; import mineplex.core.disguise.disguises.DisguiseSkeleton;

View File

@ -43,7 +43,6 @@ public class SpleefTeams extends TeamGame
new String[] new String[]
{ {
"Punch blocks to break them!", "Punch blocks to break them!",
"1 Hunger per block smashed!",
"Last team alive wins!" "Last team alive wins!"
}); });
@ -51,6 +50,9 @@ public class SpleefTeams extends TeamGame
this.WorldWaterDamage = 4; this.WorldWaterDamage = 4;
this.PrepareFreeze = false; this.PrepareFreeze = false;
this.TeamArmor = true;
this.TeamArmorHotbar = true;
} }
@EventHandler @EventHandler
@ -201,6 +203,9 @@ public class SpleefTeams extends TeamGame
@EventHandler @EventHandler
public void Hunger(UpdateEvent event) public void Hunger(UpdateEvent event)
{ {
if (Manager.IsTournamentServer())
return;
if (event.getType() != UpdateType.SEC) if (event.getType() != UpdateType.SEC)
return; return;

View File

@ -127,12 +127,12 @@ public class SurvivalGamesTeams extends TeamGame
new KitKnight(manager), new KitKnight(manager),
new KitArcher(manager), new KitArcher(manager),
new KitBrawler(manager), //new KitBrawler(manager),
new KitAssassin(manager), //new KitAssassin(manager),
new KitBeastmaster(manager), new KitBeastmaster(manager),
new KitBomber(manager), //new KitBomber(manager),
new KitNecromancer(manager) //new KitNecromancer(manager)
}, },
new String[] new String[]
@ -230,6 +230,10 @@ public class SurvivalGamesTeams extends TeamGame
System.out.println("CREEP TYPE: " + _spreadName); System.out.println("CREEP TYPE: " + _spreadName);
System.out.println("==================="); System.out.println("===================");
//Manager.GetStatsManager().addTable(GetName(), "kills", "deaths", "chestsOpened"); //Manager.GetStatsManager().addTable(GetName(), "kills", "deaths", "chestsOpened");
//Tournament
if (Manager.IsTournamentServer())
QuitOut = false;
} }
@Override @Override
@ -433,14 +437,14 @@ public class SurvivalGamesTeams extends TeamGame
for (int i = 0; i < 30; i++) _baseChestLoot.add(new ItemStack(Material.WEB, 2)); for (int i = 0; i < 30; i++) _baseChestLoot.add(new ItemStack(Material.WEB, 2));
//Food //Food
for (int i = 0; i < 40; i++) _baseChestLoot.add(new ItemStack(Material.MUSHROOM_SOUP)); for (int i = 0; i < 60; i++) _baseChestLoot.add(new ItemStack(Material.MUSHROOM_SOUP, 1));
for (int i = 0; i < 50; i++) _baseChestLoot.add(new ItemStack(Material.COOKED_CHICKEN)); for (int i = 0; i < 50; i++) _baseChestLoot.add(new ItemStack(Material.COOKED_CHICKEN, 4));
for (int i = 0; i < 80; i++) _baseChestLoot.add(new ItemStack(Material.RAW_BEEF)); for (int i = 0; i < 80; i++) _baseChestLoot.add(new ItemStack(Material.RAW_BEEF, 4));
for (int i = 0; i < 50; i++) _baseChestLoot.add(new ItemStack(Material.GRILLED_PORK)); for (int i = 0; i < 50; i++) _baseChestLoot.add(new ItemStack(Material.GRILLED_PORK, 4));
for (int i = 0; i < 100; i++) _baseChestLoot.add(new ItemStack(Material.BREAD)); for (int i = 0; i < 100; i++) _baseChestLoot.add(new ItemStack(Material.BREAD, 4));
for (int i = 0; i < 40; i++) _baseChestLoot.add(new ItemStack(Material.PUMPKIN_PIE)); for (int i = 0; i < 40; i++) _baseChestLoot.add(new ItemStack(Material.PUMPKIN_PIE, 4));
for (int i = 0; i < 80; i++) _baseChestLoot.add(new ItemStack(Material.COOKIE)); for (int i = 0; i < 80; i++) _baseChestLoot.add(new ItemStack(Material.COOKIE, 4));
for (int i = 0; i < 90; i++) _baseChestLoot.add(new ItemStack(Material.ROTTEN_FLESH)); for (int i = 0; i < 90; i++) _baseChestLoot.add(new ItemStack(Material.ROTTEN_FLESH, 4));
for (int i = 0; i < 80; i++) _baseChestLoot.add(new ItemStack(Material.WHEAT, 6)); for (int i = 0; i < 80; i++) _baseChestLoot.add(new ItemStack(Material.WHEAT, 6));

View File

@ -4,8 +4,11 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import nautilus.game.arcade.ArcadeFormat; import nautilus.game.arcade.ArcadeFormat;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerKitGiveEvent;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
@ -106,11 +109,20 @@ public abstract class Kit implements Listener
for (Perk perk : _kitPerks) for (Perk perk : _kitPerks)
perk.Apply(player); perk.Apply(player);
GiveItems(player); GiveItemsCall(player);
UtilInv.Update(player); UtilInv.Update(player);
} }
public void GiveItemsCall(Player player)
{
GiveItems(player);
//Event
PlayerKitGiveEvent kitEvent = new PlayerKitGiveEvent(Manager.GetGame(), this, player);
UtilServer.getServer().getPluginManager().callEvent(kitEvent);
}
public abstract void GiveItems(Player player); public abstract void GiveItems(Player player);
public Entity SpawnEntity(Location loc) public Entity SpawnEntity(Location loc)
@ -190,4 +202,6 @@ public abstract class Kit implements Listener
public void Deselected(Player player) { } public void Deselected(Player player) { }
public void Selected(Player player) { } public void Selected(Player player) { }
} }

View File

@ -99,6 +99,10 @@ public class PerkThrower extends Perk implements IThrown
return; return;
} }
} }
else
{
return;
}
//Damage Event //Damage Event
Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null,
@ -112,7 +116,7 @@ public class PerkThrower extends Perk implements IThrown
dir = UtilAlg.getTrajectory(target, data.GetThrown()); dir = UtilAlg.getTrajectory(target, data.GetThrown());
if (dir.getY() < 0) dir.setY(0); if (dir.getY() < 0) dir.setY(0);
UtilAction.velocity(data.GetThrown(), dir, 1.2, false, 0, 0.4, 1, true); UtilAction.velocity(data.GetThrown(), dir, 0.2, false, 0, 0.2, 1, true);
//Effect //Effect
data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.SHEEP_IDLE, 3f, 5f); data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.SHEEP_IDLE, 3f, 5f);

View File

@ -79,7 +79,11 @@ public class PerkWitherImage extends Perk
skel.setMaxHealth(20); skel.setMaxHealth(20);
skel.setHealth(skel.getMaxHealth()); skel.setHealth(skel.getMaxHealth());
if (Manager.GetGame().GetTeamList().size() > 1)
skel.setCustomName(Manager.GetColor(player) + player.getName());
else
skel.setCustomName(C.cYellow + player.getName()); skel.setCustomName(C.cYellow + player.getName());
skel.setCustomNameVisible(true); skel.setCustomNameVisible(true);
//skel.setLeashHolder(player); //skel.setLeashHolder(player);

View File

@ -416,6 +416,10 @@ public class GameManager implements Listener
{ {
player.sendMessage(F.main("Afk Monitor", "You are being sent to the Lobby for being AFK.")); player.sendMessage(F.main("Afk Monitor", "You are being sent to the Lobby for being AFK."));
Manager.GetPortal().SendPlayerToServer(player, "Lobby"); Manager.GetPortal().SendPlayerToServer(player, "Lobby");
}
else if (Manager.IsObserver(player))
{
} }
else if (!game.IsPlaying(player)) else if (!game.IsPlaying(player))
{ {
@ -523,6 +527,15 @@ public class GameManager implements Listener
UtilServer.getServer().getPluginManager().callEvent(event); UtilServer.getServer().getPluginManager().callEvent(event);
} }
}, players.size()); }, players.size());
//Spectators Move
for (Player player : UtilServer.getPlayers())
{
if (Manager.GetGame().IsAlive(player))
continue;
Manager.GetGame().SetSpectator(player);
}
} }
@EventHandler @EventHandler

View File

@ -149,6 +149,13 @@ public class GamePlayerManager implements Listener
Player player = event.getPlayer(); Player player = event.getPlayer();
//Observer
if (Manager.IsObserver(player))
{
UtilPlayer.message(player, F.main("Game", "Spectators cannot partake in games."));
return;
}
GameTeam team = Manager.GetLobby().GetClickedTeam(event.getRightClicked()); GameTeam team = Manager.GetLobby().GetClickedTeam(event.getRightClicked());
if (team == null) if (team == null)
@ -163,6 +170,13 @@ public class GamePlayerManager implements Listener
Player player = event.GetDamagerPlayer(false); Player player = event.GetDamagerPlayer(false);
if (player == null) return; if (player == null) return;
//Observer
if (Manager.IsObserver(player))
{
UtilPlayer.message(player, F.main("Game", "Spectators cannot partake in games."));
return;
}
LivingEntity target = event.GetDamageeEntity(); LivingEntity target = event.GetDamageeEntity();
GameTeam team = Manager.GetLobby().GetClickedTeam(target); GameTeam team = Manager.GetLobby().GetClickedTeam(target);
@ -251,6 +265,13 @@ public class GamePlayerManager implements Listener
Player player = event.getPlayer(); Player player = event.getPlayer();
//Observer
if (Manager.IsObserver(player))
{
UtilPlayer.message(player, F.main("Game", "Spectators cannot partake in games."));
return;
}
if (player.getGameMode() != GameMode.SURVIVAL) if (player.getGameMode() != GameMode.SURVIVAL)
return; return;
@ -276,6 +297,13 @@ public class GamePlayerManager implements Listener
Player player = event.GetDamagerPlayer(false); Player player = event.GetDamagerPlayer(false);
if (player == null) return; if (player == null) return;
//Observer
if (Manager.IsObserver(player))
{
UtilPlayer.message(player, F.main("Game", "Spectators cannot partake in games."));
return;
}
if (player.getGameMode() != GameMode.SURVIVAL) if (player.getGameMode() != GameMode.SURVIVAL)
return; return;