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.util.ArrayList;
import java.util.HashSet;
import nautilus.game.arcade.addons.*;
import nautilus.game.arcade.command.*;
@ -105,6 +106,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation
private ClassCombatShop _classShop;
private MiscManager _miscManager;
//Observers
private HashSet<Player> _specList = new HashSet<Player>();
//Server Games
private GameServerConfig _serverConfig;
@ -191,6 +195,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
//Game Addons
new CompassAddon(plugin, this);
new SoupAddon(plugin, this);
new TeamArmorAddon(plugin, this);
}
@Override
@ -396,6 +401,12 @@ public class ArcadeManager extends MiniPlugin implements IRelation
@EventHandler
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);
if (_game == null || _game.GetState() == GameState.Recruit)
@ -405,7 +416,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
event.setMotd(ChatColor.RED + "UHC - Season 5");
return;
}
if (_game != null && _game.GetCountdown() != -1)
{
event.setMotd(ChatColor.GREEN + "Starting in " + _game.GetCountdown() + " Seconds" + extrainformation);
@ -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()
{
return _serverConfig.Tournament;

View File

@ -40,6 +40,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.scoreboard.DisplaySlot;
import org.bukkit.scoreboard.Objective;
import org.bukkit.scoreboard.Score;
@ -84,7 +85,7 @@ public abstract class Game implements Listener
//Teams
private ArrayList<GameTeam> _teamList = new ArrayList<GameTeam>();
//Player Preferences
protected NautHashMap<Player, Kit> _playerKit = new NautHashMap<Player, Kit>();
private NautHashMap<GameTeam, ArrayList<Player>> _teamPreference = new NautHashMap<GameTeam, ArrayList<Player>>();
@ -147,7 +148,7 @@ public abstract class Game implements Listener
public boolean CreatureAllow = false;
public boolean CreatureAllowOverride = false;
public int WorldTimeSet = -1;
public int WorldTimeSet = 12000;
public boolean WorldWeatherEnabled = false;
public int WorldWaterDamage = 0;
public boolean WorldBoundaryKill = true;
@ -177,6 +178,8 @@ public abstract class Game implements Listener
//Addons
public boolean CompassEnabled = false;
public boolean SoupEnabled = true;
public boolean TeamArmor = false;
public boolean TeamArmorHotbar = false;
public boolean GiveClock = true;

View File

@ -214,7 +214,7 @@ public class GameTeam
}
public void SpawnTeleport(Player player)
{
{
player.leaveVehicle();
player.eject();
player.teleport(GetSpawn());

View File

@ -23,6 +23,7 @@ public abstract class TeamGame extends Game
{
private NautHashMap<String, Long> _rejoinTime = new NautHashMap<String, Long>();
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)
{
@ -53,6 +54,10 @@ public abstract class TeamGame extends Game
//Store
_rejoinTime.put(player.getName(), System.currentTimeMillis());
RejoinTeam.put(player.getName(), team);
if (GetKit(player) != null)
RejoinKit.put(player.getName(), GetKit(player));
GetLocationStore().put(player.getName(), player.getLocation());
//Announcement
@ -72,6 +77,12 @@ public abstract class TeamGame extends Game
{
team.AddPlayer(event.getPlayer());
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;
}
@ -107,6 +118,8 @@ public abstract class TeamGame extends Game
GameTeam team = RejoinTeam.remove(name);
if (team != null)
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>();
//Tourney Mode
private boolean _tournament = false;
private boolean _tournament;
private HashMap<GameTeam, Integer> _tournamentKills = new HashMap<GameTeam, Integer>();
//Scoreboard
@ -152,9 +152,13 @@ public class Bridge extends TeamGame implements OreObsfucation
GemMultiplier = 2.5;
PrepareFreeze = false;
//Tournament
if (Manager.IsTournamentServer())
QuitOut = false;
_tournament = Manager.IsTournamentServer();
}
@EventHandler
@ -165,13 +169,13 @@ public class Bridge extends TeamGame implements OreObsfucation
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()))
{
_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);
}

View File

@ -32,6 +32,7 @@ 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.PlayerPrepareTeleportEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.TeamGame;
@ -75,6 +76,8 @@ public class DragonEscapeTeams extends TeamGame
this.DamagePvP = false;
this.HungerSet = 20;
this.TeamArmorHotbar = true;
}
@Override
@ -144,6 +147,12 @@ public class DragonEscapeTeams extends TeamGame
if (WorldData.MapName.contains("Hell"))
this.WorldTimeSet = 16000;
}
@EventHandler
public void PlayerTeleport(PlayerPrepareTeleportEvent event)
{
Manager.GetCondition().Factory().Invisible(GetName(), event.GetPlayer(), event.GetPlayer(), 16, 1, false, false, false);
}
@EventHandler
public void SpawnDragon(GameStateChangeEvent event)

View File

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

View File

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

View File

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

View File

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

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.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

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.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

View File

@ -49,24 +49,24 @@ public class SuperSmashTeam extends TeamGame
{
new KitSkeleton(manager),
new KitGolem(manager),
new KitSpider(manager),
new KitSlime(manager),
//new KitGolem(manager),
//new KitSpider(manager),
//new KitSlime(manager),
new KitCreeper(manager),
new KitEnderman(manager),
new KitSnowman(manager),
//new KitEnderman(manager),
//new KitSnowman(manager),
new KitWolf(manager),
new KitBlaze(manager),
new KitWitch(manager),
new KitChicken(manager),
//new KitChicken(manager),
new KitSkeletalHorse(manager),
new KitPig(manager),
//new KitPig(manager),
new KitSkySquid(manager),
new KitWitherSkeleton(manager),
new KitMagmaCube(manager),
//new KitMagmaCube(manager),
},
@ -81,13 +81,15 @@ public class SuperSmashTeam extends TeamGame
this.DeathOut = false;
this.DamageTeamSelf = true;
this.DamageTeamSelf = false;
this.CompassEnabled = true;
this.SpawnDistanceRequirement = 16;
this.InventoryOpen = false;
this.TeamArmorHotbar = true;
}
@EventHandler(priority = EventPriority.HIGH)
@ -221,9 +223,6 @@ public class SuperSmashTeam extends TeamGame
event.GetDamageeEntity().eject();
event.GetDamageeEntity().leaveVehicle();
if (event.GetDamageePlayer() != null)
event.GetDamageeEntity().getWorld().strikeLightningEffect(event.GetDamageeEntity().getLocation());
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.Skeleton.SkeletonType;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.LeatherArmorMeta;
import mineplex.core.common.util.C;
import mineplex.core.disguise.disguises.DisguiseSkeleton;
@ -51,7 +52,7 @@ public class KitWitherSkeleton extends SmashKit
ChatColor.RESET + "block to guide the missile! Release",
ChatColor.RESET + "block to detonate it midair.",
}));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Wither Image",
new String[]
@ -68,7 +69,7 @@ public class KitWitherSkeleton extends SmashKit
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS));
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS));
//Disguise
DisguiseSkeleton disguise = new DisguiseSkeleton(player);
@ -76,13 +77,13 @@ public class KitWitherSkeleton extends SmashKit
disguise.SetName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
else
disguise.SetName(player.getName());
disguise.SetCustomNameVisible(true);
disguise.SetSkeletonType(SkeletonType.WITHER);
disguise.hideArmor();
Manager.GetDisguise().disguise(disguise);
}
@Override
public int GetCost()
{

View File

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

View File

@ -127,12 +127,12 @@ public class SurvivalGamesTeams extends TeamGame
new KitKnight(manager),
new KitArcher(manager),
new KitBrawler(manager),
//new KitBrawler(manager),
new KitAssassin(manager),
//new KitAssassin(manager),
new KitBeastmaster(manager),
new KitBomber(manager),
new KitNecromancer(manager)
//new KitBomber(manager),
//new KitNecromancer(manager)
},
new String[]
@ -230,6 +230,10 @@ public class SurvivalGamesTeams extends TeamGame
System.out.println("CREEP TYPE: " + _spreadName);
System.out.println("===================");
//Manager.GetStatsManager().addTable(GetName(), "kills", "deaths", "chestsOpened");
//Tournament
if (Manager.IsTournamentServer())
QuitOut = false;
}
@Override
@ -433,14 +437,14 @@ public class SurvivalGamesTeams extends TeamGame
for (int i = 0; i < 30; i++) _baseChestLoot.add(new ItemStack(Material.WEB, 2));
//Food
for (int i = 0; i < 40; i++) _baseChestLoot.add(new ItemStack(Material.MUSHROOM_SOUP));
for (int i = 0; i < 50; i++) _baseChestLoot.add(new ItemStack(Material.COOKED_CHICKEN));
for (int i = 0; i < 80; i++) _baseChestLoot.add(new ItemStack(Material.RAW_BEEF));
for (int i = 0; i < 50; i++) _baseChestLoot.add(new ItemStack(Material.GRILLED_PORK));
for (int i = 0; i < 100; i++) _baseChestLoot.add(new ItemStack(Material.BREAD));
for (int i = 0; i < 40; i++) _baseChestLoot.add(new ItemStack(Material.PUMPKIN_PIE));
for (int i = 0; i < 80; i++) _baseChestLoot.add(new ItemStack(Material.COOKIE));
for (int i = 0; i < 90; i++) _baseChestLoot.add(new ItemStack(Material.ROTTEN_FLESH));
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, 4));
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, 4));
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, 4));
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, 4));
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.UtilInv;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import nautilus.game.arcade.ArcadeFormat;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerKitGiveEvent;
import org.bukkit.ChatColor;
import org.bukkit.Location;
@ -98,7 +101,7 @@ public abstract class Kit implements Listener
return Manager.GetGame().HasKit(player, this);
}
public void ApplyKit(Player player)
{
UtilInv.Clear(player);
@ -106,11 +109,20 @@ public abstract class Kit implements Listener
for (Perk perk : _kitPerks)
perk.Apply(player);
GiveItems(player);
GiveItemsCall(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 Entity SpawnEntity(Location loc)
@ -190,4 +202,6 @@ public abstract class Kit implements Listener
public void Deselected(Player player) { }
public void Selected(Player player) { }
}

View File

@ -99,6 +99,10 @@ public class PerkThrower extends Perk implements IThrown
return;
}
}
else
{
return;
}
//Damage Event
Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null,
@ -112,7 +116,7 @@ public class PerkThrower extends Perk implements IThrown
dir = UtilAlg.getTrajectory(target, data.GetThrown());
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
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.setHealth(skel.getMaxHealth());
skel.setCustomName(C.cYellow + player.getName());
if (Manager.GetGame().GetTeamList().size() > 1)
skel.setCustomName(Manager.GetColor(player) + player.getName());
else
skel.setCustomName(C.cYellow + player.getName());
skel.setCustomNameVisible(true);
//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."));
Manager.GetPortal().SendPlayerToServer(player, "Lobby");
}
else if (Manager.IsObserver(player))
{
}
else if (!game.IsPlaying(player))
{
@ -523,6 +527,15 @@ public class GameManager implements Listener
UtilServer.getServer().getPluginManager().callEvent(event);
}
}, players.size());
//Spectators Move
for (Player player : UtilServer.getPlayers())
{
if (Manager.GetGame().IsAlive(player))
continue;
Manager.GetGame().SetSpectator(player);
}
}
@EventHandler

View File

@ -43,14 +43,14 @@ import org.bukkit.event.player.PlayerRespawnEvent;
public class GamePlayerManager implements Listener
{
ArcadeManager Manager;
public GamePlayerManager(ArcadeManager manager)
{
Manager = manager;
Manager.GetPluginManager().registerEvents(this, Manager.GetPlugin());
}
@EventHandler(priority = EventPriority.HIGH)
public void PlayerDeath(CombatDeathEvent event)
{
@ -60,7 +60,7 @@ public class GamePlayerManager implements Listener
//Dont display message
if (Manager.GetGame() != null)
event.SetBroadcastType(Manager.GetGame().GetDeathMessageType());
//Colors
if (event.GetLog().GetKiller() != null)
{
@ -82,7 +82,7 @@ public class GamePlayerManager implements Listener
public void PlayerJoin(PlayerJoinEvent event)
{
final Player player = event.getPlayer();
//Lobby Name
Manager.GetLobby().AddPlayerToScoreboards(player, null);
@ -140,7 +140,7 @@ public class GamePlayerManager implements Listener
event.setRespawnLocation(Manager.GetGame().GetSpectatorLocation());
}
}
@EventHandler(priority = EventPriority.HIGH)
public void TeamInteract(PlayerInteractEntityEvent event)
{
@ -149,6 +149,13 @@ public class GamePlayerManager implements Listener
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());
if (team == null)
@ -163,6 +170,13 @@ public class GamePlayerManager implements Listener
Player player = event.GetDamagerPlayer(false);
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();
GameTeam team = Manager.GetLobby().GetClickedTeam(target);
@ -186,7 +200,7 @@ public class GamePlayerManager implements Listener
AddTeamPreference(Manager.GetGame(), player, team);
}
public void AddTeamPreference(Game game, Player player, GameTeam team)
{
GameTeam past = game.GetTeamPreference(player);
@ -204,16 +218,16 @@ public class GamePlayerManager implements Listener
if (past != null)
{
game.RemoveTeamPreference(player);
if (game.GetType() == GameType.UHC)
{
String players = "";
for (Player other : game.GetTeamPreferences().get(past))
players += other.getName() + " ";
if (players.length() > 0)
players = players.substring(0, players.length()-1);
for (Player other : game.GetTeamPreferences().get(past))
UtilPlayer.message(other, past.GetFormattedName() + " Team: " + ChatColor.RESET + players);
}
@ -230,10 +244,10 @@ public class GamePlayerManager implements Listener
String players = "";
for (Player other : game.GetTeamPreferences().get(team))
players += other.getName() + " ";
if (players.length() > 0)
players = players.substring(0, players.length()-1);
for (Player other : game.GetTeamPreferences().get(team))
UtilPlayer.message(other, team.GetFormattedName() + " Team: " + ChatColor.RESET + players);
}
@ -250,7 +264,14 @@ public class GamePlayerManager implements Listener
return;
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)
return;
@ -260,7 +281,7 @@ public class GamePlayerManager implements Listener
return;
KitClick(player, kit, event.getRightClicked());
event.setCancelled(true);
}
@ -269,13 +290,20 @@ public class GamePlayerManager implements Listener
{
if (Manager.GetGame() != null && Manager.GetGame().InProgress())
return;
if (event.GetCause() != DamageCause.ENTITY_ATTACK)
return;
Player player = event.GetDamagerPlayer(false);
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)
return;
@ -311,16 +339,16 @@ public class GamePlayerManager implements Listener
{
Manager.GetShop().OpenPageForPlayer(player, new ConfirmationPage<ArcadeManager, ArcadeShop>(
Manager, Manager.GetShop(), Manager.GetClients(), Manager.GetDonation(), new Runnable()
{
public void run()
{
if (player.isOnline())
{
Manager.GetGame().SetKit(player, kit, true);
((CraftPlayer)player).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entity.getEntityId(), ((CraftEntity)entity).getHandle().getDataWatcher(), true));
}
}
}, null, new KitPackage(Manager.GetGame().GetName(), kit), CurrencyType.Gems, player));
public void run()
{
if (player.isOnline())
{
Manager.GetGame().SetKit(player, kit, true);
((CraftPlayer)player).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entity.getEntityId(), ((CraftEntity)entity).getHandle().getDataWatcher(), true));
}
}
}, null, new KitPackage(Manager.GetGame().GetName(), kit), CurrencyType.Gems, player));
}
else
{