Paintball update!

This commit is contained in:
Chiss 2013-11-02 15:42:37 +11:00
parent 24723cd5e5
commit 0cbefc1280
10 changed files with 82 additions and 38 deletions

View File

@ -474,7 +474,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
((CraftPlayer)player).getHandle().spectating = false; ((CraftPlayer)player).getHandle().spectating = false;
((CraftPlayer)player).getHandle().m = true; ((CraftPlayer)player).getHandle().m = true;
GetCondition().EndCondition(player, ConditionType.CLOAK, "Spectator"); GetCondition().EndCondition(player, ConditionType.CLOAK, null);
HubClock(player); HubClock(player);

View File

@ -366,7 +366,8 @@ public abstract class Game implements Listener
} }
else else
{ {
_scoreboard.registerNewTeam(rank.Name + "SPEC").setPrefix(rank.Color + C.Bold + rank.Name.toUpperCase() + ChatColor.RESET + " " + ChatColor.GRAY); _scoreboard.registerNewTeam(rank.Name + "SPEC").setPrefix(ChatColor.GRAY + "");
//_scoreboard.registerNewTeam(rank.Name + "SPEC").setPrefix(rank.Color + C.Bold + rank.Name.toUpperCase() + ChatColor.RESET + " " + ChatColor.GRAY);
} }
} }
@ -381,7 +382,8 @@ public abstract class Game implements Listener
} }
else else
{ {
_scoreboard.registerNewTeam(rank.Name + team.GetName().toUpperCase()).setPrefix(rank.Color + C.Bold + rank.Name.toUpperCase() + ChatColor.RESET + " " + team.GetColor()); //_scoreboard.registerNewTeam(rank.Name + team.GetName().toUpperCase()).setPrefix(rank.Color + C.Bold + rank.Name.toUpperCase() + ChatColor.RESET + " " + team.GetColor());
_scoreboard.registerNewTeam(rank.Name + team.GetName().toUpperCase()).setPrefix(team.GetColor() + "");
} }
} }
} }

View File

@ -21,6 +21,7 @@ import org.bukkit.entity.Projectile;
import org.bukkit.entity.Snowball; import org.bukkit.entity.Snowball;
import org.bukkit.entity.ThrownPotion; import org.bukkit.entity.ThrownPotion;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityRegainHealthEvent; import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.entity.ProjectileHitEvent;
@ -77,7 +78,6 @@ public class Paintball extends TeamGame
}); });
} }
/*
@EventHandler @EventHandler
public void CustomTeamGeneration(GameStateChangeEvent event) public void CustomTeamGeneration(GameStateChangeEvent event)
{ {
@ -90,22 +90,36 @@ public class Paintball extends TeamGame
this.GetTeamList().get(1).SetColor(ChatColor.RED); this.GetTeamList().get(1).SetColor(ChatColor.RED);
this.GetTeamList().get(1).SetName("Nether"); this.GetTeamList().get(1).SetName("Nether");
} }
*/
@EventHandler @EventHandler(priority = EventPriority.HIGH)
public void ColorArmor(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Prepare)
return;
for (Player player : GetPlayers(true))
{
CleanColorArmor(player);
}
}
@EventHandler(priority = EventPriority.HIGH)
public void RefreshPlayers(GameStateChangeEvent event) public void RefreshPlayers(GameStateChangeEvent event)
{ {
if (event.GetState() != GameState.Live) if (event.GetState() != GameState.Live)
return; return;
for (Player player : GetPlayers(true)) for (Player player : GetPlayers(true))
{
for (Player other : GetPlayers(true)) for (Player other : GetPlayers(true))
{ {
other.hidePlayer(player); other.hidePlayer(player);
other.showPlayer(player); other.showPlayer(player);
} }
} }
}
@EventHandler @EventHandler
public void HealthRegen(EntityRegainHealthEvent event) public void HealthRegen(EntityRegainHealthEvent event)
@ -164,9 +178,6 @@ public class Paintball extends TeamGame
@EventHandler @EventHandler
public void PaintballDamage(CustomDamageEvent event) public void PaintballDamage(CustomDamageEvent event)
{ {
if (event.IsCancelled())
return;
if (event.GetProjectile() == null) if (event.GetProjectile() == null)
return; return;
@ -185,6 +196,15 @@ public class Paintball extends TeamGame
Player damager = event.GetDamagerPlayer(true); Player damager = event.GetDamagerPlayer(true);
if (damager == null) return; if (damager == null) return;
GameTeam damageeTeam = GetTeam(damagee);
if (damageeTeam == null) return;
GameTeam damagerTeam = GetTeam(damager);
if (damagerTeam == null) return;
if (damagerTeam.equals(damageeTeam))
return;
//Color //Color
Color color = Color.RED; Color color = Color.RED;
if (event.GetProjectile() instanceof Snowball) if (event.GetProjectile() instanceof Snowball)
@ -201,13 +221,15 @@ public class Paintball extends TeamGame
} }
//Out //Out
if (Color(damagee, color, count)) if (Color(damagee, count))
{ {
PlayerOut(damagee); PlayerOut(damagee);
Announce(GetTeam(damagee).GetColor() + damagee.getName() + ChatColor.RESET + " was painted by " + for (Player player : UtilServer.getPlayers())
GetTeam(damager).GetColor() + damager.getName()); UtilPlayer.message(player, damageeTeam.GetColor() + damagee.getName() + ChatColor.RESET + " was painted by " +
} damagerTeam.GetColor() + damager.getName() + ChatColor.RESET + "!");
AddGems(damager, 2, "Kill", true);
}
//Hit Sound //Hit Sound
Player player = event.GetDamagerPlayer(true); Player player = event.GetDamagerPlayer(true);
@ -215,7 +237,9 @@ public class Paintball extends TeamGame
player.playSound(player.getLocation(), Sound.ORB_PICKUP, 1f, 3f); player.playSound(player.getLocation(), Sound.ORB_PICKUP, 1f, 3f);
} }
public boolean Color(Player player, Color color, int amount)
public boolean Color(Player player, int amount)
{ {
//Get Non-Coloured //Get Non-Coloured
ArrayList<ItemStack> nonColored = new ArrayList<ItemStack>(); ArrayList<ItemStack> nonColored = new ArrayList<ItemStack>();
@ -226,7 +250,7 @@ public class Paintball extends TeamGame
LeatherArmorMeta meta = (LeatherArmorMeta)stack.getItemMeta(); LeatherArmorMeta meta = (LeatherArmorMeta)stack.getItemMeta();
if (meta.getColor().equals(Color.WHITE)) if (meta.getColor().equals(Color.RED) || meta.getColor().equals(Color.AQUA))
nonColored.add(stack); nonColored.add(stack);
} }
@ -239,7 +263,7 @@ public class Paintball extends TeamGame
ItemStack armor = nonColored.remove(UtilMath.r(nonColored.size())); ItemStack armor = nonColored.remove(UtilMath.r(nonColored.size()));
LeatherArmorMeta meta = (LeatherArmorMeta)armor.getItemMeta(); LeatherArmorMeta meta = (LeatherArmorMeta)armor.getItemMeta();
meta.setColor(color); meta.setColor(Color.PURPLE);
armor.setItemMeta(meta); armor.setItemMeta(meta);
} }
@ -369,16 +393,12 @@ public class Paintball extends TeamGame
((CraftPlayer)player).getHandle().spectating = false; ((CraftPlayer)player).getHandle().spectating = false;
((CraftPlayer)player).getHandle().m = true; ((CraftPlayer)player).getHandle().m = true;
//Clean Armor //Items
for (ItemStack stack : player.getInventory().getArmorContents()) player.getInventory().remove(Material.WATCH);
{ player.getInventory().remove(Material.COMPASS);
if (!(stack.getItemMeta() instanceof LeatherArmorMeta))
continue;
LeatherArmorMeta meta = (LeatherArmorMeta)stack.getItemMeta(); //Clean Armor
meta.setColor(Color.WHITE); CleanColorArmor(player);
stack.setItemMeta(meta);
}
//Inform //Inform
UtilPlayer.message(player, F.main("Game", "You have been cleaned!")); UtilPlayer.message(player, F.main("Game", "You have been cleaned!"));
@ -391,6 +411,7 @@ public class Paintball extends TeamGame
public void run() public void run()
{ {
//Remove Invis //Remove Invis
if (IsAlive(player))
Manager.GetCondition().EndCondition(player, ConditionType.CLOAK, null); Manager.GetCondition().EndCondition(player, ConditionType.CLOAK, null);
//Remove Copy //Remove Copy
@ -399,4 +420,21 @@ public class Paintball extends TeamGame
}, 4); }, 4);
} }
} }
public void CleanColorArmor(Player player)
{
Color color = Color.RED;
if (Manager.GetColor(player) != ChatColor.RED)
color = Color.AQUA;
for (ItemStack stack : player.getInventory().getArmorContents())
{
if (!(stack.getItemMeta() instanceof LeatherArmorMeta))
continue;
LeatherArmorMeta meta = (LeatherArmorMeta)stack.getItemMeta();
meta.setColor(color);
stack.setItemMeta(meta);
}
}
} }

View File

@ -29,7 +29,8 @@ public class PlayerCopy
//Armor //Armor
_ent.getEquipment().setArmorContents(owner.getInventory().getArmorContents()); _ent.getEquipment().setArmorContents(owner.getInventory().getArmorContents());
_ent.setCustomName(C.cWhite + C.Bold + "OUT " + ChatColor.RESET + host.GetTeam(owner).GetColor() + owner.getName());
_ent.setCustomName(C.cWhite + C.Bold + C.Scramble + "XX" + ChatColor.RESET + " " + host.GetTeam(owner).GetColor() + owner.getName() + " " + C.cWhite + C.Bold + C.Scramble + "XX");
_ent.setCustomNameVisible(true); _ent.setCustomNameVisible(true);
//Disguise //Disguise

View File

@ -1,5 +1,6 @@
package nautilus.game.arcade.game.games.paintball.kits; package nautilus.game.arcade.game.games.paintball.kits;
import org.bukkit.ChatColor;
import org.bukkit.Color; import org.bukkit.Color;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
@ -24,7 +25,7 @@ public class KitShotgun extends Kit
new String[] new String[]
{ {
"Pump action paintball shotgun.", "Pump action paintball shotgun.",
C.cGold + "4 Hit Kill" C.cGold + "8 Pellets, 4 Pellet Hits Kill"
}, },
new Perk[] new Perk[]

View File

@ -44,7 +44,7 @@ public class PerkPaintballMachineGun extends Perk
continue; continue;
if (Recharge.Instance.usable(player, "Cool")) if (Recharge.Instance.usable(player, "Cool"))
player.setExp((float)Math.max(0f, player.getExp() - 0.015f)); player.setExp((float)Math.max(0f, player.getExp() - 0.020f));
} }
} }
@ -76,6 +76,7 @@ public class PerkPaintballMachineGun extends Perk
ShootPaintball(player, team); ShootPaintball(player, team);
/*
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable() UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable()
{ {
public void run() public void run()
@ -83,6 +84,7 @@ public class PerkPaintballMachineGun extends Perk
ShootPaintball(player, team); ShootPaintball(player, team);
} }
}, 2); }, 2);
*/
} }
public void ShootPaintball(Player player, GameTeam team) public void ShootPaintball(Player player, GameTeam team)
@ -90,7 +92,7 @@ public class PerkPaintballMachineGun extends Perk
//Energy //Energy
if (player.getExp() >= 0.97) if (player.getExp() >= 0.97)
return; return;
player.setExp((float) (player.getExp() + 0.03)); player.setExp((float) (player.getExp() + 0.025));
//Shoot //Shoot
Vector rand = new Vector(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5); Vector rand = new Vector(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5);
@ -114,8 +116,7 @@ public class PerkPaintballMachineGun extends Perk
//proj.setVelocity(player.getLocation().getDirection().multiply(1.6).add(rand)); //proj.setVelocity(player.getLocation().getDirection().multiply(1.6).add(rand));
//proj.setShooter(player); //proj.setShooter(player);
//Projectile proj = player.launchProjectile(EnderPearl.class); Projectile proj = player.launchProjectile(EnderPearl.class);
Projectile proj = player.launchProjectile(Snowball.class);
proj.setVelocity(proj.getVelocity().multiply(1.6).add(rand)); proj.setVelocity(proj.getVelocity().multiply(1.6).add(rand));
//Sound //Sound

View File

@ -75,8 +75,7 @@ public class PerkPaintballRifle extends Perk
} }
else else
{ {
//Projectile proj = player.launchProjectile(EnderPearl.class); Projectile proj = player.launchProjectile(EnderPearl.class);
Projectile proj = player.launchProjectile(Snowball.class);
proj.setVelocity(proj.getVelocity().multiply(2)); proj.setVelocity(proj.getVelocity().multiply(2));
//Sound //Sound

View File

@ -68,7 +68,7 @@ public class PerkPaintballShotgun extends Perk
if (!Recharge.Instance.use(player, GetName(), 1400, true)) if (!Recharge.Instance.use(player, GetName(), 1400, true))
return; return;
for (int i=0 ; i<6 ; i++) for (int i=0 ; i<8 ; i++)
{ {
Vector rand = new Vector(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5); Vector rand = new Vector(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5);
rand.multiply(0.4); rand.multiply(0.4);
@ -83,8 +83,7 @@ public class PerkPaintballShotgun extends Perk
} }
else else
{ {
//Projectile proj = player.launchProjectile(EnderPearl.class); Projectile proj = player.launchProjectile(EnderPearl.class);
Projectile proj = player.launchProjectile(Snowball.class);
proj.setVelocity(proj.getVelocity().multiply(1).add(rand)); proj.setVelocity(proj.getVelocity().multiply(1).add(rand));
//Sound //Sound

View File

@ -97,6 +97,9 @@ public class GameGemManager implements Listener
if (event.GetState() != PlayerState.OUT) if (event.GetState() != PlayerState.OUT)
return; return;
if (event.GetGame().GetType() == GameType.Paintball)
return;
RewardGems(event.GetGame(), event.GetPlayer(), false); RewardGems(event.GetGame(), event.GetPlayer(), false);
} }